Exemple #1
0
        protected virtual void OnMessageDataExchange(Web_MedicalRecordsResp message)
        {
            var handler = Web_MedicalRecordsRespExchange;

            if (handler != null)
            {
                handler(this, new DataExchangeRespEventArgs(message));
            }
        }
Exemple #2
0
 public DataExchangeRespEventArgs(Web_MedicalRecordsResp message)
 {
     Web_MedicalRecordsRespMessage = message;
 }
Exemple #3
0
 private void ExchangeDataResp(Web_MedicalRecordsResp message)
 {
     OnMessageDataExchange(message);
 }
Exemple #4
0
 public SyncDataRespEventArgs(Web_MedicalRecordsResp message)
 {
     Web_MedicalRecordsRespMessage = message;
 }
Exemple #5
0
        /// <summary>
        /// 同步病历记录
        /// </summary>
        public void SyncWeb_MedicalRecords(Web_MedicalRecords MedicalRecords, string UnitCode)
        {
            try
            {
                string strLcoalLSH       = "";
                string strLocalCS        = "";
                string strLocalCLBH      = "";
                string strLocalRecordId  = "";
                string strTargetLSH      = MedicalRecords.LSH;
                string strTargetCS       = MedicalRecords.CS;
                string strTargetCLBH     = MedicalRecords.CLBH;
                string strTargetRecordId = MedicalRecords.ID;

                if (IsLWDD(MedicalRecords.LSH, UnitCode, ref strLcoalLSH))
                {
                    //需要添加一条虚拟出车记录
                    if (!HasVehicleMatchRecord(MedicalRecords.LSH, MedicalRecords.CLBH, MedicalRecords.CS,
                                               UnitCode, ref strLocalCS, ref strLocalCLBH))
                    {
                        //如果还未有出车记录的话不再虚拟,不插入等待重新插入
                        LogHelper.WriteLog("SyncWeb_MedicalRecords无出车记录,不插入患者信息。本地流水号:" + strLcoalLSH + " ID:" + strTargetRecordId + "  关联的流水号:" + strTargetLSH + " 车次:" + strTargetCS + " 车辆编号:" + strTargetCLBH);
                        return;
                        ////出车信息尚未关联,需先往出车信息表,生成一条记录
                        //DispatchVehicleData Dispatchdata = new DispatchVehicleData();

                        //if (hasInsertedDispatchVehicleRecord(Dispatchdata, UnitCode, strLcoalLSH, ref  strLocalCLBH, ref  strLocalCS))
                        //{
                        //    //主键关联
                        //    string sql = "insert into LWCLTBDYB (locallsh,localCS,localCLBH,TargetLSH,TargetCS,TargetCLBH,TargetDWBH) values ('"
                        //        + strLcoalLSH + "','" + strLocalCS + "','" + strLocalCLBH + "','"
                        //        + strTargetLSH + "','" + strTargetCS + "','" + strTargetCLBH + "','" + UnitCode + "')";
                        //    int i = DB120Help.ExecuteSql(sql);
                        //    if (i > 0)
                        //    {
                        //        LogHelper.WriteLog("车辆信息表主键关联成功本地流水号:" + strLcoalLSH + " 车次:" + strLocalCS + " 车辆编号:" + strLocalCLBH + "  关联的流水号:" + strTargetLSH + " 车次:" + strTargetCS + " 车辆编号:" + strTargetCLBH);
                        //    }
                        //    else
                        //    {
                        //        LogHelper.WriteLog("车辆信息表主键关联失败本地流水号:" + strLcoalLSH + " 车次:" + strLocalCS + " 车辆编号:" + strLocalCLBH + "  关联的流水号:" + strTargetLSH + " 车次:" + strTargetCS + " 车辆编号:" + strTargetCLBH);
                        //    }
                        //}
                        //else
                        //{
                        //    return;
                        //}
                    }

                    if (hasMedicalMatchRecords(strTargetRecordId, UnitCode, strTargetLSH, ref strLocalRecordId))
                    {
                        MedicalRecords.ID   = strLocalRecordId;
                        MedicalRecords.CLBH = strLocalCLBH;
                        MedicalRecords.LSH  = strLcoalLSH;
                        MedicalRecords.CS   = strLocalCS;
                        ParameterSql parSql = SyncDataSql.GetUpadateMedicalRecordsSql(MedicalRecords);
                        int          i      = DB120Help.ExecuteSql(parSql.StrSql, parSql.OrclPar);
                        if (i == 0)
                        {
                            LogHelper.WriteLog("病历记录数据更新本地库失败本地ID:" + MedicalRecords.ID + " 流水号:" + strLcoalLSH + " 车次:" + strLocalCS + " 车辆编号:" + strLocalCLBH);
                            return;
                        }

                        Web_MedicalRecordsResp Data = new Web_MedicalRecordsResp();
                        Data.CommandID = MedicalRecords.CommandID + "Resp";
                        Data.ID        = strTargetRecordId;
                        Data.Result    = 1;
                        ExchangeDataResp(Data);
                    }
                    //需要添加患者记录
                    else
                    {
                        if (hasInsertedMedicalRecords(MedicalRecords, strLcoalLSH, strLocalCS, strLocalCLBH, ref strLocalRecordId))
                        {
                            //将患者信息关联起来
                            string Sql = "insert into LWBLTBDYB (locallsh,localRecordId,TargetLSH,TargetRecordId,TargetDWBH) values (" +
                                         strLcoalLSH + ",'" + strLocalRecordId + "','" + strTargetLSH + "','" + strTargetRecordId + "','" + UnitCode + "')";
                            int i = DB120Help.ExecuteSql(Sql);
                            if (i > 0)
                            {
                                LogHelper.WriteLog("患者病历记录主键关联成功");
                            }
                            else
                            {
                                LogHelper.WriteLog("患者病历记录主键关联失败");
                            }
                            Web_MedicalRecordsResp Data = new Web_MedicalRecordsResp();
                            Data.CommandID = MedicalRecords.CommandID + "Resp";
                            Data.ID        = strTargetRecordId;
                            Data.Result    = 1;
                            ExchangeDataResp(Data);
                        }
                    }
                }
                else
                {
                    Web_MedicalRecordsResp Data = new Web_MedicalRecordsResp();
                    Data.CommandID = MedicalRecords.CommandID + "Resp";
                    Data.ID        = strTargetRecordId;
                    Data.Result    = 1;
                    ExchangeDataResp(Data);
                }
            }
            catch (Exception ex)
            {
                Web_MedicalRecordsResp Data = new Web_MedicalRecordsResp();

                Data.CommandID      = MedicalRecords.CommandID + "Resp";
                Data.ID             = MedicalRecords.ID;
                Data.Result         = 0;
                Data.FailtureReason = ex.Message;
                ExchangeDataResp(Data);
                LogHelper.WriteLog("", ex);
            }
        }