package controllers import ( "Data_Upload_Api/enums" "Data_Upload_Api/models/sz" "Data_Upload_Api/service" "Data_Upload_Api/service/city" "Data_Upload_Api/utils" _ "fmt" "github.com/astaxie/beego" _ "github.com/jinzhu/gorm" _ "math" _ "strconv" _ "strings" _ "time" ) type SyncController struct { BaseAPIController } func SyncAPIRegisterRouters() { beego.Router("/sync/upload/hqyy", &SyncController{}, "get:SyncToHqyy") beego.Router("/sync/upload/lg2h", &SyncController{}, "get:SyncToLg2h") beego.Router("/sync/upload/smzy", &SyncController{}, "get:SyncToSmzy") beego.Router("/sync/upload/szbl", &SyncController{}, "get:SyncToSzbl") beego.Router("/sync/upload/szjk", &SyncController{}, "get:SyncToSzjk") beego.Router("/sync/upload/smzybr", &SyncController{}, "get:SyncToSmzybr") beego.Router("/sync/addpatient", &SyncController{}, "get:AddPatient") beego.Router("/sync/delpatient", &SyncController{}, "get:DelPatient") beego.Router("/sync/upload/szblbr", &SyncController{}, "get:SyncToSzblbr") beego.Router("/sync/upload/szblyyxxzx", &SyncController{}, "get:SyncToSzblYxxxzx") beego.Router("/sync/upload/smzyyyxxzx", &SyncController{}, "get:SyncToSmzyYxxxzx") beego.Router("/sync/upload/szblbeyyxxzx", &SyncController{}, "get:SyncToSzblbeYxxxzx") beego.Router("/sync/upload/szblpgyyxxzx", &SyncController{}, "get:SyncToSzblpgYxxxzx") beego.Router("/sync/upload/wzyy", &SyncController{}, "get:SyncTowzyy") } func (c *SyncController) SyncToSzblbeYxxxzx() { org := &sz.DataUploadConfig{ OrgId: 10278, ProvinceId: 19, CityId: 291, DepartmentName: "深圳市百霖贝尔血液透析中心", HospitalId: "MA5G5BPX7", InstType: 1, DbHost: "127.0.0.1", DbPort: "1433", DbPass: "1Q2W3e4r!@#$", DbUser: "adapter", DbName: "adapter_blbe", } // for _, org := range configs { // 第二步:跟进配置,创建数据库连接 if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) return } // 第三步:开始同步数据 // 机构人员字典表 t_hd_hospital city.SyncTBDICPractitioner(orgDb, org.OrgId, org.HospitalId) // 药品目录字典表 city.SyncTBDICMedicines(orgDb, org.OrgId, org.HospitalId) // 药品对照字典 city.SyncTBDICYpdzzd(orgDb, org.OrgId, org.HospitalId) // 诊疗项目目录字典表 city.SyncTBDICZlxmml(orgDb, org.OrgId, org.HospitalId) // 诊疗项目目录字典表 city.SyncTBDICZlxmdzzd(orgDb, org.OrgId, org.HospitalId) // 机构床位 t_hd_wm city.SyncTMDICTBED(orgDb, org.OrgId, org.HospitalId) // 门诊患者信息表 city.SyncTBMZPatientInformation(orgDb, org.OrgId, org.HospitalId) // 挂号表 city.SyncTBHISMZReg(orgDb, org.OrgId, org.HospitalId) // 门诊就诊记录表 city.SyncTB_YL_MZ_Medical_Record(orgDb, org.OrgId, org.HospitalId) // 门诊处方主表 city.SyncTB_CIS_Prescription(orgDb, org.OrgId, org.HospitalId) // 18. 门诊处方明细表 city.SyncTB_CIS_Prescription_Detail(orgDb, org.OrgId, org.HospitalId) // 19. 门诊收费表 city.SyncTB_HIS_MZ_Charge(orgDb, org.OrgId, org.HospitalId) // 20. 门诊收费明细表 city.SyncTB_HIS_MZ_Fee_Detail(orgDb, org.OrgId, org.HospitalId) // 业务量收入统计表 city.SyncTB_STAT_YWL_Report(orgDb, org.OrgId, org.HospitalId) // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } return } func (c *SyncController) SyncTowzyy() { org := &sz.DataUploadConfig{ OrgId: 10580, ProvinceId: 19, CityId: 291, DepartmentName: "深圳五洲中医院", HospitalId: "783910835", InstType: 2, DbHost: "172.8.110.22", DbPort: "1433", DbPass: "12361myd!@#", DbUser: "sa", DbName: "adapter_2019", } if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException) return } // 第三步:开始同步数据 // 同步医院信息 t_hd_hospital // city.SyncHospital(orgDb, org.OrgId, org.HospitalId, org.InstType, org.DepartmentName) // // 同步员工 t_hd_staff city.SyncStaff(orgDb, org.OrgId, org.HospitalId) // 布局表(T_HD_LAYOUT) city.SyncLayout(orgDb, org.OrgId, org.HospitalId) // 同步设备 t_hd_dm city.SyncDM(orgDb, org.OrgId, org.HospitalId) // 同步水处理器 t_hd_wm city.SyncWMS(orgDb, org.OrgId, org.HospitalId) // 同步维修 t_hd_maintain city.SyncMachineRepair(orgDb, org.OrgId, org.HospitalId) // 同步设备消毒方法表(T_HD_DISINFECT_METHOD city.SyncDisinfectMethod(orgDb, org.OrgId, org.HospitalId) // 同步其它设备信息表(T_HD_OTHER_MACHINE) city.SyncOtherMachine(orgDb, org.OrgId, org.HospitalId) // 同步透析机消毒检测记录表(T_HD_DM_DISINFECT) city.SyncDmDisinfect(orgDb, org.OrgId, org.HospitalId) // 透析机透析液细菌培养检测记录表(t_hd_dm_dialysate_bc) city.SyncLisCulture(orgDb, org.OrgId, org.HospitalId) // 透析机透析液内毒素检测记录表(T_HD_DM_DIALYSATE_EN) city.SyncDialysate(orgDb, org.OrgId, org.HospitalId) // 水处理机消毒记录表(T_HD_WM_DISINFECT) city.SyncWmDisinfect(orgDb, org.OrgId, org.HospitalId) //透析用水PH值检测表(T_HD_WATER_PH) city.SynLisWaterPh(orgDb, org.OrgId, org.HospitalId) //透析用水细菌培养检测表(T_HD_WATER_BC) city.SyncLisWaterBc(orgDb, org.OrgId, org.HospitalId) //透析用水内毒素检测表(T_HD_WATER_EN) city.SyncLisWaterEn(orgDb, org.OrgId, org.HospitalId) //透析用水有毒化学物检测表(T_HD_WATER_NC) city.SynLisWaterNc(orgDb, org.OrgId, org.HospitalId) //透析用水水硬度检测表(T_HD_WATER_WH) city.SynListHadWater(orgDb, org.OrgId, org.HospitalId) //透析用水游离氯检测表(T_HD_WATER_FC) city.SyncLisWaterFc(orgDb, org.OrgId, org.HospitalId) //透析用水电解质检测表(T_HD_WATER_EL) city.SyncLisWaterEl(orgDb, org.OrgId, org.HospitalId) //透析用水微量元素检测表(T_HD_WATER_TE) city.SyncLisWaterTe(orgDb, org.OrgId, org.HospitalId) //透析室空气消毒记录表(T_HD_AIR_DISINFECT) city.SyncLisAirDetection(orgDb, org.OrgId, org.HospitalId) //物表消毒记录表(T_HD_SURFACE_DISINFECT) city.SyncLisBodyDetection(orgDb, org.OrgId, org.HospitalId) //同步血透患者基本信息表(T_HD_PATIENT) city.SyncPatient(orgDb, org.OrgId, org.HospitalId) // 同步患者退出信息表(T_HD_PATIENT_QUIT) city.SyncPatientOut(orgDb, org.OrgId, org.HospitalId) // 同步处方 t_hd_ps city.SyncPs(orgDb, org.OrgId, org.HospitalId) // 同步处方药品 t_hd_ps city.SyncPsMedicine(orgDb, org.OrgId, org.HospitalId) // 患者诊断信息表(T_HD_DIAGNOSIS) city.SyncDiagnosis(orgDb, org.OrgId, org.HospitalId) // 患者通路信息表(T_HD_ACCESS) city.SyncAccess(orgDb, org.OrgId, org.HospitalId) //导管感染记录表(T_HD_CI) city.SynListHdCi(orgDb, org.OrgId, org.HospitalId) //导管感染转归记录表(T_HD_CI_OUTCOME) city.SynLisHdCiOutCome(orgDb, org.OrgId, org.HospitalId) // // city.UpdatePatient(orgDb, org.OrgId, org.HospitalId) // 患者传染病检查记录表(T_HD_INFECTION city.SyncInfection(orgDb, org.OrgId, org.HospitalId) // 同步排班 t_hd_shift city.SyncShift(orgDb, org.OrgId, org.HospitalId) // 同步透析医嘱表(T_HD_DOCTORS_ADVICE) city.SyncDoctorAdvice(orgDb, org.OrgId, org.HospitalId) // 同步患者透析记录 t_hd_dialysis city.SyncDialysis(orgDb, org.OrgId, org.HospitalId) //city.SyncLisIndicatorsBc(orgDb, org.OrgId, org.HospitalId) //city.SyncLisIndicatorsBcUpdate(orgDb, org.OrgId, org.HospitalId) //city.SyncLisReportBc(orgDb, org.OrgId, org.HospitalId) // 同步透中信息 t_hd_middle city.SyncMiddle(orgDb, org.OrgId, org.HospitalId) // 透析并发症记录表(T_HD_COMPLICATION) city.SyncComplication(orgDb, org.OrgId, org.HospitalId) // 透析床位表(T_HD_SICKBED) city.SyncSickbed(orgDb, org.OrgId, org.HospitalId) // 同步透析床位分区 t_hd_division city.SyncDivision(orgDb, org.OrgId, org.HospitalId) // 血透患者检测结果表(T_HD_LIS_REPORT) city.SyncLisReport(orgDb, org.OrgId, org.HospitalId) //血透患者检验结果指标表(T_HD_LIS_INDICATORS) city.SyncLisIndicators(orgDb, org.OrgId, org.HospitalId) // // 第四步:关闭数据库连接 // // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } c.ServeSuccessJSON(map[string]interface{}{ "resultList": "12345", }) return } func (c *SyncController) SyncToSzblpgYxxxzx() { org := &sz.DataUploadConfig{ OrgId: 10888, ProvinceId: 19, CityId: 291, DepartmentName: "深圳市百霖鹏港血液透析中心", HospitalId: "MACWP1CB", InstType: 1, DbHost: "127.0.0.1", DbPort: "1433", DbPass: "1Q2W3e4r!@#$", DbUser: "adapter", DbName: "adapter_blpg", } // for _, org := range configs { // 第二步:跟进配置,创建数据库连接 if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) return } // 第三步:开始同步数据 // 机构人员字典表 t_hd_hospital //city.SyncTBDICPractitioner_pg(orgDb, org.OrgId, org.HospitalId) //// 药品目录字典表 //city.SyncTBDICMedicines_pg(orgDb, org.OrgId, org.HospitalId) //// 药品对照字典 //city.SyncTBDICYpdzzd_pg(orgDb, org.OrgId, org.HospitalId) //// 诊疗项目目录字典表 //city.SyncTBDICZlxmml_pg(orgDb, org.OrgId, org.HospitalId) //// 诊疗项目目录字典表 //city.SyncTBDICZlxmdzzd_pg(orgDb, org.OrgId, org.HospitalId) //// 机构床位 t_hd_wm //city.SyncTMDICTBED_pg(orgDb, org.OrgId, org.HospitalId) //// 门诊患者信息表 //city.SyncTBMZPatientInformation_pg(orgDb, org.OrgId, org.HospitalId) ////// 挂号表 //city.SyncTBHISMZReg_pg(orgDb, org.OrgId, org.HospitalId) // 门诊就诊记录表 city.SyncTB_YL_MZ_Medical_Record_pg(orgDb, org.OrgId, org.HospitalId) // 门诊处方主表 //city.SyncTB_CIS_Prescription_pg(orgDb, org.OrgId, org.HospitalId) ////// 18. 门诊处方明细表 //city.SyncTB_CIS_Prescription_Detail_pg(orgDb, org.OrgId, org.HospitalId) ////// 19. 门诊收费表 //city.SyncTB_HIS_MZ_Charge_pg(orgDb, org.OrgId, org.HospitalId) ////// 20. 门诊收费明细表 //city.SyncTB_HIS_MZ_Fee_Detail_pg(orgDb, org.OrgId, org.HospitalId) ////// 业务量收入统计表 //city.SyncTB_STAT_YWL_Report_pg(orgDb, org.OrgId, org.HospitalId) ////city.SyncDM(orgDb, org.OrgId, org.HospitalId) //city.SyncTB_Diagnosis_Detail_pg(orgDb, org.OrgId, org.HospitalId) // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } return } func (c *SyncController) SyncToSzblYxxxzx() { org := &sz.DataUploadConfig{ OrgId: 10138, ProvinceId: 19, CityId: 291, DepartmentName: "深圳市百霖血液透析中心", HospitalId: "MA5DB4KB6", InstType: 1, DbHost: "127.0.0.1", DbPort: "1433", DbPass: "1Q2W3e4r!@#$", DbUser: "adapter", DbName: "adapter_2019", } // for _, org := range configs { // 第二步:跟进配置,创建数据库连接 if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) return } // 第三步:开始同步数据 // 机构人员字典表 t_hd_hospital city.SyncTBDICPractitioner(orgDb, org.OrgId, org.HospitalId) // 药品目录字典表 city.SyncTBDICMedicines(orgDb, org.OrgId, org.HospitalId) // 药品对照字典 city.SyncTBDICYpdzzd(orgDb, org.OrgId, org.HospitalId) // 诊疗项目目录字典表 city.SyncTBDICZlxmml(orgDb, org.OrgId, org.HospitalId) // 诊疗项目目录字典表 city.SyncTBDICZlxmdzzd(orgDb, org.OrgId, org.HospitalId) // 机构床位 t_hd_wm city.SyncTMDICTBED(orgDb, org.OrgId, org.HospitalId) // 门诊患者信息表 city.SyncTBMZPatientInformation(orgDb, org.OrgId, org.HospitalId) // 挂号表 city.SyncTBHISMZReg(orgDb, org.OrgId, org.HospitalId) // 门诊就诊记录表 city.SyncTB_YL_MZ_Medical_Record(orgDb, org.OrgId, org.HospitalId) // 门诊处方主表 city.SyncTB_CIS_Prescription(orgDb, org.OrgId, org.HospitalId) // 18. 门诊处方明细表 city.SyncTB_CIS_Prescription_Detail(orgDb, org.OrgId, org.HospitalId) // 19. 门诊收费表 city.SyncTB_HIS_MZ_Charge(orgDb, org.OrgId, org.HospitalId) // 20. 门诊收费明细表 city.SyncTB_HIS_MZ_Fee_Detail(orgDb, org.OrgId, org.HospitalId) // 业务量收入统计表 city.SyncTB_STAT_YWL_Report(orgDb, org.OrgId, org.HospitalId) // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } return } func (c *SyncController) DelPatient() { org := &sz.DataUploadConfig{ OrgId: 10138, ProvinceId: 19, CityId: 291, DepartmentName: "深圳市百霖血液透析中心", HospitalId: "MA5DB4KB6", InstType: 1, DbHost: "127.0.0.1", DbPort: "1433", DbPass: "1Q2W3e4r!@#$", DbUser: "adapter", DbName: "adapter_2019", } if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException) return } patient_id, _ := c.GetInt64("patient_id") city.SyncPatientOutByID(orgDb, org.OrgId, org.HospitalId, patient_id) } c.ServeSuccessJSON(map[string]interface{}{ "resultList": "12345", }) return } func (c *SyncController) AddPatient() { org := &sz.DataUploadConfig{ OrgId: 10278, ProvinceId: 19, CityId: 291, DepartmentName: "深圳市百霖血液透析中心", HospitalId: "MA5G5BPX7", InstType: 1, DbHost: "127.0.0.1", DbPort: "1433", DbPass: "1Q2W3e4r!@#$", DbUser: "adapter", DbName: "adapter_blbe", } if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException) return } patient_id, _ := c.GetInt64("patient_id") city.SyncPatientByID(orgDb, org.OrgId, org.HospitalId, patient_id) } c.ServeSuccessJSON(map[string]interface{}{ "resultList": "12345", }) return } func (c *SyncController) SyncToSzbl() { org := &sz.DataUploadConfig{ OrgId: 10138, ProvinceId: 19, CityId: 291, DepartmentName: "深圳市百霖血液透析中心", HospitalId: "MA5DB4KB6", InstType: 1, DbHost: "127.0.0.1", DbPort: "1433", DbPass: "1Q2W3e4r!@#$", DbUser: "adapter", DbName: "adapter_2019", } if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException) return } // 第三步:开始同步数据 // 同步医院信息 t_hd_hospital // city.SyncHospital(orgDb, org.OrgId, org.HospitalId, org.InstType, org.DepartmentName) // // 同步员工 t_hd_staff // city.SyncStaff(orgDb, org.OrgId, org.HospitalId) // // 布局表(T_HD_LAYOUT) // city.SyncLayout(orgDb, org.OrgId, org.HospitalId) // // 同步设备 t_hd_dm // city.SyncDM(orgDb, org.OrgId, org.HospitalId) // // 同步水处理器 t_hd_wm // city.SyncWMS(orgDb, org.OrgId, org.HospitalId) // // 同步维修 t_hd_maintain // city.SyncMachineRepair(orgDb, org.OrgId, org.HospitalId) // // 同步设备消毒方法表(T_HD_DISINFECT_METHOD // city.SyncDisinfectMethod(orgDb, org.OrgId, org.HospitalId) // // 同步其它设备信息表(T_HD_OTHER_MACHINE) // city.SyncOtherMachine(orgDb, org.OrgId, org.HospitalId) // // 同步透析机消毒检测记录表(T_HD_DM_DISINFECT) // city.SyncDmDisinfect(orgDb, org.OrgId, org.HospitalId) // // 透析机透析液细菌培养检测记录表(t_hd_dm_dialysate_bc) // city.SyncLisCulture(orgDb,org.OrgId,org.HospitalId) // // 透析机透析液内毒素检测记录表(T_HD_DM_DIALYSATE_EN) // city.SyncDialysate(orgDb,org.OrgId,org.HospitalId) // // 水处理机消毒记录表(T_HD_WM_DISINFECT) // city.SyncWmDisinfect(orgDb,org.OrgId,org.HospitalId) // //透析用水PH值检测表(T_HD_WATER_PH) // city.SynLisWaterPh(orgDb,org.OrgId,org.HospitalId) // //透析用水细菌培养检测表(T_HD_WATER_BC) // city.SyncLisWaterBc(orgDb,org.OrgId,org.HospitalId) // //透析用水内毒素检测表(T_HD_WATER_EN) // city.SyncLisWaterEn(orgDb,org.OrgId,org.HospitalId) // //透析用水有毒化学物检测表(T_HD_WATER_NC) // city.SynLisWaterNc(orgDb,org.OrgId,org.HospitalId) // //透析用水水硬度检测表(T_HD_WATER_WH) // city.SynListHadWater(orgDb,org.OrgId,org.HospitalId) // //透析用水游离氯检测表(T_HD_WATER_FC) // city.SyncLisWaterFc(orgDb,org.OrgId,org.HospitalId) // //透析用水电解质检测表(T_HD_WATER_EL) // city.SyncLisWaterEl(orgDb,org.OrgId,org.HospitalId) // //透析用水微量元素检测表(T_HD_WATER_TE) // city.SyncLisWaterTe(orgDb,org.OrgId,org.HospitalId) // //透析室空气消毒记录表(T_HD_AIR_DISINFECT) // city.SyncLisAirDetection(orgDb,org.OrgId,org.HospitalId) // //物表消毒记录表(T_HD_SURFACE_DISINFECT) // city.SyncLisBodyDetection(orgDb,org.OrgId,org.HospitalId) // 同步血透患者基本信息表(T_HD_PATIENT) // city.SyncPatient(orgDb, org.OrgId, org.HospitalId) // // 同步患者退出信息表(T_HD_PATIENT_QUIT) city.SyncPatientOut(orgDb, org.OrgId, org.HospitalId) // // 同步处方 t_hd_ps // city.SyncPs(orgDb, org.OrgId, org.HospitalId) // // 同步处方药品 t_hd_ps // city.SyncPsMedicine(orgDb, org.OrgId, org.HospitalId) // // 患者诊断信息表(T_HD_DIAGNOSIS) // city.SyncDiagnosis(orgDb, org.OrgId, org.HospitalId) // // 患者通路信息表(T_HD_ACCESS) // city.SyncAccess(orgDb, org.OrgId, org.HospitalId) // //导管感染记录表(T_HD_CI) // city.SynListHdCi(orgDb,org.OrgId,org.HospitalId) // //导管感染转归记录表(T_HD_CI_OUTCOME) // city.SynLisHdCiOutCome(orgDb,org.OrgId,org.HospitalId) // // // city.UpdatePatient(orgDb, org.OrgId, org.HospitalId) // // 患者传染病检查记录表(T_HD_INFECTION city.SyncInfection(orgDb, org.OrgId, org.HospitalId) // // 同步排班 t_hd_shift // city.SyncShift(orgDb, org.OrgId, org.HospitalId) // // 同步透析医嘱表(T_HD_DOCTORS_ADVICE) // city.SyncDoctorAdvice(orgDb, org.OrgId, org.HospitalId) // // 同步患者透析记录 t_hd_dialysis city.SyncDialysis(orgDb, org.OrgId, org.HospitalId) //city.SyncLisIndicatorsBc(orgDb, org.OrgId, org.HospitalId) //city.SyncLisIndicatorsBcUpdate(orgDb, org.OrgId, org.HospitalId) //city.SyncLisReportBc(orgDb, org.OrgId, org.HospitalId) // // 同步透中信息 t_hd_middle // city.SyncMiddle(orgDb, org.OrgId, org.HospitalId) // // 透析并发症记录表(T_HD_COMPLICATION) // city.SyncComplication(orgDb, org.OrgId, org.HospitalId) // // 透析床位表(T_HD_SICKBED) // city.SyncSickbed(orgDb, org.OrgId, org.HospitalId) // // 同步透析床位分区 t_hd_division // city.SyncDivision(orgDb, org.OrgId, org.HospitalId) //// 血透患者检测结果表(T_HD_LIS_REPORT) city.SyncLisReport(orgDb, org.OrgId, org.HospitalId) //血透患者检验结果指标表(T_HD_LIS_INDICATORS) city.SyncLisIndicators(orgDb, org.OrgId, org.HospitalId) // // 第四步:关闭数据库连接 // // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } c.ServeSuccessJSON(map[string]interface{}{ "resultList": "12345", }) return } func (c *SyncController) SyncToSzblbr() { org := &sz.DataUploadConfig{ OrgId: 10278, ProvinceId: 19, CityId: 291, DepartmentName: "深圳市百霖贝尔血液透析中心", HospitalId: "MA5G5BPX7", InstType: 1, DbHost: "127.0.0.1", DbPort: "1433", DbPass: "1Q2W3e4r!@#$", DbUser: "adapter", DbName: "adapter_blbe", } // for _, org := range configs { // 第二步:跟进配置,创建数据库连接 if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException) return } // 第三步:开始同步数据 // 同步医院信息 t_hd_hospital // city.SyncHospital(orgDb, org.OrgId, org.HospitalId, org.InstType, org.DepartmentName) // // 同步员工 t_hd_staff // city.SyncStaff(orgDb, org.OrgId, org.HospitalId) // // 布局表(T_HD_LAYOUT) // city.SyncLayout(orgDb, org.OrgId, org.HospitalId) // // 同步设备 t_hd_dm // city.SyncDM(orgDb, org.OrgId, org.HospitalId) // // 同步水处理器 t_hd_wm // city.SyncWMS(orgDb, org.OrgId, org.HospitalId) // // 同步维修 t_hd_maintain // city.SyncMachineRepair(orgDb, org.OrgId, org.HospitalId) // // 同步设备消毒方法表(T_HD_DISINFECT_METHOD // city.SyncDisinfectMethod(orgDb, org.OrgId, org.HospitalId) // // 同步其它设备信息表(T_HD_OTHER_MACHINE) // city.SyncOtherMachine(orgDb, org.OrgId, org.HospitalId) // // 同步透析机消毒检测记录表(T_HD_DM_DISINFECT) // city.SyncDmDisinfect(orgDb, org.OrgId, org.HospitalId) // // 透析机透析液细菌培养检测记录表(t_hd_dm_dialysate_bc) // city.SyncLisCulture(orgDb,org.OrgId,org.HospitalId) // // 透析机透析液内毒素检测记录表(T_HD_DM_DIALYSATE_EN) // city.SyncDialysate(orgDb,org.OrgId,org.HospitalId) // // 水处理机消毒记录表(T_HD_WM_DISINFECT) // city.SyncWmDisinfect(orgDb,org.OrgId,org.HospitalId) // //透析用水PH值检测表(T_HD_WATER_PH) // city.SynLisWaterPh(orgDb,org.OrgId,org.HospitalId) // //透析用水细菌培养检测表(T_HD_WATER_BC) // city.SyncLisWaterBc(orgDb,org.OrgId,org.HospitalId) // //透析用水内毒素检测表(T_HD_WATER_EN) // city.SyncLisWaterEn(orgDb,org.OrgId,org.HospitalId) // //透析用水有毒化学物检测表(T_HD_WATER_NC) // city.SynLisWaterNc(orgDb,org.OrgId,org.HospitalId) // //透析用水水硬度检测表(T_HD_WATER_WH) // city.SynListHadWater(orgDb,org.OrgId,org.HospitalId) // //透析用水游离氯检测表(T_HD_WATER_FC) // city.SyncLisWaterFc(orgDb,org.OrgId,org.HospitalId) // //透析用水电解质检测表(T_HD_WATER_EL) // city.SyncLisWaterEl(orgDb,org.OrgId,org.HospitalId) // //透析用水微量元素检测表(T_HD_WATER_TE) // city.SyncLisWaterTe(orgDb,org.OrgId,org.HospitalId) // //透析室空气消毒记录表(T_HD_AIR_DISINFECT) // city.SyncLisAirDetection(orgDb,org.OrgId,org.HospitalId) // //物表消毒记录表(T_HD_SURFACE_DISINFECT) // city.SyncLisBodyDetection(orgDb,org.OrgId,org.HospitalId) // 同步血透患者基本信息表(T_HD_PATIENT) // city.SyncPatient(orgDb, org.OrgId, org.HospitalId) // // 同步患者退出信息表(T_HD_PATIENT_QUIT) city.SyncPatientOut(orgDb, org.OrgId, org.HospitalId) // // 同步处方 t_hd_ps // city.SyncPs(orgDb, org.OrgId, org.HospitalId) // // 同步处方药品 t_hd_ps // city.SyncPsMedicine(orgDb, org.OrgId, org.HospitalId) // // 患者诊断信息表(T_HD_DIAGNOSIS) // city.SyncDiagnosis(orgDb, org.OrgId, org.HospitalId) // // 患者通路信息表(T_HD_ACCESS) // city.SyncAccess(orgDb, org.OrgId, org.HospitalId) // //导管感染记录表(T_HD_CI) // city.SynListHdCi(orgDb,org.OrgId,org.HospitalId) // //导管感染转归记录表(T_HD_CI_OUTCOME) // city.SynLisHdCiOutCome(orgDb,org.OrgId,org.HospitalId) // // // city.UpdatePatient(orgDb, org.OrgId, org.HospitalId) // // 患者传染病检查记录表(T_HD_INFECTION city.SyncInfection(orgDb, org.OrgId, org.HospitalId) // // 同步排班 t_hd_shift //city.SyncShift(orgDb, org.OrgId, org.HospitalId) //// // 同步透析医嘱表(T_HD_DOCTORS_ADVICE) //city.SyncDoctorAdvice(orgDb, org.OrgId, org.HospitalId) //// // 同步患者透析记录 t_hd_dialysis city.SyncDialysis(orgDb, org.OrgId, org.HospitalId) //// // 同步透中信息 t_hd_middle //city.SyncMiddle(orgDb, org.OrgId, org.HospitalId) //// // 透析并发症记录表(T_HD_COMPLICATION) //city.SyncComplication(orgDb, org.OrgId, org.HospitalId) // // 透析床位表(T_HD_SICKBED) // city.SyncSickbed(orgDb, org.OrgId, org.HospitalId) // // 同步透析床位分区 t_hd_division // city.SyncDivision(orgDb, org.OrgId, org.HospitalId) // 血透患者检测结果表(T_HD_LIS_REPORT) city.SyncLisReport(orgDb, org.OrgId, org.HospitalId) //// 血透患者检验结果指标表(T_HD_LIS_INDICATORS) city.SyncLisIndicators(orgDb, org.OrgId, org.HospitalId) //city.SyncLisIndicatorsBc(orgDb, org.OrgId, org.HospitalId) //city.SyncLisReportBc(orgDb, org.OrgId, org.HospitalId) //city.SyncLisIndicatorsBcUpdate(orgDb, org.OrgId, org.HospitalId) // // 第四步:关闭数据库连接 // // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } c.ServeSuccessJSON(map[string]interface{}{ "resultList": "12345", }) return } func (c *SyncController) SyncToLg2h() { // 第一步:到上报配置表中找到深圳需要上报的机构 // sz_province, _ := beego.AppConfig.Int64("sz_province") // sz_city, _ := beego.AppConfig.Int64("sz_city") // configs, _ := service.FindAllDataUploadConfigOrgInfo(sz_province, sz_city, 3) org := &sz.DataUploadConfig{ OrgId: 9598, ProvinceId: 19, CityId: 291, DepartmentName: "深圳市龙岗区第二人民医院", HospitalId: "455835506", InstType: 1, DbHost: "183.62.158.36", DbPort: "61433", DbPass: "LG2H+9897", DbUser: "sa", DbName: "adapter_2019", } // for _, org := range configs { // 第二步:跟进配置,创建数据库连接 if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException) return } // 第三步:开始同步数据 // 同步医院信息 t_hd_hospital //city.SyncHospital(orgDb, org.OrgId, org.HospitalId, org.InstType, org.DepartmentName) //// 同步员工 t_hd_staff //city.SyncStaff(orgDb, org.OrgId, org.HospitalId) //// 布局表(T_HD_LAYOUT) //city.SyncLayout(orgDb, org.OrgId, org.HospitalId) //// 同步设备 t_hd_dm //city.SyncDM(orgDb, org.OrgId, org.HospitalId) //// 同步水处理器 t_hd_wm //city.SyncWMS(orgDb, org.OrgId, org.HospitalId) //// 同步维修 t_hd_maintain //city.SyncMachineRepair(orgDb, org.OrgId, org.HospitalId) //// 同步设备消毒方法表(T_HD_DISINFECT_METHOD //city.SyncDisinfectMethod(orgDb, org.OrgId, org.HospitalId) //// 同步其它设备信息表(T_HD_OTHER_MACHINE) //city.SyncOtherMachine(orgDb, org.OrgId, org.HospitalId) //// 同步透析机消毒检测记录表(T_HD_DM_DISINFECT) //city.SyncDmDisinfect(orgDb, org.OrgId, org.HospitalId) //// 透析机透析液细菌培养检测记录表(t_hd_dm_dialysate_bc) //city.SyncLisCulture(orgDb,org.OrgId,org.HospitalId) //// 透析机透析液内毒素检测记录表(T_HD_DM_DIALYSATE_EN) //city.SyncDialysate(orgDb,org.OrgId,org.HospitalId) //// 水处理机消毒记录表(T_HD_WM_DISINFECT) //city.SyncWmDisinfect(orgDb,org.OrgId,org.HospitalId) ////透析用水PH值检测表(T_HD_WATER_PH) //city.SynLisWaterPh(orgDb,org.OrgId,org.HospitalId) ////透析用水细菌培养检测表(T_HD_WATER_BC) //city.SyncLisWaterBc(orgDb, org.OrgId, org.HospitalId) ////透析用水内毒素检测表(T_HD_WATER_EN) //city.SyncLisWaterEn(orgDb,org.OrgId,org.HospitalId) ////透析用水有毒化学物检测表(T_HD_WATER_NC) //city.SynLisWaterNc(orgDb,org.OrgId,org.HospitalId) ////透析用水水硬度检测表(T_HD_WATER_WH) //city.SynListHadWater(orgDb,org.OrgId,org.HospitalId) ////透析用水游离氯检测表(T_HD_WATER_FC) //city.SyncLisWaterFc(orgDb,org.OrgId,org.HospitalId) ////透析用水电解质检测表(T_HD_WATER_EL) //city.SyncLisWaterEl(orgDb,org.OrgId,org.HospitalId) ////透析用水微量元素检测表(T_HD_WATER_TE) //city.SyncLisWaterTe(orgDb,org.OrgId,org.HospitalId) ////透析室空气消毒记录表(T_HD_AIR_DISINFECT) //city.SyncLisAirDetection(orgDb,org.OrgId,org.HospitalId) ////物表消毒记录表(T_HD_SURFACE_DISINFECT) //city.SyncLisBodyDetection(orgDb,org.OrgId,org.HospitalId) //// 同步血透患者基本信息表(T_HD_PATIENT) //city.SyncPatient(orgDb, org.OrgId, org.HospitalId) //// 同步患者退出信息表(T_HD_PATIENT_QUIT) //city.SyncPatientOut(orgDb, org.OrgId, org.HospitalId) //// 同步处方 t_hd_ps //city.SyncPs(orgDb, org.OrgId, org.HospitalId) //// 同步处方药品 t_hd_ps //city.SyncPsMedicine(orgDb, org.OrgId, org.HospitalId) //// 患者诊断信息表(T_HD_DIAGNOSIS) //city.SyncDiagnosis(orgDb, org.OrgId, org.HospitalId) //// 患者通路信息表(T_HD_ACCESS) //city.SyncAccess(orgDb, org.OrgId, org.HospitalId) ////导管感染记录表(T_HD_CI) //city.SynListHdCi(orgDb,org.OrgId,org.HospitalId) ////导管感染转归记录表(T_HD_CI_OUTCOME) //city.SynLisHdCiOutCome(orgDb,org.OrgId,org.HospitalId) //// // city.UpdatePatient(orgDb, org.OrgId, org.HospitalId) //// 患者传染病检查记录表(T_HD_INFECTION city.SyncInfection(orgDb, org.OrgId, org.HospitalId) //// 同步排班 t_hd_shift //city.SyncShift(orgDb, org.OrgId, org.HospitalId) //// 同步透析医嘱表(T_HD_DOCTORS_ADVICE) //city.SyncDoctorAdvice(orgDb, org.OrgId, org.HospitalId) //// 同步患者透析记录 t_hd_dialysis //city.SyncDialysis(orgDb, org.OrgId, org.HospitalId) //// 同步透中信息 t_hd_middle //city.SyncMiddle(orgDb, org.OrgId, org.HospitalId) //// 透析并发症记录表(T_HD_COMPLICATION) //city.SyncComplication(orgDb, org.OrgId, org.HospitalId) //// 透析床位表(T_HD_SICKBED) //city.SyncSickbed(orgDb, org.OrgId, org.HospitalId) //// 同步透析床位分区 t_hd_division //city.SyncDivision(orgDb, org.OrgId, org.HospitalId) // 血透患者检测结果表(T_HD_LIS_REPORT) city.SyncLisReport(orgDb, org.OrgId, org.HospitalId) // 血透患者检验结果指标表(T_HD_LIS_INDICATORS) city.SyncLisIndicators(orgDb, org.OrgId, org.HospitalId) // 第四步:关闭数据库连接 // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } c.ServeSuccessJSON(map[string]interface{}{ "resultList": "12345", }) return } func (c *SyncController) SyncToHqyy() { // 第一步:到上报配置表中找到深圳需要上报的机构 // sz_province, _ := beego.AppConfig.Int64("sz_province") // sz_city, _ := beego.AppConfig.Int64("sz_city") // configs, _ := service.FindAllDataUploadConfigOrgInfo(sz_province, sz_city, 3) org := &sz.DataUploadConfig{ OrgId: 9442, ProvinceId: 19, CityId: 291, DepartmentName: "暨南大学附属深圳华侨医院", HospitalId: "73307826X", InstType: 1, DbHost: "183.11.232.26", DbPort: "3306", DbPass: "1Q2W3e4r!@#$", DbUser: "sa", DbName: "xtzk", } // for _, org := range configs { // 第二步:跟进配置,创建数据库连接 if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException) return } // 第三步:开始同步数据 // 同步医院信息 t_hd_hospital city.SyncHospital(orgDb, org.OrgId, org.HospitalId, org.InstType, org.DepartmentName) // 同步水处理器 t_hd_wm city.SyncWMS(orgDb, org.OrgId, org.HospitalId) // // 同步员工 t_hd_staff city.SyncStaff(orgDb, org.OrgId, org.HospitalId) // // 同步病人 t_hd_patient city.SyncPatient(orgDb, org.OrgId, org.HospitalId) // // 同步排班 t_hd_shift city.SyncShift(orgDb, org.OrgId, org.HospitalId) // 同步处方 t_hd_ps city.SyncPs(orgDb, org.OrgId, org.HospitalId) // 同步处方药品 t_hd_ps city.SyncPsMedicine(orgDb, org.OrgId, org.HospitalId) // // 同步转院信息 t_hd_patient_out city.SyncPatientOut(orgDb, org.OrgId, org.HospitalId) // 同步处方信息 t_hd_doctors_advice city.SyncDoctorAdvice(orgDb, org.OrgId, org.HospitalId) // 同步透中信息 t_hd_middle city.SyncMiddle(orgDb, org.OrgId, org.HospitalId) // // 同步设备 t_hd_other_machine city.SyncOtherMachine(orgDb, org.OrgId, org.HospitalId) // // 同步维修 t_hd_maintain city.SyncMachineRepair(orgDb, org.OrgId, org.HospitalId) // // 同步设备 t_hd_dm city.SyncDM(orgDb, org.OrgId, org.HospitalId) // // 同步患者透析记录 t_hd_dialysis city.SyncDialysis(orgDb, org.OrgId, org.HospitalId) // 同步透析床位分区 t_hd_division city.SyncDivision(orgDb, org.OrgId, org.HospitalId) // 患者通路信息表(T_HD_ACCESS) city.SyncAccess(orgDb, org.OrgId, org.HospitalId) // 透析床位表(T_HD_SICKBED) city.SyncSickbed(orgDb, org.OrgId, org.HospitalId) // 患者诊断信息表(T_HD_DIAGNOSIS) city.SyncDiagnosis(orgDb, org.OrgId, org.HospitalId) // 患者传染病检查记录表(T_HD_INFECTION city.SyncInfection(orgDb, org.OrgId, org.HospitalId) // 透析并发症记录表(T_HD_COMPLICATION) city.SyncComplication(orgDb, org.OrgId, org.HospitalId) // 血透患者检测结果表(T_HD_LIS_REPORT) city.SyncLisReport(orgDb, org.OrgId, org.HospitalId) // 血透患者检验结果指标表(T_HD_LIS_INDICATORS) city.SyncLisIndicators(orgDb, org.OrgId, org.HospitalId) // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } c.ServeSuccessJSON(map[string]interface{}{ "resultList": "12345", }) return } func (c *SyncController) SyncToSmzybr() { org := &sz.DataUploadConfig{ OrgId: 9504, ProvinceId: 19, CityId: 291, DepartmentName: "深圳生命之源血液透析中心", HospitalId: "MA5EU4PC0", InstType: 1, DbHost: "127.0.0.1", DbPort: "1433", DbPass: "1Q2W3e4r!@#$", DbUser: "sa", DbName: "adapter_2019", } // for _, org := range configs { // 第二步:跟进配置,创建数据库连接 if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException) return } // 第三步:开始同步数据 // 机构人员字典表 t_hd_hospital // city.SyncTBDICPractitioner(orgDb, org.OrgId, org.HospitalId) // 药品目录字典表 city.SyncTBDICMedicines(orgDb, org.OrgId, org.HospitalId) // 药品对照字典 // city.SyncTBDICYpdzzd(orgDb, org.OrgId, org.HospitalId) // 诊疗项目目录字典表 // city.SyncTBDICZlxmml(orgDb, org.OrgId, org.HospitalId) // // 诊疗项目目录字典表 // city.SyncTBDICZlxmdzzd(orgDb, org.OrgId, org.HospitalId) // // 机构床位 t_hd_wm // city.SyncTMDICTBED(orgDb, org.OrgId, org.HospitalId) // // 门诊患者信息表 // city.SyncTBMZPatientInformation(orgDb, org.OrgId, org.HospitalId) // // 挂号表 // city.SyncTBHISMZReg(orgDb, org.OrgId, org.HospitalId) // // 门诊就诊记录表 // city.SyncTB_YL_MZ_Medical_Record(orgDb, org.OrgId, org.HospitalId) // // 门诊处方主表 // city.SyncTB_CIS_Prescription(orgDb, org.OrgId, org.HospitalId) // // 18. 门诊处方明细表 // city.SyncTB_CIS_Prescription_Detail(orgDb, org.OrgId, org.HospitalId) // // 19. 门诊收费表 // city.SyncTB_HIS_MZ_Charge(orgDb, org.OrgId, org.HospitalId) // // 20. 门诊收费明细表 // city.SyncTB_HIS_MZ_Fee_Detail(orgDb, org.OrgId, org.HospitalId) // // 业务量收入统计表 // city.SyncTB_STAT_YWL_Report(orgDb, org.OrgId, org.HospitalId) // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } c.ServeSuccessJSON(map[string]interface{}{ "resultList": "12345", }) return } func (c *SyncController) SyncToSmzy() { // 第一步:到上报配置表中找到深圳需要上报的机构 // sz_province, _ := beego.AppConfig.Int64("sz_province") // sz_city, _ := beego.AppConfig.Int64("sz_city") // configs, _ := service.FindAllDataUploadConfigOrgInfo(sz_province, sz_city, 3) org := &sz.DataUploadConfig{ OrgId: 9504, ProvinceId: 19, CityId: 291, DepartmentName: "深圳生命之源血液透析中心", HospitalId: "MA5EU4PC0", InstType: 1, DbHost: "localhost", DbPort: "1433", DbPass: "1Q2W3e4r!@#$", DbUser: "sa", DbName: "xtzk", } // for _, org := range configs { // 第二步:跟进配置,创建数据库连接 if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException) return } // 第三步:开始同步数据 // 同步医院信息 t_hd_hospital // city.SyncHospital(orgDb, org.OrgId, org.HospitalId, org.InstType, org.DepartmentName) // // 同步员工 t_hd_staff city.SyncStaff(orgDb, org.OrgId, org.HospitalId) // 布局表(T_HD_LAYOUT) city.SyncLayout(orgDb, org.OrgId, org.HospitalId) // 同步设备 t_hd_dm city.SyncDM(orgDb, org.OrgId, org.HospitalId) // 同步水处理器 t_hd_wm city.SyncWMS(orgDb, org.OrgId, org.HospitalId) // 同步维修 t_hd_maintain city.SyncMachineRepair(orgDb, org.OrgId, org.HospitalId) // 同步设备消毒方法表(T_HD_DISINFECT_METHOD city.SyncDisinfectMethod(orgDb, org.OrgId, org.HospitalId) // 同步其它设备信息表(T_HD_OTHER_MACHINE) city.SyncOtherMachine(orgDb, org.OrgId, org.HospitalId) // 同步透析机消毒检测记录表(T_HD_DM_DISINFECT) city.SyncDmDisinfect(orgDb, org.OrgId, org.HospitalId) // 透析机透析液细菌培养检测记录表(t_hd_dm_dialysate_bc) city.SyncLisCulture(orgDb, org.OrgId, org.HospitalId) // 透析机透析液内毒素检测记录表(T_HD_DM_DIALYSATE_EN) city.SyncDialysate(orgDb, org.OrgId, org.HospitalId) // 水处理机消毒记录表(T_HD_WM_DISINFECT) city.SyncWmDisinfect(orgDb, org.OrgId, org.HospitalId) //透析用水PH值检测表(T_HD_WATER_PH) city.SynLisWaterPh(orgDb, org.OrgId, org.HospitalId) //透析用水细菌培养检测表(T_HD_WATER_BC) city.SyncLisWaterBc(orgDb, org.OrgId, org.HospitalId) //透析用水内毒素检测表(T_HD_WATER_EN) city.SyncLisWaterEn(orgDb, org.OrgId, org.HospitalId) //透析用水有毒化学物检测表(T_HD_WATER_NC) city.SynLisWaterNc(orgDb, org.OrgId, org.HospitalId) //透析用水水硬度检测表(T_HD_WATER_WH) city.SynListHadWater(orgDb, org.OrgId, org.HospitalId) //透析用水游离氯检测表(T_HD_WATER_FC) city.SyncLisWaterFc(orgDb, org.OrgId, org.HospitalId) //透析用水电解质检测表(T_HD_WATER_EL) city.SyncLisWaterEl(orgDb, org.OrgId, org.HospitalId) //透析用水微量元素检测表(T_HD_WATER_TE) city.SyncLisWaterTe(orgDb, org.OrgId, org.HospitalId) //透析室空气消毒记录表(T_HD_AIR_DISINFECT) city.SyncLisAirDetection(orgDb, org.OrgId, org.HospitalId) //物表消毒记录表(T_HD_SURFACE_DISINFECT) city.SyncLisBodyDetection(orgDb, org.OrgId, org.HospitalId) //同步血透患者基本信息表(T_HD_PATIENT) city.SyncPatient(orgDb, org.OrgId, org.HospitalId) // 同步患者退出信息表(T_HD_PATIENT_QUIT) city.SyncPatientOut(orgDb, org.OrgId, org.HospitalId) // 同步处方 t_hd_ps city.SyncPs(orgDb, org.OrgId, org.HospitalId) // 同步处方药品 t_hd_ps city.SyncPsMedicine(orgDb, org.OrgId, org.HospitalId) // 患者诊断信息表(T_HD_DIAGNOSIS) city.SyncDiagnosis(orgDb, org.OrgId, org.HospitalId) // 患者通路信息表(T_HD_ACCESS) city.SyncAccess(orgDb, org.OrgId, org.HospitalId) //导管感染记录表(T_HD_CI) city.SynListHdCi(orgDb, org.OrgId, org.HospitalId) //导管感染转归记录表(T_HD_CI_OUTCOME) city.SynLisHdCiOutCome(orgDb, org.OrgId, org.HospitalId) // // city.UpdatePatient(orgDb, org.OrgId, org.HospitalId) // 患者传染病检查记录表(T_HD_INFECTION city.SyncInfection(orgDb, org.OrgId, org.HospitalId) // 同步排班 t_hd_shift city.SyncShift(orgDb, org.OrgId, org.HospitalId) // 同步透析医嘱表(T_HD_DOCTORS_ADVICE) city.SyncDoctorAdvice(orgDb, org.OrgId, org.HospitalId) // 同步患者透析记录 t_hd_dialysis city.SyncDialysis(orgDb, org.OrgId, org.HospitalId) //city.SyncLisIndicatorsBc(orgDb, org.OrgId, org.HospitalId) //city.SyncLisIndicatorsBcUpdate(orgDb, org.OrgId, org.HospitalId) //city.SyncLisReportBc(orgDb, org.OrgId, org.HospitalId) // 同步透中信息 t_hd_middle city.SyncMiddle(orgDb, org.OrgId, org.HospitalId) // 透析并发症记录表(T_HD_COMPLICATION) city.SyncComplication(orgDb, org.OrgId, org.HospitalId) // 透析床位表(T_HD_SICKBED) city.SyncSickbed(orgDb, org.OrgId, org.HospitalId) // 同步透析床位分区 t_hd_division city.SyncDivision(orgDb, org.OrgId, org.HospitalId) // 血透患者检测结果表(T_HD_LIS_REPORT) city.SyncLisReport(orgDb, org.OrgId, org.HospitalId) //血透患者检验结果指标表(T_HD_LIS_INDICATORS) city.SyncLisIndicators(orgDb, org.OrgId, org.HospitalId) // // 第四步:关闭数据库连接 // // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } c.ServeSuccessJSON(map[string]interface{}{ "resultList": "12345", }) return } func (c *SyncController) SyncToSmzyYxxxzx() { org := &sz.DataUploadConfig{ OrgId: 9504, ProvinceId: 19, CityId: 291, DepartmentName: "深圳生命之源血液透析中心", HospitalId: "MA5EU4PC0", InstType: 1, DbHost: "localhost", DbPort: "1433", DbPass: "1Q2W3e4r!@#$", DbUser: "sa", DbName: "xtzk", } // for _, org := range configs { // 第二步:跟进配置,创建数据库连接 if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) return } // 第三步:开始同步数据 // 机构人员字典表 t_hd_hospital city.SyncTBDICPractitioner(orgDb, org.OrgId, org.HospitalId) // 药品目录字典表 city.SyncTBDICMedicines(orgDb, org.OrgId, org.HospitalId) // 药品对照字典 city.SyncTBDICYpdzzd(orgDb, org.OrgId, org.HospitalId) // 诊疗项目目录字典表 city.SyncTBDICZlxmml(orgDb, org.OrgId, org.HospitalId) // 诊疗项目目录字典表 city.SyncTBDICZlxmdzzd(orgDb, org.OrgId, org.HospitalId) // 机构床位 t_hd_wm city.SyncTMDICTBED(orgDb, org.OrgId, org.HospitalId) // 门诊患者信息表 city.SyncTBMZPatientInformation(orgDb, org.OrgId, org.HospitalId) // 挂号表 city.SyncTBHISMZReg(orgDb, org.OrgId, org.HospitalId) // 门诊就诊记录表 city.SyncTB_YL_MZ_Medical_Record(orgDb, org.OrgId, org.HospitalId) // 门诊处方主表 city.SyncTB_CIS_Prescription(orgDb, org.OrgId, org.HospitalId) // 18. 门诊处方明细表 city.SyncTB_CIS_Prescription_Detail(orgDb, org.OrgId, org.HospitalId) // 19. 门诊收费表 city.SyncTB_HIS_MZ_Charge(orgDb, org.OrgId, org.HospitalId) // 20. 门诊收费明细表 city.SyncTB_HIS_MZ_Fee_Detail(orgDb, org.OrgId, org.HospitalId) // 业务量收入统计表 city.SyncTB_STAT_YWL_Report(orgDb, org.OrgId, org.HospitalId) // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } return } func (c *SyncController) SyncToSzjk() { // 第一步:到上报配置表中找到深圳需要上报的机构 // sz_province, _ := beego.AppConfig.Int64("sz_province") // sz_city, _ := beego.AppConfig.Int64("sz_city") // configs, _ := service.FindAllDataUploadConfigOrgInfo(sz_province, sz_city, 3) org := &sz.DataUploadConfig{ OrgId: 10245, ProvinceId: 19, CityId: 291, DepartmentName: "深圳静康医院血液透析中心", HospitalId: "MA5DKWHG3", InstType: 1, DbHost: "localhost", DbPort: "1433", DbPass: "Ya2019", DbUser: "sa", DbName: "adapter_2019", } // for _, org := range configs { // 第二步:跟进配置,创建数据库连接 if len(org.DbHost) > 0 && len(org.DbUser) > 0 && len(org.DbPort) > 0 && len(org.DbPass) > 0 && len(org.DbName) > 0 { orgDb, err := service.CreateSqlServiceDB(org.DbHost, org.DbPort, org.DbUser, org.DbPass, org.DbName) if err != nil { utils.ErrorLog("创建数据库连接失败:%v", err) c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException) return } // 第三步:开始同步数据 // 同步医院信息 t_hd_hospital city.SyncHospital(orgDb, org.OrgId, org.HospitalId, org.InstType, org.DepartmentName) // 同步水处理器 t_hd_wm city.SyncWMS(orgDb, org.OrgId, org.HospitalId) // 同步员工 t_hd_staff city.SyncStaff(orgDb, org.OrgId, org.HospitalId) // // 同步病人 t_hd_patient city.SyncPatient(orgDb, org.OrgId, org.HospitalId) city.UpdatePatient(orgDb, org.OrgId, org.HospitalId) // 同步排班 t_hd_shift city.SyncShift(orgDb, org.OrgId, org.HospitalId) // 同步处方 t_hd_ps city.SyncPs(orgDb, org.OrgId, org.HospitalId) // 同步处方药品 t_hd_ps city.SyncPsMedicine(orgDb, org.OrgId, org.HospitalId) // // 同步转院信息 t_hd_patient_out city.SyncPatientOut(orgDb, org.OrgId, org.HospitalId) // 同步处方信息 t_hd_doctors_advice city.SyncDoctorAdvice(orgDb, org.OrgId, org.HospitalId) // 同步透中信息 t_hd_middle city.SyncMiddle(orgDb, org.OrgId, org.HospitalId) // // 同步设备 t_hd_other_machine city.SyncOtherMachine(orgDb, org.OrgId, org.HospitalId) // // 同步维修 t_hd_maintain city.SyncMachineRepair(orgDb, org.OrgId, org.HospitalId) // // 同步设备 t_hd_dm city.SyncDM(orgDb, org.OrgId, org.HospitalId) // // 同步患者透析记录 t_hd_dialysis city.SyncDialysis(orgDb, org.OrgId, org.HospitalId) // 同步透析床位分区 t_hd_division city.SyncDivision(orgDb, org.OrgId, org.HospitalId) // 患者通路信息表(T_HD_ACCESS) city.SyncAccess(orgDb, org.OrgId, org.HospitalId) // 透析床位表(T_HD_SICKBED) city.SyncSickbed(orgDb, org.OrgId, org.HospitalId) // 患者诊断信息表(T_HD_DIAGNOSIS) city.SyncDiagnosis(orgDb, org.OrgId, org.HospitalId) // 患者传染病检查记录表(T_HD_INFECTION city.SyncInfection(orgDb, org.OrgId, org.HospitalId) // 透析并发症记录表(T_HD_COMPLICATION) city.SyncComplication(orgDb, org.OrgId, org.HospitalId) // 血透患者检测结果表(T_HD_LIS_REPORT) city.SyncLisReport(orgDb, org.OrgId, org.HospitalId) // 血透患者检验结果指标表(T_HD_LIS_INDICATORS) city.SyncLisIndicators(orgDb, org.OrgId, org.HospitalId) // 透析机透析液细菌培养检测记录表(t_hd_dm_dialysate_bc) city.SyncLisCulture(orgDb, org.OrgId, org.HospitalId) //透析机透析液内毒素检测记录表(T_HD_DM_DIALYSATE_BC) city.SyncDialysate(orgDb, org.OrgId, org.HospitalId) //物表消毒记录表(T_HD_SURFACE_DISINFECT) city.SyncLisBodyDetection(orgDb, org.OrgId, org.HospitalId) //透析用水游离氯检测表(T_HD_WATER_FC) city.SyncLisWaterFc(orgDb, org.OrgId, org.HospitalId) //透析用水有毒化学物检测表(T_HD_WATER_NC) city.SynLisWaterNc(orgDb, org.OrgId, org.HospitalId) //透析用水PH值检测表(T_HD_WATER_PH) city.SynLisWaterPh(orgDb, org.OrgId, org.HospitalId) //透析用水水硬度检测表(T_HD_WATER_WH) city.SynListHadWater(orgDb, org.OrgId, org.HospitalId) //导管感染记录表(T_HD_CI) city.SynListHdCi(orgDb, org.OrgId, org.HospitalId) //导管感染转归记录表(T_HD_CI_OUTCOME) city.SynLisHdCiOutCome(orgDb, org.OrgId, org.HospitalId) //透析室空气消毒记录表(T_HD_AIR_DISINFECT) city.SyncLisAirDetection(orgDb, org.OrgId, org.HospitalId) //透析用水细菌培养检测表(T_HD_WATER_BC) city.SyncLisWaterBc(orgDb, org.OrgId, org.HospitalId) //透析用水内毒素检测表(T_HD_WATER_EN) city.SyncLisWaterEn(orgDb, org.OrgId, org.HospitalId) // 第四步:关闭数据库连接 service.CloseDB(orgDb) } // } c.ServeSuccessJSON(map[string]interface{}{ "resultList": "12345", }) return }