コード例 #1
0
ファイル: SyncData.cs プロジェクト: zhutoutou/SJH
        /// <summary>
        /// 同步病历记录
        /// </summary>
        /// <param name="strMsg"></param>
        public void HandleWeb_MedicalRecordsData(string message)
        {
            try
            {
                Web_MedicalRecords item = (Web_MedicalRecords)XmlUtil.Deserialize(typeof(Web_MedicalRecords), message);

                IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                Data.Web_MedicalRecordsRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_Web_MedicalRecordsRespExchange);

                List <Web_MedicalRecords> DataList = new List <Web_MedicalRecords>();
                DataList.Add(item);
                Data.InsertWeb_MedicalRecords(DataList, ServerClient.UnitXZBM);

                //同步联网调度单的患者信息到市120本地库中
                ISyncData syncData = LocalDataAccess.SyncDataAccess();
                syncData.Web_MedicalRecordsRespExchange += new EventHandler <SyncDataRespEventArgs>(Data_Web_MedicalRecordsRespSync);
                syncData.SyncWeb_MedicalRecords(item, ServerClient.UnitCode);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("", ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// 开始同步市120本地数据到市全局库中
        /// </summary>
        public void StartSyncLocalData()
        {
            while (true)
            {
                //上传单位信息
                try
                {
                    List <UnitInfoData> UnitInfo = LocalData.GetUnitInfoData();
                    if (UnitInfo.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.UnitInfoDataRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_UnitInfoDataRespExchange);
                        Data.InsertUnitInfoData(UnitInfo, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }
                //上传车辆信息
                try
                {
                    List <VehicleData> VehicleInfo = LocalData.GetVehicleData();
                    if (VehicleInfo.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.VehicleDataRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_VehicleDataRespExchange);
                        Data.InsertVehicleData(VehicleInfo, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }
                //上传系统人员信息
                try
                {
                    List <SysUserData> SysUserInfo = LocalData.GetSysUserData();
                    if (SysUserInfo.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.SysUserDataRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_SysUserDataRespExchange);
                        Data.InsertSysUserData(SysUserInfo, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }
                // 上传呼叫记录信息
                try
                {
                    List <CallRcordData> CallRcordDataInfo = LocalData.GetCallRcordData();
                    if (CallRcordDataInfo.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.CallRcordDataRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_CallRcordDataRespExchange);
                        Data.InsertCallRcordData(CallRcordDataInfo, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }
                //上传受理记录信息
                try
                {
                    List <DealData> DealDataInfo = LocalData.GetDealData();
                    if (DealDataInfo.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.DealDataRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_DealDataRespExchange);
                        Data.InsertDealData(DealDataInfo, LocalXZBM);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }
                //上传出车信息
                try
                {
                    List <DispatchVehicleData> DispatchVehicleInfo = LocalData.GetDispatchVehicleData();
                    if (DispatchVehicleInfo.Count > 0)
                    {
                        foreach (DispatchVehicleData item in DispatchVehicleInfo)
                        {
                            IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                            Data.DispatchVehicleDataRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_DispatchVehicleDataRespExchange);
                            Data.InsertDispatchVehicleData(DispatchVehicleInfo, LocalXZBM);
                            Thread.Sleep(Interval);
                        }
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }

                //上传调度分站记录信息
                try
                {
                    List <DispatchStationInfoData> DispatchStationInfo = LocalData.GetDispatchStationInfoData();
                    if (DispatchStationInfo.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.DispatchStationInfoDataRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_DispatchStationInfoDataRespExchange);
                        Data.InsertDispatchStationInfoData(DispatchStationInfo, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }

                //上传病历填写项目数据
                try
                {
                    List <Web_MedicalProject> list = LocalData.GetWeb_MedicalProjectData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.Web_MedicalProjectRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_Web_MedicalProjectRespExchange);
                        Data.InsertWeb_MedicalProject(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }

                //上传病历填写项目值数据
                try
                {
                    List <Web_MedicalProjectValue> list = LocalData.GetWeb_MedicalProjectValueData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.Web_MedicalProjectValueRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_Web_MedicalProjectValueRespExchange);
                        Data.InsertWeb_MedicalProjectValue(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }

                //上传病历记录数据
                try
                {
                    List <Web_MedicalRecords> list = LocalData.GetWeb_MedicalRecordsData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.Web_MedicalRecordsRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_Web_MedicalRecordsRespExchange);
                        Data.InsertWeb_MedicalRecords(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }

                //上传病历填写项目与值对应数据
                try
                {
                    List <Web_MedicalStatistics> list = LocalData.GetWeb_MedicalStatisticsData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.Web_MedicalStatisticsRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_Web_MedicalStatisticsRespExchange);
                        Data.InsertWeb_MedicalStatistics(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }

                // 病历基础信息表数据
                try
                {
                    List <BLJCXXB> list = LocalData.GetBLJCXXBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.BLJCXXBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_BLJCXXBRespExchange);
                        Data.InsertBLJCXXB(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }

                // 呼救区域表数据
                try
                {
                    List <HJQYB> list = LocalData.GetHJQYBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.HJQYBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_HJQYBRespExchange);
                        Data.InsertHJQYB(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }
                /// 来电类型表数据
                try
                {
                    List <LDLXB> list = LocalData.GetLDLXBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.LDLXBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_LDLXBRespExchange);
                        Data.InsertLDLXB(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }
                // 值班员信息表数据
                try
                {
                    List <ZBYXXB> list = LocalData.GetZBYXXBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.ZBYXXBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_ZBYXXBRespExchange);
                        Data.InsertZBYXXB(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }

                // 症状表数据
                try
                {
                    List <ZZB> list = LocalData.GetZZBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.ZZBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_ZZBRespExchange);
                        Data.InsertZZB(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (Exception ex) { LogHelper.WriteLog(ex.Message, ex); }

                //20160105修改人:朱星汉 修改内容:添加病历记录删除表的上传
                // 病历删除记录表数据
                try
                {
                    List <LWBLTBDELB> list = LocalData.GetLWBLTBDELBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.LWBLTBDELBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_LWBLTBDELBRespExchange);
                        Data.DeleteWeb_MedicalRecords(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (System.Exception ex)
                {
                    LogHelper.WriteLog(ex.Message, ex);
                }
                //20151216修改人:朱星汉 修改内容:添加病历关系记录删除表的上传
                // 病历关系删除记录表数据
                try
                {
                    List <LWBLGXTBDELB> list = LocalData.GetLWBLGXTBDELBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.LWBLGXTBDELBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_LWBLGXTBDELBRespExchange);
                        Data.DeleteWeb_MedicalStatistics(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (System.Exception ex)
                {
                    LogHelper.WriteLog(ex.Message, ex);
                }

                // 大型事故表数据
                try
                {
                    List <DXSGB> list = LocalData.GetDXSGBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.DXSGBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_DXSGBRespExchange);
                        Data.InsertDXSGB(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (System.Exception ex)
                {
                    LogHelper.WriteLog(ex.Message, ex);
                }

                //  联网调度关联表数据
                try
                {
                    List <LWDDGLB> list = LocalData.GetLWDDGLBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.LWDDGLBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_LWDDGLBRespExchange);
                        Data.InsertLWDDGLB(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (System.Exception ex)
                {
                    LogHelper.WriteLog(ex.Message, ex);
                }

                // 联网车辆同步对应表数据
                try
                {
                    List <LWCLTBDYB> list = LocalData.GetLWCLTBDYBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.LWCLTBDYBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_LWCLTBDYBRespExchange);
                        Data.InsertLWCLTBDYB(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (System.Exception ex)
                {
                    LogHelper.WriteLog(ex.Message, ex);
                }

                // 联网病历同步对应表数据
                try
                {
                    List <LWBLTBDYB> list = LocalData.GetLWBLTBDYBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.LWBLTBDYBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_LWBLTBDYBRespExchange);
                        Data.InsertLWBLTBDYB(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (System.Exception ex)
                {
                    LogHelper.WriteLog(ex.Message, ex);
                }

                // 联网病历关系同步对应表数据
                try
                {
                    List <LWBLGXTBDYB> list = LocalData.GetLWBLGXTBDYBData();
                    if (list.Count > 0)
                    {
                        IDataExchangeDataAccess Data = DataAccess.DataExchangeDataAccess();
                        Data.LWBLGXTBDYBRespExchange += new EventHandler <DataExchangeRespEventArgs>(Data_LWBLGXTBDYBRespExchange);
                        Data.InsertLWBLGXTBDYB(list, LocalXZBM);
                        Thread.Sleep(Interval);
                    }
                }
                catch (System.Exception ex)
                {
                    LogHelper.WriteLog(ex.Message, ex);
                }

                finally { Thread.Sleep(10000); }
            }
        }