张保健 vor 4 Jahren
Ursprung
Commit
942484537a
7 geänderte Dateien mit 420 neuen und 212 gelöschten Zeilen
  1. 1 1
      conf/app.conf
  2. 159 30
      controllers/sync.go
  3. 2 2
      main.go
  4. 34 1
      models/src_data.go
  5. 165 165
      models/sz/target_data.go
  6. 2 0
      routers/router.go
  7. 57 13
      service/city_data_uoload_service.go

+ 1 - 1
conf/app.conf Datei anzeigen

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9550
3
-runmode = dev
3
+runmode = prod
4 4
 
5 5
 copyrequestbody = true
6 6
 sessionon = true

+ 159 - 30
controllers/sync.go Datei anzeigen

@@ -12,12 +12,18 @@ import (
12 12
 	"strings"
13 13
 	_ "strings"
14 14
 	"time"
15
+	"fmt"
15 16
 )
16 17
 
17 18
 type SyncController struct {
18 19
 	BaseAPIController
19 20
 }
20 21
 
22
+func SyncAPIRegisterRouters() {
23
+	beego.Router("/sync/upload", &SyncController{}, "get:SyncToSZIC")
24
+
25
+}
26
+
21 27
 func (c *SyncController) SyncToSZIC() {
22 28
 	// 第一步:到上报配置表中找到深圳需要上报的机构
23 29
 	sz_province, _ := beego.AppConfig.Int64("sz_province")
@@ -33,16 +39,47 @@ func (c *SyncController) SyncToSZIC() {
33 39
 				return
34 40
 			}
35 41
 			// 第三步:开始同步数据
42
+			// 同步医院信息  t_hd_hospital
36 43
 			c.SyncHospital(orgDb, org.OrgId, org.HospitalId, org.InstType, org.DepartmentName)
37
-
44
+			// 同步水处理器  t_hd_wm
45
+			c.SyncWMS(orgDb,org.OrgId, org.HospitalId)
46
+			// 同步员工 t_hd_staff
47
+			c.SyncStaff(orgDb,org.OrgId, org.HospitalId)
48
+			// 同步病人 t_hd_patient
49
+			c.SyncPatient(orgDb,org.OrgId, org.HospitalId)
50
+			// 同步排班  t_hd_shift
51
+			c.SyncShift(orgDb,org.OrgId, org.HospitalId)
52
+			// 同步处方 t_hd_ps
53
+			c.SyncPs(orgDb,org.OrgId, org.HospitalId)
54
+			// 同步处方药品 t_hd_ps
55
+			c.SyncPsMedicine(orgDb,org.OrgId, org.HospitalId)
56
+			// 同步转院信息 t_hd_patient_out
57
+			c.SyncPatientOut(orgDb,org.OrgId, org.HospitalId)
58
+			// 同步处方信息 t_hd_doctors_advice
59
+			c.SyncDoctorAdvice(orgDb,org.OrgId, org.HospitalId)
60
+			// 同步透中信息 t_hd_middle
61
+			c.SyncMiddle(orgDb,org.OrgId, org.HospitalId)
62
+			// // 同步设备 t_hd_other_machine
63
+			c.SyncOtherMachine(orgDb,org.OrgId, org.HospitalId)
64
+			// // 同步维修 t_hd_maintain
65
+			c.SyncMachineRepair(orgDb,org.OrgId, org.HospitalId)
66
+			// // 同步设备 t_hd_dm
67
+			c.SyncDM(orgDb,org.OrgId, org.HospitalId)
68
+			// // 同步患者透析记录 t_hd_dialysis
69
+			c.SyncDialysis(orgDb,org.OrgId, org.HospitalId)
70
+			
38 71
 			// 第四步:关闭数据库连接
39 72
 			service.CloseDB(orgDb)
40 73
 		}
41 74
 	}
75
+	c.ServeSuccessJSON(map[string]interface{}{
76
+		"resultList": "12345",
77
+	})
78
+	return
42 79
 }
43 80
 
44 81
 // 同步医院信息
45
-func (c *SyncController) SyncHospital(rdb *gorm.DB, org_id int64, hospital_id int64, inst_type int64, department_name string) {
82
+func (c *SyncController) SyncHospital(rdb *gorm.DB, org_id int64, hospital_id string, inst_type int64, department_name string) {
46 83
 	// 第一步:根据机构id获取上次同步时间
47 84
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 1)
48 85
 	var sync_time int64
@@ -56,7 +93,7 @@ func (c *SyncController) SyncHospital(rdb *gorm.DB, org_id int64, hospital_id in
56 93
 	org, _ := service.FindOrgData(org_id, sync_time)
57 94
 	if org.ID > 0 {
58 95
 		hospital := &sz.TempHdHospital{
59
-			HospitalId:     strconv.FormatInt(hospital_id, 10),
96
+			HospitalId:     hospital_id,
60 97
 			InstType:       strconv.FormatInt(inst_type, 10),
61 98
 			DepartMentName: department_name,
62 99
 			AuthorizedBeds: int64(len(org.DeviceNumber)),
@@ -65,7 +102,7 @@ func (c *SyncController) SyncHospital(rdb *gorm.DB, org_id int64, hospital_id in
65 102
 			Sjscsj:         time.Now(),
66 103
 			Xgbz:           0,
67 104
 		}
68
-		err := service.CreateOrgRecord(hospital)
105
+		err := service.CreateOrgRecord(rdb,hospital)
69 106
 		if err == nil {
70 107
 			// 第三步:同步成功后,添加同步记录
71 108
 			upload := &sz.DataUpload{
@@ -82,11 +119,10 @@ func (c *SyncController) SyncHospital(rdb *gorm.DB, org_id int64, hospital_id in
82 119
 			}
83 120
 		}
84 121
 	}
85
-
86 122
 }
87 123
 
88 124
 // 同步水处理器
89
-func (c *SyncController) SyncWMS(rdb *gorm.DB, org_id int64, hospital_id int64) {
125
+func (c *SyncController) SyncWMS(rdb *gorm.DB, org_id int64, hospital_id string) {
90 126
 	// 第一步:根据机构id获取上次同步时间
91 127
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 22)
92 128
 	var sync_time int64
@@ -101,7 +137,7 @@ func (c *SyncController) SyncWMS(rdb *gorm.DB, org_id int64, hospital_id int64)
101 137
 	var wms []*sz.TempHdWm
102 138
 	for _, item := range waterMachine {
103 139
 		wm := &sz.TempHdWm{
104
-			HospitalId:     strconv.FormatInt(hospital_id, 10),
140
+			HospitalId:     hospital_id,
105 141
 			EquipmentId:    strconv.FormatInt(item.ID, 10),
106 142
 			EquipmentBrand: item.ManufactureFactory,
107 143
 			EquipmentModel: strconv.FormatInt(item.UnitType, 10),
@@ -140,7 +176,7 @@ func (c *SyncController) SyncWMS(rdb *gorm.DB, org_id int64, hospital_id int64)
140 176
 }
141 177
 
142 178
 // 同步员工
143
-func (c *SyncController) SyncStaff(rdb *gorm.DB, org_id int64, hospital_id int64) {
179
+func (c *SyncController) SyncStaff(rdb *gorm.DB, org_id int64, hospital_id string) {
144 180
 	// 第一步:根据机构id获取上次同步时间
145 181
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 21)
146 182
 	var sync_time int64
@@ -167,7 +203,7 @@ func (c *SyncController) SyncStaff(rdb *gorm.DB, org_id int64, hospital_id int64
167 203
 		}
168 204
 
169 205
 		staff := &sz.TempHdStaff{
170
-			HospitalId:    strconv.FormatInt(hospital_id, 10),
206
+			HospitalId:    hospital_id,
171 207
 			StaffId:       strconv.FormatInt(role.ID, 10),
172 208
 			StaffName:     role.UserName,
173 209
 			Position:      title,
@@ -204,7 +240,7 @@ func (c *SyncController) SyncStaff(rdb *gorm.DB, org_id int64, hospital_id int64
204 240
 }
205 241
 
206 242
 // 同步病人
207
-func (c *SyncController) SyncPatient(rdb *gorm.DB, org_id int64, hospital_id int64) {
243
+func (c *SyncController) SyncPatient(rdb *gorm.DB, org_id int64, hospital_id string) {
208 244
 	// 第一步:根据机构id获取上次同步时间
209 245
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 15)
210 246
 	var sync_time int64
@@ -223,12 +259,25 @@ func (c *SyncController) SyncPatient(rdb *gorm.DB, org_id int64, hospital_id int
223 259
 
224 260
 		idcard_year, _ := strconv.Atoi(Substr(patient.IdCardNo, 6, 4)) // 年
225 261
 		idcard_mo, _ := strconv.Atoi(Substr(patient.IdCardNo, 10, 2))  // 月
262
+		
226 263
 		idcard_day, _ := strconv.Atoi(Substr(patient.IdCardNo, 12, 2)) // 日
227 264
 
228
-		date := strconv.Itoa(idcard_year) + "-" + strconv.Itoa(idcard_mo) + "-" + strconv.Itoa(idcard_day)
265
+		date := strconv.Itoa(idcard_year)
266
+		if idcard_mo < 10 {
267
+			date = date + "-0" + strconv.Itoa(idcard_mo) 
268
+		} else {
269
+			date = date + "-" + strconv.Itoa(idcard_mo) 
270
+		}
271
+
272
+		if idcard_day < 10 {
273
+			date = date + "-0" + strconv.Itoa(idcard_day)
274
+		} else {
275
+			date = date + "-" + strconv.Itoa(idcard_day)
276
+		}
229 277
 
230 278
 		local, _ := time.LoadLocation("Local")
231 279
 		birthday, _ := time.ParseInLocation("2006-01-02", date, local)
280
+		fmt.Println(birthday)
232 281
 
233 282
 		var isCKD int
234 283
 
@@ -243,10 +292,10 @@ func (c *SyncController) SyncPatient(rdb *gorm.DB, org_id int64, hospital_id int
243 292
 		}
244 293
 
245 294
 		p := &sz.TempHdPatient{
246
-			HospitalId:       strconv.FormatInt(hospital_id, 10),
295
+			HospitalId:       hospital_id,
247 296
 			PatientNk:        strconv.FormatInt(patient.ID, 10),
248 297
 			CardNo:           "000000000000000000",
249
-			CardType:         "01",
298
+			CardType:         "01", 
250 299
 			IdNo:             patient.IdCardNo,
251 300
 			IdType:           "01",
252 301
 			PatientName:      patient.Name,
@@ -320,7 +369,7 @@ func Substr(str string, start, length int) string {
320 369
 }
321 370
 
322 371
 // 同步排班
323
-func (c *SyncController) SyncShift(rdb *gorm.DB, org_id int64, hospital_id int64) {
372
+func (c *SyncController) SyncShift(rdb *gorm.DB, org_id int64, hospital_id string) {
324 373
 	// 第一步:根据机构id获取上次同步时间
325 374
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 19)
326 375
 	var sync_time int64
@@ -372,7 +421,7 @@ func (c *SyncController) SyncShift(rdb *gorm.DB, org_id int64, hospital_id int64
372 421
 }
373 422
 
374 423
 // 同步处方
375
-func (c *SyncController) SyncPs(rdb *gorm.DB, org_id int64, hospital_id int64) {
424
+func (c *SyncController) SyncPs(rdb *gorm.DB, org_id int64, hospital_id string) {
376 425
 	// 第一步:根据机构id获取上次同步时间
377 426
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 17)
378 427
 	var sync_time int64
@@ -388,7 +437,7 @@ func (c *SyncController) SyncPs(rdb *gorm.DB, org_id int64, hospital_id int64) {
388 437
 
389 438
 		ps := &sz.TempHdPs{
390 439
 			PrescribeId:   strconv.FormatInt(item.ID, 10),
391
-			HospitalId:    strconv.FormatInt(hospital_id, 10),
440
+			HospitalId:    hospital_id,
392 441
 			PatientNk:     strconv.FormatInt(item.PatientId, 10),
393 442
 			K:             item.Kalium,
394 443
 			Ca:            item.Calcium,
@@ -451,7 +500,7 @@ func (c *SyncController) SyncPs(rdb *gorm.DB, org_id int64, hospital_id int64) {
451 500
 }
452 501
 
453 502
 // 同步处方药物
454
-func (c *SyncController) SyncPsMedicine(rdb *gorm.DB, org_id int64, hospital_id int64) {
503
+func (c *SyncController) SyncPsMedicine(rdb *gorm.DB, org_id int64, hospital_id string) {
455 504
 	// 第一步:根据机构id获取上次同步时间
456 505
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 18)
457 506
 	var sync_time int64
@@ -525,7 +574,7 @@ func (c *SyncController) SyncPsMedicine(rdb *gorm.DB, org_id int64, hospital_id
525 574
 }
526 575
 
527 576
 // 同步转院信息
528
-func (c *SyncController) SyncPatientOut(rdb *gorm.DB, org_id int64, hospital_id int64) {
577
+func (c *SyncController) SyncPatientOut(rdb *gorm.DB, org_id int64, hospital_id string) {
529 578
 	// 第一步:根据机构id获取上次同步时间
530 579
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 16)
531 580
 	var sync_time int64
@@ -550,7 +599,7 @@ func (c *SyncController) SyncPatientOut(rdb *gorm.DB, org_id int64, hospital_id
550 599
 		}
551 600
 
552 601
 		if len(patient.PatientLapseto) > 0 {
553
-			p.SequelaeDate = time.Unix(patient.PatientLapseto[len(patient.PatientLapseto)].LapsetoTime, 0)
602
+			p.SequelaeDate = time.Unix(patient.PatientLapseto[len(patient.PatientLapseto) - 1].LapsetoTime, 0)
554 603
 		}
555 604
 
556 605
 		hdPatientOuts = append(hdPatientOuts, p)
@@ -580,7 +629,7 @@ func (c *SyncController) SyncPatientOut(rdb *gorm.DB, org_id int64, hospital_id
580 629
 }
581 630
 
582 631
 // 同步处方信息
583
-func (c *SyncController) SyncDoctorAdvice(rdb *gorm.DB, org_id int64, hospital_id int64) {
632
+func (c *SyncController) SyncDoctorAdvice(rdb *gorm.DB, org_id int64, hospital_id string) {
584 633
 	// 第一步:根据机构id获取上次同步时间
585 634
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 6)
586 635
 	var sync_time int64
@@ -634,9 +683,9 @@ func (c *SyncController) SyncDoctorAdvice(rdb *gorm.DB, org_id int64, hospital_i
634 683
 }
635 684
 
636 685
 //
637
-func (c *SyncController) SyncMiddle(rdb *gorm.DB, org_id int64, hospital_id int64) {
686
+func (c *SyncController) SyncMiddle(rdb *gorm.DB, org_id int64, hospital_id string) {
638 687
 	// 第一步:根据机构id获取上次同步时间
639
-	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 6)
688
+	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 36)
640 689
 	var sync_time int64
641 690
 	if syncLastInfo.ID > 0 {
642 691
 		sync_time = syncLastInfo.SyncTime
@@ -650,7 +699,7 @@ func (c *SyncController) SyncMiddle(rdb *gorm.DB, org_id int64, hospital_id int6
650 699
 	for _, item := range monitors {
651 700
 
652 701
 		mid := &sz.TempHdMiddle{
653
-			HospitalId:  strconv.FormatInt(hospital_id, 10),
702
+			HospitalId:  hospital_id,
654 703
 			DialysisId:  strconv.FormatInt(item.DialysisOrder.ID, 10),
655 704
 			MonitorTime: time.Unix(item.OperateTime, 0),
656 705
 			Sbp:         int64(math.Floor(item.SystolicBloodPressure + 0/5)),
@@ -670,7 +719,7 @@ func (c *SyncController) SyncMiddle(rdb *gorm.DB, org_id int64, hospital_id int6
670 719
 	if err == nil {
671 720
 		// 第三步:同步成功后,添加同步记录
672 721
 		upload := &sz.DataUpload{
673
-			SyncType:       6,
722
+			SyncType:       36,
674 723
 			OrgId:          org_id,
675 724
 			SyncTime:       time.Now().Unix(),
676 725
 			SyncResultType: 1,
@@ -689,7 +738,7 @@ func (c *SyncController) SyncMiddle(rdb *gorm.DB, org_id int64, hospital_id int6
689 738
 }
690 739
 
691 740
 // 同步设备
692
-func (c *SyncController) SyncOtherMachine(rdb *gorm.DB, org_id int64, hospital_id int64) {
741
+func (c *SyncController) SyncOtherMachine(rdb *gorm.DB, org_id int64, hospital_id string) {
693 742
 	// 第一步:根据机构id获取上次同步时间
694 743
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 13)
695 744
 	var sync_time int64
@@ -704,7 +753,7 @@ func (c *SyncController) SyncOtherMachine(rdb *gorm.DB, org_id int64, hospital_i
704 753
 	var wms []*sz.TempHdOtherMachine
705 754
 	for _, item := range waterMachine {
706 755
 		wm := &sz.TempHdOtherMachine{
707
-			HospitalId:     strconv.FormatInt(hospital_id, 10),
756
+			HospitalId:     hospital_id,
708 757
 			EquipmentId:    strconv.FormatInt(item.ID, 10),
709 758
 			EquipmentBrand: item.ManufactureFactory,
710 759
 			EquipmentModel: strconv.FormatInt(item.UnitType, 10),
@@ -750,7 +799,7 @@ func (c *SyncController) SyncOtherMachine(rdb *gorm.DB, org_id int64, hospital_i
750 799
 }
751 800
 
752 801
 // 同步维修
753
-func (c *SyncController) SyncMachineRepair(rdb *gorm.DB, org_id int64, hospital_id int64) {
802
+func (c *SyncController) SyncMachineRepair(rdb *gorm.DB, org_id int64, hospital_id string) {
754 803
 	// 第一步:根据机构id获取上次同步时间
755 804
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 11)
756 805
 	var sync_time int64
@@ -765,7 +814,7 @@ func (c *SyncController) SyncMachineRepair(rdb *gorm.DB, org_id int64, hospital_
765 814
 	var maintain []*sz.TempHdMaintain
766 815
 	for _, item := range hdMaintain {
767 816
 		mt := &sz.TempHdMaintain{
768
-			HospitalId:  strconv.FormatInt(hospital_id, 10),
817
+			HospitalId:  hospital_id,
769 818
 			EquipmentId: strconv.FormatInt(item.VMDeviceAddmacher.ID, 10),
770 819
 			RepairTime:  time.Unix(item.GuaranteeDate, 0),
771 820
 			CreateTime:  time.Now(),
@@ -810,7 +859,7 @@ func (c *SyncController) SyncMachineRepair(rdb *gorm.DB, org_id int64, hospital_
810 859
 }
811 860
 
812 861
 // 同步设备
813
-func (c *SyncController) SyncDM(rdb *gorm.DB, org_id int64, hospital_id int64) {
862
+func (c *SyncController) SyncDM(rdb *gorm.DB, org_id int64, hospital_id string) {
814 863
 	// 第一步:根据机构id获取上次同步时间
815 864
 	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 5)
816 865
 	var sync_time int64
@@ -825,7 +874,7 @@ func (c *SyncController) SyncDM(rdb *gorm.DB, org_id int64, hospital_id int64) {
825 874
 	var hdms []*sz.TempHdDm
826 875
 	for _, item := range dm {
827 876
 		hdm := &sz.TempHdDm{
828
-			HospitalId:     strconv.FormatInt(hospital_id, 10),
877
+			HospitalId:     hospital_id,
829 878
 			EquipmentId:    strconv.FormatInt(item.ID, 10),
830 879
 			SickbedNo:      item.DeviceNumber.Number,
831 880
 			EquipmentBrand: item.ManufactureFactory,
@@ -883,3 +932,83 @@ func (c *SyncController) SyncDM(rdb *gorm.DB, org_id int64, hospital_id int64) {
883 932
 	}
884 933
 
885 934
 }
935
+
936
+// 同步患者透析记录
937
+func (c *SyncController) SyncDialysis(rdb *gorm.DB, org_id int64, hospital_id string) {
938
+	// 第一步:根据机构id获取上次同步时间
939
+	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 2)
940
+	var sync_time int64
941
+	if syncLastInfo.ID > 0 {
942
+		sync_time = syncLastInfo.SyncTime
943
+	} else {
944
+		sync_time = 0
945
+	}
946
+
947
+	var tempDialysis []*sz.TempHdDialysis
948
+	dialysisData, _ := service.FindOrgDialysisData(org_id, sync_time, time.Now().Unix())
949
+
950
+	for _, item := range dialysisData {
951
+ 
952
+		psm := &sz.TempHdDialysis{
953
+			DialysisId:		strconv.FormatInt(item.ID, 10),
954
+			HospitalId:     strconv.FormatInt(item.UserOrgId, 10),
955
+			PatientNk:      strconv.FormatInt(item.PatientId, 10),
956
+			PsId:			strconv.FormatInt(item.Schedule.ID, 10),
957
+			DialysisDate:	time.Unix(item.DialysisDate, 0),
958
+			SickbedNo:		item.DeviceNumber.Number,
959
+			DivisionId:		strconv.FormatInt(item.Schedule.PartitionId,10),
960
+			EquipmentId: 	strconv.FormatInt(item.DeviceNumber.ID, 10),
961
+			TotalTreatDuration: 	 item.AssessmentAfterDislysis.ActualTreatmentHour * 60 	+ item.AssessmentAfterDislysis.ActualTreatmentMinute,
962
+			BeforeSbp: 		int64(item.AssessmentBeforeDislysis.SystolicBloodPressure),
963
+			BeforeDbp: 		int64(item.AssessmentBeforeDislysis.DiastolicBloodPressure),
964
+			AfterSbp:		int64(item.AssessmentAfterDislysis.SystolicBloodPressure),
965
+			AfterDbp:		int64(item.AssessmentAfterDislysis.DiastolicBloodPressure),
966
+			StartTime:		time.Unix(item.StartTime, 0),
967
+			EndTime:		time.Unix(item.EndTime, 0),
968
+			CreateTime:		time.Unix(item.CreatedTime, 0),
969
+			Sjscsj:         time.Now(),
970
+			Xgbz:           0,
971
+		}
972
+		if item.AssessmentAfterDislysis.ActualUltrafiltration < 10 {
973
+			psm.ActualufMl = int64(item.AssessmentAfterDislysis.ActualUltrafiltration * 1000)
974
+		} else {
975
+			psm.ActualufMl = int64(item.AssessmentAfterDislysis.ActualUltrafiltration)
976
+		}
977
+
978
+		if item.VMDialysisPrescription.TargetUltrafiltration < 10 {
979
+			psm.Ufv = int64(item.VMDialysisPrescription.TargetUltrafiltration * 1000)
980
+		} else {
981
+			psm.Ufv = int64(item.VMDialysisPrescription.TargetUltrafiltration)
982
+		}
983
+		
984
+		if item.AssessmentAfterDislysis.ActualDisplacement < 10 {
985
+			psm.TotalReplace = int64(item.AssessmentAfterDislysis.ActualDisplacement * 1000)
986
+		} else {
987
+			psm.TotalReplace = int64(item.AssessmentAfterDislysis.ActualDisplacement)
988
+		}
989
+
990
+		tempDialysis = append(tempDialysis, psm)
991
+	}
992
+
993
+	err := service.BatchCreateDialysis(tempDialysis, rdb)
994
+
995
+	if err == nil {
996
+		// 第三步:同步成功后,添加同步记录
997
+		upload := &sz.DataUpload{
998
+			SyncType:       2,
999
+			OrgId:          org_id,
1000
+			SyncTime:       time.Now().Unix(),
1001
+			SyncResultType: 1,
1002
+			CreateTime:     time.Now().Unix(),
1003
+			UpdateTime:     time.Now().Unix(),
1004
+		}
1005
+		err := service.CreateUploadRecord(upload)
1006
+		if err != nil {
1007
+			utils.ErrorLog("%v", err)
1008
+		}
1009
+	} else {
1010
+		//错误处理
1011
+
1012
+	}
1013
+
1014
+}

+ 2 - 2
main.go Datei anzeigen

@@ -3,7 +3,7 @@ package main
3 3
 import (
4 4
 	_ "Data_Upload_Api/routers"
5 5
 	"Data_Upload_Api/service"
6
-	"Data_Upload_Api/service/city"
6
+	_"Data_Upload_Api/service/city"
7 7
 
8 8
 	"github.com/astaxie/beego"
9 9
 )
@@ -13,6 +13,6 @@ func init() {
13 13
 }
14 14
 
15 15
 func main() {
16
-	city.AutoSZUploadData()
16
+	// city.AutoSZUploadData()
17 17
 	beego.Run()
18 18
 }

+ 34 - 1
models/src_data.go Datei anzeigen

@@ -15,7 +15,7 @@ type XTSyncInfo struct {
15 15
 }
16 16
 
17 17
 func (XTSyncInfo) TableName() string {
18
-	return "xt_sync_info"
18
+	return "data_sync_info"
19 19
 }
20 20
 
21 21
 type UserOrg struct {
@@ -571,6 +571,39 @@ func (DialysisOrder) TableName() string {
571 571
 	return "xt_dialysis_order"
572 572
 }
573 573
 
574
+type VMDialysisOrder struct {
575
+	ID             int64  `gorm:"column:id" json:"id"`
576
+	DialysisDate   int64  `gorm:"column:dialysis_date" json:"dialysis_date"`
577
+	UserOrgId      int64  `gorm:"column:user_org_id" json:"user_org_id"`
578
+	PatientId      int64  `gorm:"column:patient_id" json:"patient_id"`
579
+	PrescriptionId int64  `gorm:"column:prescription_id" json:"prescription_id"`
580
+	Stage          int64  `gorm:"column:stage" json:"stage"`
581
+	Remark         string `gorm:"column:remark" json:"remark"`
582
+	BedId          int64  `gorm:"column:bed_id" json:"bed_id"`
583
+	StartNurse     int64  `gorm:"column:start_nurse" json:"start_nurse"`
584
+	FinishNurse    int64  `gorm:"column:finish_nurse" json:"finish_nurse"`
585
+	Status         int64  `gorm:"column:status" json:"status"`
586
+	CreatedTime    int64  `gorm:"column:created_time" json:"created_time"`
587
+	UpdatedTime    int64  `gorm:"column:updated_time" json:"updated_time"`
588
+	StartTime      int64  `gorm:"column:start_time" json:"start_time"`
589
+	EndTime        int64  `gorm:"column:end_time" json:"end_time"`
590
+	PunctureNurse  int64  `gorm:"column:puncture_nurse" json:"puncture_nurse"`
591
+	Creator        int64  `gorm:"column:creator" json:"creator"`
592
+	Modifier       int64  `gorm:"column:modifier" json:"modifier"`
593
+	FinishCreator  int64  `gorm:"column:finish_creator" json:"finish_creator"`
594
+	FinishModifier int64  `gorm:"column:finish_modifier" json:"finish_modifier"`
595
+	DeviceNumber             DeviceNumber             `gorm:"ForeignKey:ID;AssociationForeignKey:BedId" json:"device"`
596
+	VMDialysisPrescription   VMDialysisPrescription   `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:DialysisDate,PatientID" json:"prescription"`
597
+	AssessmentBeforeDislysis AssessmentBeforeDislysis `gorm:"ForeignKey:AssessmentDate,PatientID;AssociationForeignKey:DialysisDate,PatientID" json:"before"`
598
+	AssessmentAfterDislysis  AssessmentAfterDislysis  `gorm:"ForeignKey:AssessmentDate,PatientID;AssociationForeignKey:DialysisDate,PatientID" json:"after"`
599
+	Schedule            	 Schedule            	  `gorm:"ForeignKey:ScheduleDate,PatientID;AssociationForeignKey:DialysisDate,PatientID" json:"schedule"`
600
+	MonitoringRecord         []MonitoringRecord       `gorm:"ForeignKey:MonitoringDate,PatientID;AssociationForeignKey:DialysisDate,PatientID" json:"monitor"`
601
+}
602
+
603
+func (VMDialysisOrder) TableName() string {
604
+	return "xt_dialysis_order"
605
+}
606
+
574 607
 type VMSchedule struct {
575 608
 	ID                       int64                    `gorm:"column:id" json:"id"`
576 609
 	UserOrgId                int64                    `gorm:"column:user_org_id" json:"user_org_id"`

+ 165 - 165
models/sz/target_data.go Datei anzeigen

@@ -198,28 +198,28 @@ func (TempHdOtherMachine) TableName() string {
198 198
 
199 199
 type TempHdPatient struct {
200 200
 	ID                int64     `gorm:"column:id" json:"id"`
201
-	HospitalId        string    `gorm:"column:hospital_id" json:"hospital_id"`
202
-	PatientNk         string    `gorm:"column:patient_nk" json:"patient_nk"`
203
-	CardNo            string    `gorm:"column:card_no" json:"card_no"`
204
-	CardType          string    `gorm:"column:card_type" json:"card_type"`
205
-	IdNo              string    `gorm:"column:id_no" json:"id_no"`
206
-	IdType            string    `gorm:"column:id_type" json:"id_type"`
207
-	PatientName       string    `gorm:"column:patient_name" json:"patient_name"`
208
-	Gender            string    `gorm:"column:gender" json:"gender"`
209
-	BornDate          time.Time `gorm:"column:born_date" json:"born_date"`
210
-	DiagnosisSummary  string    `gorm:"column:diagnosis_summary" json:"diagnosis_summary"`
211
-	IsCrf             string    `gorm:"column:is_crf" json:"is_crf"`
212
-	AllergyHistory    string    `gorm:"column:allergy_history" json:"allergy_history"`
213
-	PayMethod         string    `gorm:"column:pay_method" json:"pay_method"`
214
-	DialysisStartTime time.Time `gorm:"column:dialysis_start_time" json:"dialysis_start_time"`
215
-	LocalStartTime    time.Time `gorm:"column:local_start_time" json:"local_start_time"`
216
-	Xgbz              string    `gorm:"column:xgbz" json:"xgbz"`
217
-	CreatedTime       time.Time `gorm:"column:created_time" json:"created_time"`
218
-	UpdateTime        time.Time `gorm:"column:update_time" json:"update_time"`
219
-	Sjscsj            time.Time `gorm:"column:sjscsj" json:"sjscsj"`
220
-	Mj                string    `gorm:"column:mj" json:"mj"`
221
-	Ylyl1             string    `gorm:"column:ylyl1" json:"ylyl1"`
222
-	Ylyl2             string    `gorm:"column:ylyl2" json:"ylyl2"`
201
+	HospitalId        string    `gorm:"column:HOSPITAL_ID" json:"HOSPITAL_ID"`
202
+	PatientNk         string    `gorm:"column:PATIENT_NK" json:"PATIENT_NK"`
203
+	CardNo            string    `gorm:"column:CARD_NO" json:"CARD_NO"`
204
+	CardType          string    `gorm:"column:CARD_TYPE" json:"CARD_TYPE"`
205
+	IdNo              string    `gorm:"column:ID_NO" json:"ID_NO"`
206
+	IdType            string    `gorm:"column:ID_TYPE" json:"ID_TYPE"`
207
+	PatientName       string    `gorm:"column:PATIENT_NAME" json:"PATIENT_NAME"`
208
+	Gender            string    `gorm:"column:GENDER" json:"GENDER"`
209
+	BornDate          time.Time `gorm:"column:BORN_DATE" json:"BORN_DATE"`
210
+	DiagnosisSummary  string    `gorm:"column:DIAGNOSIS_SUMMARY" json:"DIAGNOSIS_SUMMARY"`
211
+	IsCrf             string    `gorm:"column:IS_CRF" json:"IS_CRF"`
212
+	AllergyHistory    string    `gorm:"column:ALLERGY_HISTORY" json:"ALLERGY_HISTORY"`
213
+	PayMethod         string    `gorm:"column:PAY_METHOD" json:"PAY_METHOD"`
214
+	DialysisStartTime time.Time `gorm:"column:DIALYSIS_START_TIME" json:"DIALYSIS_START_TIME"`
215
+	LocalStartTime    time.Time `gorm:"column:LOCAL_START_TIME" json:"LOCAL_START_TIME"`
216
+	Xgbz              string    `gorm:"column:XGBZ" json:"XGBZ"`
217
+	CreatedTime       time.Time `gorm:"column:CREATE_TIME" json:"CREATE_TIME"`
218
+	UpdateTime        time.Time `gorm:"column:UPDATE_TIME" json:"UPDATE_TIME"`
219
+	Sjscsj            time.Time `gorm:"column:SJSCSJ" json:"SJSCSJ"`
220
+	Mj                string    `gorm:"column:MJ" json:"MJ"`
221
+	Ylyl1             string    `gorm:"column:YLYL1" json:"YLYL1"`
222
+	Ylyl2             string    `gorm:"column:YLYL2" json:"YLYL2"`
223 223
 }
224 224
 
225 225
 func (TempHdPatient) TableName() string {
@@ -228,19 +228,19 @@ func (TempHdPatient) TableName() string {
228 228
 
229 229
 type TempHdPatientOut struct {
230 230
 	ID              int64     `gorm:"column:id" json:"id"`
231
-	Sn              string    `gorm:"column:sn" json:"sn"`
232
-	HospitalId      string    `gorm:"column:hospital_id" json:"hospital_id"`
233
-	PatientNk       string    `gorm:"column:patient_nk" json:"patient_nk"`
234
-	SequelaeDate    time.Time `gorm:"column:sequelae_date" json:"sequelae_date"`
235
-	SequelaeType    string    `gorm:"column:sequelae_type" json:"sequelae_type"`
236
-	SequelaeSubType string    `gorm:"column:sequelae_sub_type" json:"sequelae_sub_type"`
237
-	ExtReason       string    `gorm:"column:ext_reason" json:"ext_reason"`
238
-	CreateTime      time.Time `gorm:"column:create_time" json:"create_time"`
239
-	Sjscsj          time.Time `gorm:"column:sjscsj" json:"sjscsj"`
240
-	Mj              string    `gorm:"column:mj" json:"mj"`
241
-	Xgbz            int64     `gorm:"column:xgbz" json:"xgbz"`
242
-	Ylyl1           string    `gorm:"column:ylyl1" json:"ylyl1"`
243
-	Ylyl2           string    `gorm:"column:ylyl2" json:"ylyl2"`
231
+	Sn              string    `gorm:"column:SN" json:"SN"`
232
+	HospitalId      string    `gorm:"column:HOSPITAL_ID" json:"HOSPITAL_ID"`
233
+	PatientNk       string    `gorm:"column:PATIENT_NK" json:"PATIENT_NK"`
234
+	SequelaeDate    time.Time `gorm:"column:SEQUELAE_DATE" json:"SEQUELAE_DATE"`
235
+	SequelaeType    string    `gorm:"column:SEQUELAE_TYPE" json:"SEQUELAE_TYPE"`
236
+	SequelaeSubType string    `gorm:"column:SEQUELAE_SUB_TYPE" json:"SEQUELAE_SUB_TYPE"`
237
+	ExtReason       string    `gorm:"column:EXT_REASON" json:"EXT_REASON"`
238
+	CreateTime      time.Time `gorm:"column:CREATE_TIME" json:"CREATE_TIME"`
239
+	Sjscsj          time.Time `gorm:"column:SJSCSJ" json:"SJSCSJ"`
240
+	Mj              string    `gorm:"column:MJ" json:"MJ"`
241
+	Xgbz            int64     `gorm:"column:XGBZ" json:"XGBZ"`
242
+	Ylyl1           string    `gorm:"column:YLYL1" json:"YLYL1"`
243
+	Ylyl2           string    `gorm:"column:YLYL2" json:"YLYL2"`
244 244
 }
245 245
 
246 246
 func (TempHdPatientOut) TableName() string {
@@ -249,36 +249,36 @@ func (TempHdPatientOut) TableName() string {
249 249
 
250 250
 type TempHdPs struct {
251 251
 	ID                int64     `gorm:"column:id" json:"id"`
252
-	HospitalId        string    `gorm:"column:hospital_id" json:"hospital_id"`
253
-	PrescribeId       string    `gorm:"column:prescribe_id" json:"prescribe_id"`
254
-	PatientNk         string    `gorm:"column:patient_nk" json:"patient_nk"`
255
-	MedicalId         string    `gorm:"column:medical_id" json:"medical_id"`
256
-	DrId              string    `gorm:"column:dr_id" json:"dr_id"`
257
-	DialysisFrequency int64     `gorm:"column:dialysis_frequency" json:"dialysis_frequency"`
258
-	FrequencyUnit     int64     `gorm:"column:frequency_unit" json:"frequency_unit"`
259
-	DialysisDuration  float64   `gorm:"column:dialysis_duration" json:"dialysis_duration"`
260
-	Hdf               string    `gorm:"column:hdf" json:"hdf"`
261
-	HdfFrequencyUnit  int64     `gorm:"column:hdf_frequency_unit" json:"hdf_frequency_unit"`
262
-	HdfFrequency      int64     `gorm:"column:hdf_frequency" json:"hdf_frequency"`
263
-	HdfDuration       float64   `gorm:"column:hdf_duration" json:"hdf_duration"`
264
-	Hp                string    `gorm:"column:hp" json:"hp"`
265
-	HpFrequency       int64     `gorm:"column:hp_frequency" json:"hp_frequency"`
266
-	HpFrequencyUnit   int64     `gorm:"column:hp_frequency_unit" json:"hp_frequency_unit"`
267
-	HpDuration        float64   `gorm:"column:hp_duration" json:"hp_duration"`
268
-	K                 float64   `gorm:"column:k" json:"k"`
269
-	Ca                float64   `gorm:"column:ca" json:"ca"`
270
-	Na                float64   `gorm:"column:na" json:"na"`
271
-	Glucose           string    `gorm:"column:glucose" json:"glucose"`
272
-	FluxLevel         string    `gorm:"column:flux_level" json:"flux_level"`
273
-	FluxValue         string    `gorm:"column:flux_value" json:"flux_value"`
274
-	UseType           string    `gorm:"column:use_type" json:"use_type"`
275
-	PrescribeTime     time.Time `gorm:"column:prescribe_time" json:"prescribe_time"`
276
-	CreateTime        time.Time `gorm:"column:create_time" json:"create_time"`
277
-	Sjscsj            time.Time `gorm:"column:sjscsj" json:"sjscsj"`
278
-	Mj                string    `gorm:"column:mj" json:"mj"`
279
-	Xgbz              int64     `gorm:"column:xgbz" json:"xgbz"`
280
-	Ylyl1             string    `gorm:"column:ylyl1" json:"ylyl1"`
281
-	Ylyl2             string    `gorm:"column:ylyl2" json:"ylyl2"`
252
+	HospitalId        string    `gorm:"column:HOSPITAL_ID" json:"HOSPITAL_ID"`
253
+	PrescribeId       string    `gorm:"column:PRESCRIBE_ID" json:"PRESCRIBE_ID"`
254
+	PatientNk         string    `gorm:"column:PATIENT_NK" json:"PATIENT_NK"`
255
+	MedicalId         string    `gorm:"column:MEDICAL_ID" json:"MEDICAL_ID"`
256
+	DrId              string    `gorm:"column:DR_ID" json:"DR_ID"`
257
+	DialysisFrequency int64     `gorm:"column:DIALYSIS_FREQUENCY" json:"DIALYSIS_FREQUENCY"`
258
+	FrequencyUnit     int64     `gorm:"column:FREQUENCY_UNIT" json:"FREQUENCY_UNIT"`
259
+	DialysisDuration  float64   `gorm:"column:DIALYSIS_DURATION" json:"DIALYSIS_DURATION"`
260
+	Hdf               string    `gorm:"column:HDF" json:"HDF"`
261
+	HdfFrequencyUnit  int64     `gorm:"column:HDF_FREQUENCY_UNIT" json:"HDF_FREQUENCY_UNIT"`
262
+	HdfFrequency      int64     `gorm:"column:HDF_FREQUENCY" json:"HDF_FREQUENCY"`
263
+	HdfDuration       float64   `gorm:"column:HDF_DURATION" json:"HDF_DURATION"`
264
+	Hp                string    `gorm:"column:HP" json:"HP"`
265
+	HpFrequency       int64     `gorm:"column:HP_FREQUENCY" json:"HP_FREQUENCY"`
266
+	HpFrequencyUnit   int64     `gorm:"column:HP_FREQUENCY_UNIT" json:"HP_FREQUENCY_UNIT"`
267
+	HpDuration        float64   `gorm:"column:HP_DURATION" json:"HP_DURATION"`
268
+	K                 float64   `gorm:"column:K" json:"K"`
269
+	Ca                float64   `gorm:"column:CA" json:"CA"`
270
+	Na                float64   `gorm:"column:NA" json:"NA"`
271
+	Glucose           string    `gorm:"column:GLUCOSE" json:"GLUCOSE"`
272
+	FluxLevel         string    `gorm:"column:FLUX_LEVEL" json:"FLUX_LEVEL"`
273
+	FluxValue         string    `gorm:"column:FLUX_VALUE" json:"FLUX_VALUE"`
274
+	UseType           string    `gorm:"column:USE_TYPE" json:"USE_TYPE"`
275
+	PrescribeTime     time.Time `gorm:"column:PRESCRIBE_TIME" json:"PRESCRIBE_TIME"`
276
+	CreateTime        time.Time `gorm:"column:CREATE_TIME" json:"CREATE_TIME"`
277
+	Sjscsj            time.Time `gorm:"column:SJSCSJ" json:"SJSCSJ"`
278
+	Mj                string    `gorm:"column:MJ" json:"MJ"`
279
+	Xgbz              int64     `gorm:"column:XGBZ" json:"XGBZ"`
280
+	Ylyl1             string    `gorm:"column:YLYL1" json:"YLYL1"`
281
+	Ylyl2             string    `gorm:"column:YLYL2" json:"YLYL2"`
282 282
 }
283 283
 
284 284
 func (TempHdPs) TableName() string {
@@ -287,17 +287,17 @@ func (TempHdPs) TableName() string {
287 287
 
288 288
 type TempHdPsMedicine struct {
289 289
 	ID             int64     `gorm:"column:id" json:"id"`
290
-	Sn             string    `gorm:"column:sn" json:"sn"`
291
-	PrescribeId    string    `gorm:"column:prescribe_id" json:"prescribe_id"`
292
-	HospitalId     string    `gorm:"column:hospital_id" json:"hospital_id"`
293
-	MedicineTypeId string    `gorm:"column:medicine_type_id" json:"medicine_type_id"`
294
-	MedicineId     string    `gorm:"column:medicine_id" json:"medicine_id"`
295
-	CreatedTime    time.Time `gorm:"column:created_time" json:"created_time"`
296
-	Sjscsj         time.Time `gorm:"column:sjscsj" json:"sjscsj"`
297
-	Mj             string    `gorm:"column:mj" json:"mj"`
298
-	Xgbz           int64     `gorm:"column:xgbz" json:"xgbz"`
299
-	Ylyl1          string    `gorm:"column:ylyl1" json:"ylyl1"`
300
-	Ylyl2          string    `gorm:"column:ylyl2" json:"ylyl2"`
290
+	Sn             string    `gorm:"column:SN" json:"SN"`
291
+	PrescribeId    string    `gorm:"column:PRESCRIBE_ID" json:"PRESCRIBE_ID"`
292
+	HospitalId     string    `gorm:"column:HOSPITAL_ID" json:"HOSPITAL_ID"`
293
+	MedicineTypeId string    `gorm:"column:MEDICINE_TYPE_ID" json:"MEDICINE_TYPE_ID"`
294
+	MedicineId     string    `gorm:"column:MEDICINE_ID" json:"MEDICINE_ID"`
295
+	CreatedTime    time.Time `gorm:"column:CREATE_TIME" json:"CREATE_TIME"`
296
+	Sjscsj         time.Time `gorm:"column:SJSCSJ" json:"SJSCSJ"`
297
+	Mj             string    `gorm:"column:MJ" json:"MJ"`
298
+	Xgbz           int64     `gorm:"column:XGBZ" json:"XGBZ"`
299
+	Ylyl1          string    `gorm:"column:YLYL1" json:"YLYL1"`
300
+	Ylyl2          string    `gorm:"column:YLYL2" json:"YLYL2"`
301 301
 }
302 302
 
303 303
 func (TempHdPsMedicine) TableName() string {
@@ -396,7 +396,7 @@ type DataUploadConfig struct {
396 396
 	ModifyTime     int64  `gorm:"column:modify_time" json:"modify_time"`
397 397
 	TimeQuantum    int64  `gorm:"column:time_quantum" json:"time_quantum"`
398 398
 	DepartmentName string `gorm:"column:department_name" json:"department_name"`
399
-	HospitalId     int64  `gorm:"column:hospital_id" json:"hospital_id"`
399
+	HospitalId     string `gorm:"column:hospital_id" json:"hospital_id"`
400 400
 	InstType       int64  `gorm:"column:inst_type" json:"inst_type"`
401 401
 	DbHost         string `gorm:"column:db_host" json:"db_host"`
402 402
 	DbPort         string `gorm:"column:db_port" json:"db_port"`
@@ -411,19 +411,19 @@ func (DataUploadConfig) TableName() string {
411 411
 
412 412
 type TempHdShift struct {
413 413
 	ID             int64     `gorm:"column:id" json:"id"`
414
-	PsId           string    `gorm:"column:ps_id" json:"ps_id"`
415
-	HospitalId     string    `gorm:"column:hospital_id" json:"hospital_id"`
416
-	PatientNk      string    `gorm:"column:patient_nk" json:"patient_nk"`
417
-	ScheduleDate   time.Time `gorm:"column:schedule_date" json:"schedule_date"`
418
-	ShiftType      string    `gorm:"column:shift_type" json:"shift_type"`
419
-	SickbedNo      string    `gorm:"column:sickbed_no" json:"sickbed_no"`
420
-	ScheduleStatus string    `gorm:"column:schedule_status" json:"schedule_status"`
421
-	CreateTime     time.Time `gorm:"column:create_time" json:"create_time"`
422
-	Sjscsj         time.Time `gorm:"column:sjscsj" json:"sjscsj"`
423
-	Mj             string    `gorm:"column:mj" json:"mj"`
424
-	Xgbz           int64     `gorm:"column:xgbz" json:"xgbz"`
425
-	Ylyl1          string    `gorm:"column:ylyl1" json:"ylyl1"`
426
-	Ylyl2          string    `gorm:"column:ylyl2" json:"ylyl2"`
414
+	PsId           string    `gorm:"column:PS_ID" json:"PS_ID"`
415
+	HospitalId     string    `gorm:"column:HOSPITAL_ID" json:"HOSPITAL_ID"`
416
+	PatientNk      string    `gorm:"column:PATIENT_NK" json:"PATIENT_NK"`
417
+	ScheduleDate   time.Time `gorm:"column:SCHEDULE_DATE" json:"SCHEDULE_DATE"`
418
+	ShiftType      string    `gorm:"column:SHIFT_TYPE" json:"SHIFT_TYPE"`
419
+	SickbedNo      string    `gorm:"column:SICKBED_NO" json:"SICKBED_NO"`
420
+	ScheduleStatus string    `gorm:"column:SCHEDULE_STATUS" json:"SCHEDULE_STATUS"`
421
+	CreateTime     time.Time `gorm:"column:CREATE_TIME" json:"CREATE_TIME"`
422
+	Sjscsj         time.Time `gorm:"column:SJSCSJ" json:"SJSCSJ"`
423
+	Mj             string    `gorm:"column:MJ" json:"MJ"`
424
+	Xgbz           int64     `gorm:"column:XGBZ" json:"XGBZ"`
425
+	Ylyl1          string    `gorm:"column:YLYL1" json:"YLYL1"`
426
+	Ylyl2          string    `gorm:"column:YLYL2" json:"YLYL2"`
427 427
 }
428 428
 
429 429
 func (TempHdShift) TableName() string {
@@ -432,21 +432,21 @@ func (TempHdShift) TableName() string {
432 432
 
433 433
 type TempHdDoctorsAdvice struct {
434 434
 	ID               int64     `gorm:"column:id" json:"id"`
435
-	MedicalOrDerId   string    `gorm:"column:medical_or_der_id" json:"medical_or_der_id"`
436
-	HospitalId       string    `gorm:"column:hospital_id" json:"hospital_id"`
437
-	DialysisId       string    `gorm:"column:dialysis_id" json:"dialysis_id"`
438
-	OrderType        string    `gorm:"column:order_type" json:"order_type"`
439
-	RrtType          string    `gorm:"column:rrt_type" json:"rrt_type"`
440
-	PatientNk        string    `gorm:"column:patient_nk" json:"patient_nk"`
441
-	DialysisDuration int64     `gorm:"column:dialysis_duration" json:"dialysis_duration"`
442
-	BloodVol         int64     `gorm:"column:blood_vol" json:"blood_vol"`
443
-	DryWeigh         float64   `gorm:"column:dry_weigh" json:"dry_weigh"`
444
-	CreateTime       time.Time `gorm:"column:create_time" json:"create_time"`
445
-	Sjscsj           time.Time `gorm:"column:sjscsj" json:"sjscsj"`
446
-	Mj               string    `gorm:"column:mj" json:"mj"`
447
-	Xgbz             int64     `gorm:"column:xgbz" json:"xgbz"`
448
-	Ylyl1            string    `gorm:"column:ylyl1" json:"ylyl1"`
449
-	Ylyl2            string    `gorm:"column:ylyl2" json:"ylyl2"`
435
+	MedicalOrDerId   string    `gorm:"column:MEDICAL_ORDER_ID" json:"MEDICAL_ORDER_ID"`
436
+	HospitalId       string    `gorm:"column:HOSPITAL_ID" json:"HOSPITAL_ID"`
437
+	DialysisId       string    `gorm:"column:DIALYSIS_ID" json:"DIALYSIS_ID"`
438
+	OrderType        string    `gorm:"column:ORDER_TYPE" json:"ORDER_TYPE"`
439
+	RrtType          string    `gorm:"column:RRT_TYPE" json:"RRT_TYPE"`
440
+	PatientNk        string    `gorm:"column:PATIENT_NK" json:"PATIENT_NK"`
441
+	DialysisDuration int64     `gorm:"column:DIALYSIS_DURATION" json:"DIALYSIS_DURATION"`
442
+	BloodVol         int64     `gorm:"column:BLOOD_VOL" json:"BLOOD_VOL"`
443
+	DryWeigh         float64   `gorm:"column:DRY_WEIGHT" json:"DRY_WEIGHT"`
444
+	CreateTime       time.Time `gorm:"column:CREATE_TIME" json:"CREATE_TIME"`
445
+	Sjscsj           time.Time `gorm:"column:SJSCSJ" json:"SJSCSJ"`
446
+	Mj               string    `gorm:"column:MJ" json:"MJ"`
447
+	Xgbz             int64     `gorm:"column:XGBZ" json:"XGBZ"`
448
+	Ylyl1            string    `gorm:"column:YLYL1" json:"YLYL1"`
449
+	Ylyl2            string    `gorm:"column:YLYL2" json:"YLYL2"`
450 450
 }
451 451
 
452 452
 func (TempHdDoctorsAdvice) TableName() string {
@@ -455,40 +455,40 @@ func (TempHdDoctorsAdvice) TableName() string {
455 455
 
456 456
 type TempHdDialysis struct {
457 457
 	ID                    int64     `gorm:"column:id" json:"id"`
458
-	DialysisId            string    `gorm:"column:dialysis_id" json:"dialysis_id"`
459
-	HospitalId            string    `gorm:"column:hospital_id" json:"hospital_id"`
460
-	PatientNk             string    `gorm:"column:patient_nk" json:"patient_nk"`
461
-	PsId                  string    `gorm:"column:ps_id" json:"ps_id"`
462
-	DialysisDate          time.Time `gorm:"column:dialysis_date" json:"dialysis_date"`
463
-	SickbedNo             string    `gorm:"column:sickbed_no" json:"sickbed_no"`
464
-	DivisionId            string    `gorm:"column:division_id" json:"division_id"`
465
-	EquipmentId           string    `gorm:"column:equipment_id" json:"equipment_id"`
466
-	MixDalysis            string    `gorm:"column:mix_dalysis" json:"mix_dalysis"`
467
-	ActualufMl            int64     `gorm:"column:actualuf_ml" json:"actualuf_ml"`
468
-	Ufv                   int64     `gorm:"column:ufv" json:"ufv"`
469
-	TotalReplace          int64     `gorm:"column:total_replace" json:"total_replace"`
470
-	TotalTreatDuration    int64     `gorm:"column:total_treat_duration" json:"total_treat_duration"`
471
-	IsHospitalozation     string    `gorm:"column:is_hospitalozation" json:"is_hospitalozation"`
472
-	IsEmergency           string    `gorm:"column:is_emergency" json:"is_emergency"`
473
-	EmergencyReason       string    `gorm:"column:emergency_reason" json:"emergency_reason"`
474
-	IsPerioperativePeriod string    `gorm:"column:is_perioperative_period" json:"is_perioperative_period"`
475
-	BeforeSbp             int64     `gorm:"column:before_sbp" json:"before_sbp"`
476
-	BeforeDbp             int64     `gorm:"column:before_dbp" json:"before_dbp"`
477
-	AfterSbp              int64     `gorm:"column:after_sbp" json:"after_sbp"`
478
-	AfterDbp              int64     `gorm:"column:after_dbp" json:"after_dbp"`
479
-	BeforeWeight          float64   `gorm:"column:before_weight" json:"before_weight"`
480
-	AfterWeight           float64   `gorm:"column:after_weight" json:"after_weight"`
481
-	AccessId              string    `gorm:"column:access_id" json:"access_id"`
482
-	DialyzerId            string    `gorm:"column:dialyzer_id" json:"dialyzer_id"`
483
-	Ktv                   float64   `gorm:"column:ktv" json:"ktv"`
484
-	StartTime             time.Time `gorm:"column:start_time" json:"start_time"`
485
-	EndTime               time.Time `gorm:"column:end_time" json:"end_time"`
486
-	CreateTime            time.Time `gorm:"column:create_time" json:"create_time"`
487
-	Sjscsj                time.Time `gorm:"column:sjscsj" json:"sjscsj"`
488
-	Mj                    string    `gorm:"column:mj" json:"mj"`
489
-	Xgbz                  int64     `gorm:"column:xgbz" json:"xgbz"`
490
-	Ylyl1                 string    `gorm:"column:ylyl1" json:"ylyl1"`
491
-	Ylyl2                 string    `gorm:"column:ylyl2" json:"ylyl2"`
458
+	DialysisId            string    `gorm:"column:DIALYSIS_ID" json:"DIALYSIS_ID"`
459
+	HospitalId            string    `gorm:"column:HOSPITAL_ID" json:"HOSPITAL_ID"`
460
+	PatientNk             string    `gorm:"column:PATIENT_NK" json:"PATIENT_NK"`
461
+	PsId                  string    `gorm:"column:PS_ID" json:"PS_ID"`
462
+	DialysisDate          time.Time `gorm:"column:DIALYSIS_DATE" json:"DIALYSIS_DATE"`
463
+	SickbedNo             string    `gorm:"column:SICKBED_NO" json:"SICKBED_NO"`
464
+	DivisionId            string    `gorm:"column:DIVISION_ID" json:"DIVISION_ID"`
465
+	EquipmentId           string    `gorm:"column:EQUIPMENT_ID" json:"EQUIPMENT_ID"`
466
+	MixDalysis            string    `gorm:"column:MIX_DIALYSIS" json:"MIX_DIALYSIS"`
467
+	ActualufMl            int64     `gorm:"column:ACTUALUF_ML" json:"ACTUALUF_ML"`
468
+	Ufv                   int64     `gorm:"column:UFV" json:"UFV"`
469
+	TotalReplace          int64     `gorm:"column:TOTAL_REPLACE" json:"TOTAL_REPLACE"`
470
+	TotalTreatDuration    int64     `gorm:"column:TOTAL_TREAT_DURATION" json:"TOTAL_TREAT_DURATION"`
471
+	IsHospitalozation     string    `gorm:"column:IS_HOSPITALIZATION" json:"IS_HOSPITALIZATION"`
472
+	IsEmergency           string    `gorm:"column:IS_EMERGENCY" json:"IS_EMERGENCY"`
473
+	EmergencyReason       string    `gorm:"column:EMERGENCY_REASON" json:"EMERGENCY_REASON"`
474
+	IsPerioperativePeriod string    `gorm:"column:IS_PERIOPERATIVE_PERIOD" json:"IS_PERIOPERATIVE_PERIOD"`
475
+	BeforeSbp             int64     `gorm:"column:BEFORE_SBP" json:"BEFORE_SBP"`
476
+	BeforeDbp             int64     `gorm:"column:BEFORE_DBP" json:"BEFORE_DBP"`
477
+	AfterSbp              int64     `gorm:"column:AFTER_SBP" json:"AFTER_SBP"`
478
+	AfterDbp              int64     `gorm:"column:AFTER_DBP" json:"AFTER_DBP"`
479
+	BeforeWeight          float64   `gorm:"column:BEFORE_WEIGHT" json:"BEFORE_WEIGHT"`
480
+	AfterWeight           float64   `gorm:"column:AFTER_WEIGHT" json:"AFTER_WEIGHT"`
481
+	AccessId              string    `gorm:"column:ACCESS_ID" json:"ACCESS_ID"`
482
+	DialyzerId            string    `gorm:"column:DIALYZER_ID" json:"DIALYZER_ID"`
483
+	Ktv                   float64   `gorm:"column:KTV" json:"KTV"`
484
+	StartTime             time.Time `gorm:"column:START_TIME" json:"START_TIME"`
485
+	EndTime               time.Time `gorm:"column:END_TIME" json:"END_TIME"`
486
+	CreateTime            time.Time `gorm:"column:CREATE_TIME" json:"CREATE_TIME"`
487
+	Sjscsj                time.Time `gorm:"column:SJSCSJ" json:"SJSCSJ"`
488
+	Mj                    string    `gorm:"column:MJ" json:"MJ"`
489
+	Xgbz                  int64     `gorm:"column:XGBZ" json:"XGBZ"`
490
+	Ylyl1                 string    `gorm:"column:YLYL1" json:"YLYL1"`
491
+	Ylyl2                 string    `gorm:"column:YLYL2" json:"YLYL2"`
492 492
 }
493 493
 
494 494
 func (TempHdDialysis) TableName() string {
@@ -497,32 +497,32 @@ func (TempHdDialysis) TableName() string {
497 497
 
498 498
 type TempHdMiddle struct {
499 499
 	ID             int64     `gorm:"column:id" json:"id"`
500
-	Sn             string    `gorm:"column:sn" json:"sn"`
501
-	HospitalId     string    `gorm:"column:hospital_id" json:"hospital_id"`
502
-	PatientNk      string    `gorm:"column:patient_nk" json:"patient_nk"`
503
-	DialysisId     string    `gorm:"column:dialysis_id" json:"dialysis_id"`
504
-	MonitorTime    time.Time `gorm:"column:monitor_time" json:"monitor_time"`
505
-	Sbp            int64     `gorm:"column:sbp" json:"sbp"`
506
-	Dbp            int64     `gorm:"column:dbp" json:"dbp"`
507
-	P              int64     `gorm:"column:p" json:"p"`
508
-	Ns             int64     `gorm:"column:ns" json:"ns"`
509
-	Qb             int64     `gorm:"column:qb" json:"qb"`
510
-	Ap             int64     `gorm:"column:ap" json:"ap"`
511
-	Vp             int64     `gorm:"column:vp" json:"vp"`
512
-	Tmp            int64     `gorm:"column:tmp" json:"tmp"`
513
-	Ufr            int64     `gorm:"column:ufr" json:"ufr"`
514
-	Ufv            int64     `gorm:"column:ufv" json:"ufv"`
515
-	OnLine         int64     `gorm:"column:on_line" json:"on_line"`
516
-	Spo2           float64   `gorm:"column:spo2" json:"spo2"`
517
-	R              int64     `gorm:"column:r" json:"r"`
518
-	OtherSituation string    `gorm:"column:other_situation" json:"other_situation"`
519
-	Nurse          string    `gorm:"column:nurse" json:"nurse"`
520
-	CreateTime     time.Time `gorm:"column:create_time" json:"create_time"`
521
-	Sjscsj         time.Time `gorm:"column:sjscsj" json:"sjscsj"`
522
-	Mj             string    `gorm:"column:mj" json:"mj"`
523
-	Xgbz           int64     `gorm:"column:xgbz" json:"xgbz"`
524
-	Ylyl1          string    `gorm:"column:ylyl1" json:"ylyl1"`
525
-	Ylyl2          string    `gorm:"column:ylyl2" json:"ylyl2"`
500
+	Sn             string    `gorm:"column:SN" json:"SN"`
501
+	HospitalId     string    `gorm:"column:HOSPITAL_ID" json:"HOSPITAL_ID"`
502
+	PatientNk      string    `gorm:"column:PATIENT_NK" json:"PATIENT_NK"`
503
+	DialysisId     string    `gorm:"column:DIALYSIS_ID" json:"DIALYSIS_ID"`
504
+	MonitorTime    time.Time `gorm:"column:MONITOR_TIME" json:"MONITOR_TIME"`
505
+	Sbp            int64     `gorm:"column:SBP" json:"SBP"`
506
+	Dbp            int64     `gorm:"column:DBP" json:"DBP"`
507
+	P              int64     `gorm:"column:P" json:"P"`
508
+	Ns             int64     `gorm:"column:NS" json:"NS"`
509
+	Qb             int64     `gorm:"column:QB" json:"QB"`
510
+	Ap             int64     `gorm:"column:AP" json:"AP"`
511
+	Vp             int64     `gorm:"column:VP" json:"VP"`
512
+	Tmp            int64     `gorm:"column:TMP" json:"TMP"`
513
+	Ufr            int64     `gorm:"column:UFR" json:"UFR"`
514
+	Ufv            int64     `gorm:"column:UFV" json:"UFV"`
515
+	OnLine         int64     `gorm:"column:ON_LINE" json:"ON_LINE"`
516
+	Spo2           float64   `gorm:"column:SPO2" json:"SPO2"`
517
+	R              int64     `gorm:"column:R" json:"R"`
518
+	OtherSituation string    `gorm:"column:OTHER_SITUATION" json:"OTHER_SITUATION"`
519
+	Nurse          string    `gorm:"column:NURSE" json:"NURSE"`
520
+	CreateTime     time.Time `gorm:"column:CREATE_TIME" json:"CREATE_TIME"`
521
+	Sjscsj         time.Time `gorm:"column:SJSCSJ" json:"SJSCSJ"`
522
+	Mj             string    `gorm:"column:MJ" json:"MJ"`
523
+	Xgbz           int64     `gorm:"column:XGBZ" json:"XGBZ"`
524
+	Ylyl1          string    `gorm:"column:YLYL1" json:"YLYL1"`
525
+	Ylyl2          string    `gorm:"column:YLYL2" json:"YLYL2"`
526 526
 }
527 527
 
528 528
 func (TempHdMiddle) TableName() string {

+ 2 - 0
routers/router.go Datei anzeigen

@@ -3,6 +3,7 @@ package routers
3 3
 import (
4 4
 	admin_api "Data_Upload_Api/controllers/admin_api_controllers"
5 5
 	"github.com/astaxie/beego"
6
+	"Data_Upload_Api/controllers"
6 7
 	"github.com/astaxie/beego/plugins/cors"
7 8
 )
8 9
 
@@ -19,4 +20,5 @@ func init() {
19 20
 	// beego.Router("/", &controllers.MainController{})
20 21
 
21 22
 	admin_api.AdminAPIControllersRegisterRouters()
23
+	controllers.SyncAPIRegisterRouters()
22 24
 }

+ 57 - 13
service/city_data_uoload_service.go Datei anzeigen

@@ -33,7 +33,7 @@ func FindOrgData(org_id int64, sync_time int64) (org models.UserOrg, err error)
33 33
 }
34 34
 func FindOrgRolesData(org_id int64, lastUploadTime int64, nowTime int64) (role []*models.UserAdminRole, err error) {
35 35
 	db := readUserDb.Model(&models.UserAdminRole{}).Where("status = 1 AND org_id = ?  ", org_id)
36
-	db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
36
+	db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
37 37
 	err = db.Find(&role).Error
38 38
 	return
39 39
 }
@@ -78,8 +78,8 @@ func FindOrgMonitorRecordData(org_id int64, lastUploadTime int64, nowTime int64)
78 78
 	return
79 79
 }
80 80
 
81
-func CreateOrgRecord(hospital *sz.TempHdHospital) (err error) {
82
-	err = writeDb.Model(&sz.TempHdHospital{}).Create(&hospital).Error
81
+func CreateOrgRecord(rdb *gorm.DB, hospital *sz.TempHdHospital) (err error) {
82
+	err = rdb.Model(&sz.TempHdHospital{}).Create(&hospital).Error
83 83
 	return
84 84
 }
85 85
 
@@ -88,17 +88,17 @@ func CreateUploadRecord(upload *sz.DataUpload) (err error) {
88 88
 	return
89 89
 }
90 90
 
91
-func FindOrgDialysisData(org_id int64, lastUploadTime int64, nowTime int64) (ps []*models.VMSchedule, err error) {
92
-	db := readDb.Model(&models.VMSchedule{}).Where("status = 1 AND user_org_id = ? ", org_id).
91
+func FindOrgDialysisData(org_id int64, lastUploadTime int64, nowTime int64) (ps []*models.VMDialysisOrder, err error) {
92
+	db := readDb.Model(&models.VMDialysisOrder{}).Where("status = 1 AND user_org_id = ? AND stage = 2 ", org_id).
93 93
 		Preload("DeviceNumber", "status = 1").
94 94
 		Preload("VMDialysisPrescription", "status = 1").
95 95
 		Preload("AssessmentBeforeDislysis", "status = 1").
96 96
 		Preload("AssessmentAfterDislysis", "status = 1").
97
-		Preload("DialysisOrder", "status = 1").
97
+		Preload("Schedule", "status = 1").
98 98
 		Preload("MonitoringRecord", "status = 1")
99 99
 
100 100
 	if lastUploadTime != 0 && nowTime != 0 {
101
-		db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
101
+		db = db.Where("updated_time >= ? AND updated_time <= ?", lastUploadTime, nowTime)
102 102
 	}
103 103
 	err = db.Find(&ps).Error
104 104
 	return
@@ -264,7 +264,7 @@ func BatchCreatePs(patients []*sz.TempHdPs, rdb *gorm.DB) (err error) {
264 264
 	if len(patients) > 0 {
265 265
 		utx := rdb.Begin()
266 266
 		if len(patients) > 0 {
267
-			thisSQL := "INSERT INTO t_hd_shift (PRESCRIBE_ID, HOSPITAL_ID, PATIENT_NK, K, CA,NA,DIALYSIS_FREQUENCY,FREQUENCY_UNIT,DIALYSIS_DURATION,HDF,HP,HP_FREQUENCY,HP_FREQUENCY_UNIT,HP_DURATION,HDF_FREQUENCY_UNIT,HDF_FREQUENCY,HDF_DURATION,CREATE_TIME,SJSCSJ,XGBZ) VALUES "
267
+			thisSQL := "INSERT INTO t_hd_ps (PRESCRIBE_ID, HOSPITAL_ID, PATIENT_NK, K, CA,NA,DIALYSIS_FREQUENCY,FREQUENCY_UNIT,DIALYSIS_DURATION,HDF,HP,HP_FREQUENCY,HP_FREQUENCY_UNIT,HP_DURATION,HDF_FREQUENCY_UNIT,HDF_FREQUENCY,HDF_DURATION,CREATE_TIME,SJSCSJ,XGBZ) VALUES "
268 268
 			insertParams := make([]string, 0)
269 269
 			insertData := make([]interface{}, 0)
270 270
 			for _, info := range patients {
@@ -307,7 +307,7 @@ func BatchCreatePsm(psms []*sz.TempHdPsMedicine, rdb *gorm.DB) (err error) {
307 307
 	if len(psms) > 0 {
308 308
 		utx := rdb.Begin()
309 309
 		if len(psms) > 0 {
310
-			thisSQL := "INSERT INTO t_hd_shift (PRESCRIBE_ID, HOSPITAL_ID, MEDICINE_TYPE_ID,MEDICINE_ID,CREATE_TIME,SJSCSJ,XGBZ) VALUES "
310
+			thisSQL := "INSERT INTO t_hd_ps_medicine (PRESCRIBE_ID, HOSPITAL_ID, MEDICINE_TYPE_ID,MEDICINE_ID,CREATE_TIME,SJSCSJ,XGBZ) VALUES "
311 311
 			insertParams := make([]string, 0)
312 312
 			insertData := make([]interface{}, 0)
313 313
 			for _, psm := range psms {
@@ -333,6 +333,50 @@ func BatchCreatePsm(psms []*sz.TempHdPsMedicine, rdb *gorm.DB) (err error) {
333 333
 	return
334 334
 }
335 335
 
336
+func BatchCreateDialysis(psms []*sz.TempHdDialysis, rdb *gorm.DB) (err error) {
337
+	if len(psms) > 0 {
338
+		utx := rdb.Begin()
339
+		if len(psms) > 0 {
340
+			thisSQL := "INSERT INTO t_hd_dialysis (DIALYSIS_ID, HOSPITAL_ID, PATIENT_NK,PS_ID,DIALYSIS_DATE,SICKBED_NO,DIVISION_ID,EQUIPMENT_ID,ACTUALUF_ML,UFV,TOTAL_REPLACE,TOTAL_TREAT_DURATION,BEFORE_SBP,BEFORE_DBP,AFTER_SBP,AFTER_DBP,START_TIME,END_TIME,CREATE_TIME,SJSCSJ,XGBZ) VALUES "
341
+			insertParams := make([]string, 0)
342
+			insertData := make([]interface{}, 0)
343
+			for _, psm := range psms {
344
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
345
+				insertData = append(insertData, psm.DialysisId)
346
+				insertData = append(insertData, psm.HospitalId)
347
+				insertData = append(insertData, psm.PatientNk)
348
+				insertData = append(insertData, psm.PsId)
349
+				insertData = append(insertData, psm.DialysisDate)
350
+				insertData = append(insertData, psm.SickbedNo)
351
+				insertData = append(insertData, psm.DivisionId)
352
+				insertData = append(insertData, psm.EquipmentId)
353
+				insertData = append(insertData, psm.ActualufMl)
354
+				insertData = append(insertData, psm.Ufv)
355
+				insertData = append(insertData, psm.TotalReplace)
356
+				insertData = append(insertData, psm.TotalTreatDuration)
357
+				insertData = append(insertData, psm.BeforeSbp)
358
+				insertData = append(insertData, psm.BeforeDbp)
359
+				insertData = append(insertData, psm.AfterSbp)
360
+				insertData = append(insertData, psm.AfterDbp)
361
+				insertData = append(insertData, psm.StartTime)
362
+				insertData = append(insertData, psm.EndTime)
363
+				insertData = append(insertData, psm.CreateTime)
364
+				insertData = append(insertData, psm.Sjscsj)
365
+				insertData = append(insertData, psm.Xgbz)
366
+
367
+			}
368
+			thisSQL += strings.Join(insertParams, ", ")
369
+			err = utx.Exec(thisSQL, insertData...).Error
370
+			if err != nil {
371
+				utx.Rollback()
372
+				return
373
+			}
374
+		}
375
+		utx.Commit()
376
+	}
377
+	return
378
+}
379
+
336 380
 func BatchCreatePatientOut(patientOuts []*sz.TempHdPatientOut, rdb *gorm.DB) (err error) {
337 381
 	if len(patientOuts) > 0 {
338 382
 		utx := rdb.Begin()
@@ -400,11 +444,11 @@ func BatchCreateMonitor(advices []*sz.TempHdMiddle, rdb *gorm.DB) (err error) {
400 444
 	if len(advices) > 0 {
401 445
 		utx := rdb.Begin()
402 446
 		if len(advices) > 0 {
403
-			thisSQL := "INSERT INTO t_hd_doctors_advice (HOSPITAL_ID, PATIENT_NK,DIALYSIS_ID,MONITOR_TIME,SBP,DBP,CREATE_TIME,SJSCSJ,XGBZ) VALUES "
447
+			thisSQL := "INSERT INTO t_hd_middle (HOSPITAL_ID, PATIENT_NK,DIALYSIS_ID,MONITOR_TIME,SBP,DBP,CREATE_TIME,SJSCSJ,XGBZ) VALUES "
404 448
 			insertParams := make([]string, 0)
405 449
 			insertData := make([]interface{}, 0)
406 450
 			for _, advice := range advices {
407
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
451
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?)")
408 452
 				insertData = append(insertData, advice.HospitalId)
409 453
 				insertData = append(insertData, advice.PatientNk)
410 454
 				insertData = append(insertData, advice.DialysisId)
@@ -449,11 +493,11 @@ func BatchCreateOtherMachineRecord(wms []*sz.TempHdOtherMachine, rdb *gorm.DB) (
449 493
 	if len(wms) > 0 {
450 494
 		utx := rdb.Begin()
451 495
 		if len(wms) > 0 {
452
-			thisSQL := "INSERT INTO t_hd_wm (HOSPITAL_ID, EQUIPMENT_ID, EQUIPMENT_BRAND, EQUIPMENT_MODEL, ENABLE_TIME,DISCARDED_TIME,XGBZ,CREATE_TIME,UPDATE_TIME,SJSCSJ) VALUES "
496
+			thisSQL := "INSERT INTO t_hd_other_machine (HOSPITAL_ID, EQUIPMENT_ID, EQUIPMENT_BRAND, EQUIPMENT_MODEL, ENABLE_TIME,DISCARDED_TIME,XGBZ,CREATE_TIME,UPDATE_TIME,SJSCSJ) VALUES "
453 497
 			insertParams := make([]string, 0)
454 498
 			insertData := make([]interface{}, 0)
455 499
 			for _, wm := range wms {
456
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
500
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
457 501
 				insertData = append(insertData, wm.HospitalId)
458 502
 				insertData = append(insertData, wm.EquipmentId)
459 503
 				insertData = append(insertData, wm.EquipmentBrand)