1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222 |
- 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
- }
|