Kaynağa Gözat

龙岗二院质控开发

XMLWAN 3 yıl önce
ebeveyn
işleme
bf5a87da39

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1125 - 446
service/city/auto_create_week_schedules_service.go


+ 455 - 57
service/city_data_uoload_service.go Dosyayı Görüntüle

@@ -98,7 +98,7 @@ func FindOrgDoctorAdviceTemplateData(org_id int64, lastUploadTime int64, nowTime
98 98
 }
99 99
 
100 100
 func FindAssessmentBeforeDislysis(org_id int64, patient_id int64) (before models.AssessmentBeforeDislysis, err error) {
101
-	db := readDb.Model(&models.AssessmentBeforeDislysis{}).Where("status = 1 AND user_org_id = ? and patient_id = ? ", org_id,patient_id)
101
+	db := readDb.Model(&models.AssessmentBeforeDislysis{}).Where("status = 1 AND user_org_id = ? and patient_id = ? ", org_id, patient_id)
102 102
 	err = db.Last(&before).Error
103 103
 	return
104 104
 }
@@ -111,13 +111,13 @@ func FindOrgMonitorRecordData(org_id int64, lastUploadTime int64, nowTime int64)
111 111
 }
112 112
 
113 113
 func FindOrgMonitorRecordByLike(org_id int64, keyword string, lastUploadTime int64, nowTime int64) (monitor []*models.MonitoringRecord, err error) {
114
-	db := readDb.Model(&models.MonitoringRecord{}).Where("status = 1 AND user_org_id = ? AND symptom like ?", org_id,keyword)
114
+	db := readDb.Model(&models.MonitoringRecord{}).Where("status = 1 AND user_org_id = ? AND symptom like ?", org_id, keyword)
115 115
 	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
116 116
 	err = db.Find(&monitor).Error
117 117
 	return
118 118
 }
119 119
 
120
-func FindOrgInspection(org_id int64,  lastUploadTime int64, nowTime int64) (inspection []*models.XtInspection, err error) {
120
+func FindOrgInspection(org_id int64, lastUploadTime int64, nowTime int64) (inspection []*models.XtInspection, err error) {
121 121
 	db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? ", org_id).Preload("Patients", "status = 1")
122 122
 	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
123 123
 	err = db.Find(&inspection).Error
@@ -125,21 +125,21 @@ func FindOrgInspection(org_id int64,  lastUploadTime int64, nowTime int64) (insp
125 125
 }
126 126
 
127 127
 // 传染病查询
128
-func FindOrgInspectionGroupOne(org_id int64,  lastUploadTime int64, nowTime int64,patient_id int64) (inspection []*models.XtInspection, err error) {
129
-	db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? and project_id = 14 and patient_id = ?", org_id,patient_id)
128
+func FindOrgInspectionGroupOne(org_id int64, lastUploadTime int64, nowTime int64, patient_id int64) (inspection []*models.XtInspection, err error) {
129
+	db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? and project_id = 14 and patient_id = ?", org_id, patient_id)
130 130
 	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime).Group("inspect_date")
131 131
 	err = db.Find(&inspection).Error
132 132
 	return
133 133
 }
134 134
 
135 135
 // 传染病查询
136
-func FindOrgInspectionGroupTwo(org_id int64, inspect_date int64,patient_id int64) (inspection []*models.XtInspection, err error) {
137
-	db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? and project_id = 14 and patient_id = ? and inspect_date = ?", org_id,patient_id,inspect_date)
136
+func FindOrgInspectionGroupTwo(org_id int64, inspect_date int64, patient_id int64) (inspection []*models.XtInspection, err error) {
137
+	db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? and project_id = 14 and patient_id = ? and inspect_date = ?", org_id, patient_id, inspect_date)
138 138
 	err = db.Find(&inspection).Error
139 139
 	return
140 140
 }
141 141
 
142
-func FindOrgInspectionReference(org_id int64,  lastUploadTime int64, nowTime int64) (inspection []*models.XtInspection, err error) {
142
+func FindOrgInspectionReference(org_id int64, lastUploadTime int64, nowTime int64) (inspection []*models.XtInspection, err error) {
143 143
 	db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? ", org_id).Preload("XtInspectionReference", "status = 1")
144 144
 	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
145 145
 	err = db.Find(&inspection).Error
@@ -256,7 +256,7 @@ func BatchCreateStaffRecord(staffs []*sz.TempHdStaff, rdb *gorm.DB) (err error)
256 256
 				utx.Exec(thisSQL, insertData...)
257 257
 				id_no++
258 258
 			}
259
-			
259
+
260 260
 		}
261 261
 		// utx.Commit()
262 262
 	}
@@ -267,7 +267,7 @@ func BatchCreatePatinet(patients []*sz.TempHdPatient, rdb *gorm.DB) (err error)
267 267
 	if len(patients) > 0 {
268 268
 		utx := rdb
269 269
 		if len(patients) > 0 {
270
-			
270
+
271 271
 			for _, info := range patients {
272 272
 				thisSQL := "INSERT INTO t_hd_patient ( hospital_id, patient_nk,  card_no,  card_type,  id_no, id_type, patient_name, gender, born_date, diagnosis_summary, is_crf, pay_method, local_insurance, dialysis_start_time, local_start_time, outpatient_no, hospitalized_no, xgbz, create_time, update_time, sjscsj) VALUES "
273 273
 				insertParams := make([]string, 0)
@@ -297,9 +297,7 @@ func BatchCreatePatinet(patients []*sz.TempHdPatient, rdb *gorm.DB) (err error)
297 297
 				thisSQL += strings.Join(insertParams, ", ")
298 298
 				utx.Exec(thisSQL, insertData...)
299 299
 			}
300
-			
301
-		
302
-			
300
+
303 301
 		}
304 302
 		// utx.Commit()
305 303
 	}
@@ -328,8 +326,7 @@ func BatchCreateSchedual(patients []*sz.TempHdShift, rdb *gorm.DB) (err error) {
328 326
 				thisSQL += strings.Join(insertParams, ", ")
329 327
 				utx.Exec(thisSQL, insertData...)
330 328
 			}
331
-		
332
-			
329
+
333 330
 		}
334 331
 		// utx.Commit()
335 332
 	}
@@ -357,7 +354,6 @@ func BatchCreatePs(patients []*sz.TempHdPs, rdb *gorm.DB) (err error) {
357 354
 				insertData = append(insertData, info.Sjscsj)
358 355
 				insertData = append(insertData, info.Xgbz)
359 356
 
360
-
361 357
 			}
362 358
 			thisSQL += strings.Join(insertParams, ", ")
363 359
 			// err = utx.Exec(thisSQL, insertData...).Error
@@ -372,7 +368,7 @@ func BatchCreatePs(patients []*sz.TempHdPs, rdb *gorm.DB) (err error) {
372 368
 	return
373 369
 }
374 370
 
375
-func BatchCreatePsOther(ps *sz.TempHdPs, rdb *gorm.DB)(err error){
371
+func BatchCreatePsOther(ps *sz.TempHdPs, rdb *gorm.DB) (err error) {
376 372
 	err = rdb.Create(&ps).Error
377 373
 	return err
378 374
 }
@@ -381,7 +377,7 @@ func BatchCreatePsm(psms []*sz.TempHdPsMedicine, rdb *gorm.DB) (err error) {
381 377
 	if len(psms) > 0 {
382 378
 		utx := rdb
383 379
 		if len(psms) > 0 {
384
-			
380
+
385 381
 			for _, psm := range psms {
386 382
 				thisSQL := "INSERT INTO t_hd_ps_medicine (hospital_id, medicine_type_id,medicine_id,create_time,sjscsj,xgbz,sn) VALUES "
387 383
 				insertParams := make([]string, 0)
@@ -396,9 +392,9 @@ func BatchCreatePsm(psms []*sz.TempHdPsMedicine, rdb *gorm.DB) (err error) {
396 392
 				insertData = append(insertData, psm.Sn)
397 393
 				thisSQL += strings.Join(insertParams, ", ")
398 394
 				// err = utx.Exec(thisSQL, insertData...).Error
399
-				 utx.Exec(thisSQL, insertData...)
395
+				utx.Exec(thisSQL, insertData...)
400 396
 			}
401
-			
397
+
402 398
 			// if err != nil {
403 399
 			// 	utx.Rollback()
404 400
 			// 	return
@@ -413,7 +409,7 @@ func BatchCreateDialysis(psms []*sz.TempHdDialysis, rdb *gorm.DB) (err error) {
413 409
 	if len(psms) > 0 {
414 410
 		utx := rdb
415 411
 		if len(psms) > 0 {
416
-			
412
+
417 413
 			for _, psm := range psms {
418 414
 				thisSQL := "INSERT INTO t_hd_dialysis (dialysis_id,hospital_id,patient_nk,ps_id,dialysis_date,sickbed_no,division_id,equipment_id,mix_dialysis,ufv,total_treat_duration,is_hospitalization,is_emergency,is_perioperative_period,before_sbp,before_dbp,after_sbp,after_dbp,before_weight,after_weight,up_nurse_id,down_nurse_id,check_nurse_id,puncture_nurse_id,start_time,end_time,create_time,sjscsj,xgbz) VALUES "
419 415
 				insertParams := make([]string, 0)
@@ -452,7 +448,7 @@ func BatchCreateDialysis(psms []*sz.TempHdDialysis, rdb *gorm.DB) (err error) {
452 448
 				utx.Exec(thisSQL, insertData...)
453 449
 
454 450
 			}
455
-		
451
+
456 452
 			// if err != nil {
457 453
 			// 	utx.Rollback()
458 454
 			// 	return
@@ -485,7 +481,7 @@ func BatchCreatePatientOut(patientOuts []*sz.TempHdPatientOut, rdb *gorm.DB) (er
485 481
 
486 482
 			}
487 483
 			thisSQL += strings.Join(insertParams, ", ")
488
-			 utx.Exec(thisSQL, insertData...)
484
+			utx.Exec(thisSQL, insertData...)
489 485
 			// if err != nil {
490 486
 			// 	utx.Rollback()
491 487
 			// 	return
@@ -520,7 +516,7 @@ func BatchCreateDoctorsAdvice(advices []*sz.TempHdDoctorsAdvice, rdb *gorm.DB) (
520 516
 				insertData = append(insertData, advice.RrtTypeName)
521 517
 				insertData = append(insertData, advice.DryWeight)
522 518
 				thisSQL += strings.Join(insertParams, ", ")
523
-			 	utx.Exec(thisSQL, insertData...)
519
+				utx.Exec(thisSQL, insertData...)
524 520
 			}
525 521
 			// if err != nil {
526 522
 			// 	utx.Rollback()
@@ -536,7 +532,7 @@ func BatchCreateMonitor(advices []*sz.TempHdMiddle, rdb *gorm.DB) (err error) {
536 532
 	if len(advices) > 0 {
537 533
 		utx := rdb
538 534
 		if len(advices) > 0 {
539
-			
535
+
540 536
 			for _, advice := range advices {
541 537
 				thisSQL := "INSERT INTO t_hd_middle (sn,hospital_id, patient_nk,dialysis_id,monitor_time,sbp,dbp,create_time,sjscsj,xgbz) VALUES "
542 538
 				insertParams := make([]string, 0)
@@ -555,7 +551,7 @@ func BatchCreateMonitor(advices []*sz.TempHdMiddle, rdb *gorm.DB) (err error) {
555 551
 				thisSQL += strings.Join(insertParams, ", ")
556 552
 				utx.Exec(thisSQL, insertData...)
557 553
 			}
558
-			
554
+
559 555
 			// if err != nil {
560 556
 			// 	utx.Rollback()
561 557
 			// 	return
@@ -588,7 +584,7 @@ func BatchCreateOtherMachineRecord(wms []*sz.TempHdOtherMachine, rdb *gorm.DB) (
588 584
 	if len(wms) > 0 {
589 585
 		utx := rdb
590 586
 		if len(wms) > 0 {
591
-			
587
+
592 588
 			for _, wm := range wms {
593 589
 				thisSQL := "INSERT INTO t_hd_other_machine (hospital_id, equipment_id, equipment_brand, equipment_model, enable_time,status,equipment_type,xgbz,create_time,update_time,sjscsj) VALUES "
594 590
 				insertParams := make([]string, 0)
@@ -608,7 +604,7 @@ func BatchCreateOtherMachineRecord(wms []*sz.TempHdOtherMachine, rdb *gorm.DB) (
608 604
 				thisSQL += strings.Join(insertParams, ", ")
609 605
 				utx.Exec(thisSQL, insertData...)
610 606
 			}
611
-			
607
+
612 608
 		}
613 609
 		// utx.Commit()
614 610
 	}
@@ -633,7 +629,7 @@ func BatchCreateMainTain(maintain []*sz.TempHdMaintain, rdb *gorm.DB) (err error
633 629
 				insertData = append(insertData, wm.Sjscsj)
634 630
 			}
635 631
 			thisSQL += strings.Join(insertParams, ", ")
636
-		 	utx.Exec(thisSQL, insertData...)
632
+			utx.Exec(thisSQL, insertData...)
637 633
 			// if err != nil {
638 634
 			// 	utx.Rollback()
639 635
 			// 	return
@@ -645,9 +641,9 @@ func BatchCreateMainTain(maintain []*sz.TempHdMaintain, rdb *gorm.DB) (err error
645 641
 }
646 642
 
647 643
 func FindOrgMachineData(org_id int64, lastUploadTime int64, nowTime int64) (waterMachine []*models.VMDeviceAddmacher, err error) {
648
-	db := readUserDb.Model(&models.VMDeviceAddmacher{}).Where("status = 1 AND  user_org_id = ?", org_id).Preload("DeviceNumber",func(db *gorm.DB) *gorm.DB {
644
+	db := readUserDb.Model(&models.VMDeviceAddmacher{}).Where("status = 1 AND  user_org_id = ?", org_id).Preload("DeviceNumber", func(db *gorm.DB) *gorm.DB {
649 645
 		return readDb.Model(&models.DeviceNumber{}).Where("status = 1")
650
-	   } )
646
+	})
651 647
 
652 648
 	db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
653 649
 
@@ -660,11 +656,11 @@ func BatchCreateHDMRecord(wms []*sz.TempHdDm, rdb *gorm.DB) (err error) {
660 656
 	if len(wms) > 0 {
661 657
 		utx := rdb
662 658
 		if len(wms) > 0 {
663
-			
659
+
664 660
 			for _, wm := range wms {
665 661
 				thisSQL := "INSERT INTO t_hd_dm (hospital_id, equipment_id,sickbed_no,sickbed_type ,equipment_brand, equipment_model, enable_time,status,equipment_type, xgbz,bbp,create_time,update_time,sjscsj) VALUES "
666
-			insertParams := make([]string, 0)
667
-			insertData := make([]interface{}, 0)
662
+				insertParams := make([]string, 0)
663
+				insertData := make([]interface{}, 0)
668 664
 				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
669 665
 				insertData = append(insertData, wm.HospitalId)
670 666
 				insertData = append(insertData, wm.EquipmentId)
@@ -680,11 +676,11 @@ func BatchCreateHDMRecord(wms []*sz.TempHdDm, rdb *gorm.DB) (err error) {
680 676
 				insertData = append(insertData, wm.CreateTime)
681 677
 				insertData = append(insertData, wm.UpdateTime)
682 678
 				insertData = append(insertData, wm.Sjscsj)
683
-		
679
+
684 680
 				thisSQL += strings.Join(insertParams, ", ")
685
-		 utx.Exec(thisSQL, insertData...)
681
+				utx.Exec(thisSQL, insertData...)
686 682
 			}
687
-			
683
+
688 684
 			// if err != nil {
689 685
 			// 	utx.Rollback()
690 686
 			// 	return
@@ -695,7 +691,6 @@ func BatchCreateHDMRecord(wms []*sz.TempHdDm, rdb *gorm.DB) (err error) {
695 691
 	return
696 692
 }
697 693
 
698
-
699 694
 func CreateHDDivision(wms []*sz.TempHdDivision, rdb *gorm.DB) (err error) {
700 695
 	if len(wms) > 0 {
701 696
 		utx := rdb
@@ -713,11 +708,11 @@ func CreateHDDivision(wms []*sz.TempHdDivision, rdb *gorm.DB) (err error) {
713 708
 				insertData = append(insertData, wm.CreateTime)
714 709
 				insertData = append(insertData, wm.UpdateTime)
715 710
 				insertData = append(insertData, wm.Sjscsj)
716
-		
711
+
717 712
 				thisSQL += strings.Join(insertParams, ", ")
718
-		 		utx.Exec(thisSQL, insertData...)
713
+				utx.Exec(thisSQL, insertData...)
719 714
 			}
720
-			
715
+
721 716
 		}
722 717
 	}
723 718
 	return
@@ -745,8 +740,8 @@ func CreateAccess(wms []*sz.TempHdAccess, rdb *gorm.DB) (err error) {
745 740
 				insertData = append(insertData, wm.UpdateTime)
746 741
 				insertData = append(insertData, wm.Sjscsj)
747 742
 				thisSQL += strings.Join(insertParams, ", ")
748
-		 		utx.Exec(thisSQL, insertData...)
749
-			}	
743
+				utx.Exec(thisSQL, insertData...)
744
+			}
750 745
 		}
751 746
 	}
752 747
 	return
@@ -771,8 +766,8 @@ func CreateSickbed(wms []*sz.TempHdSickbed, rdb *gorm.DB) (err error) {
771 766
 				insertData = append(insertData, wm.UpdateTime)
772 767
 				insertData = append(insertData, wm.Sjscsj)
773 768
 				thisSQL += strings.Join(insertParams, ", ")
774
-		 		utx.Exec(thisSQL, insertData...)
775
-			}	
769
+				utx.Exec(thisSQL, insertData...)
770
+			}
776 771
 		}
777 772
 	}
778 773
 	return
@@ -799,14 +794,13 @@ func CreateDiagnosis(wms []*sz.TempHdDiagnosis, rdb *gorm.DB) (err error) {
799 794
 				insertData = append(insertData, wm.UpdateTime)
800 795
 				insertData = append(insertData, wm.Sjscsj)
801 796
 				thisSQL += strings.Join(insertParams, ", ")
802
-		 		utx.Exec(thisSQL, insertData...)
803
-			}	
797
+				utx.Exec(thisSQL, insertData...)
798
+			}
804 799
 		}
805 800
 	}
806 801
 	return
807 802
 }
808 803
 
809
-
810 804
 func CreateInfection(wms []*sz.TempHdInfection, rdb *gorm.DB) (err error) {
811 805
 	if len(wms) > 0 {
812 806
 		utx := rdb
@@ -834,8 +828,8 @@ func CreateInfection(wms []*sz.TempHdInfection, rdb *gorm.DB) (err error) {
834 828
 				insertData = append(insertData, wm.CreateTime)
835 829
 				insertData = append(insertData, wm.Sjscsj)
836 830
 				thisSQL += strings.Join(insertParams, ", ")
837
-		 		utx.Exec(thisSQL, insertData...)
838
-			}	
831
+				utx.Exec(thisSQL, insertData...)
832
+			}
839 833
 		}
840 834
 	}
841 835
 	return
@@ -862,8 +856,8 @@ func CreateComplication(wms []*sz.TempHdComplication, rdb *gorm.DB) (err error)
862 856
 				insertData = append(insertData, wm.CreateTime)
863 857
 				insertData = append(insertData, wm.Sjscsj)
864 858
 				thisSQL += strings.Join(insertParams, ", ")
865
-		 		utx.Exec(thisSQL, insertData...)
866
-			}	
859
+				utx.Exec(thisSQL, insertData...)
860
+			}
867 861
 		}
868 862
 	}
869 863
 	return
@@ -908,8 +902,8 @@ func CreateLisReport(wms []*sz.TempHdLisReport, rdb *gorm.DB) (err error) {
908 902
 				insertData = append(insertData, wm.CreateTime)
909 903
 				insertData = append(insertData, wm.Sjscsj)
910 904
 				thisSQL += strings.Join(insertParams, ", ")
911
-		 		utx.Exec(thisSQL, insertData...)
912
-			}	
905
+				utx.Exec(thisSQL, insertData...)
906
+			}
913 907
 		}
914 908
 	}
915 909
 	return
@@ -942,9 +936,413 @@ func CreateLisIndicators(wms []*sz.TempHdLisIndicators, rdb *gorm.DB) (err error
942 936
 				insertData = append(insertData, wm.CreateTime)
943 937
 				insertData = append(insertData, wm.Sjscsj)
944 938
 				thisSQL += strings.Join(insertParams, ", ")
945
-		 		utx.Exec(thisSQL, insertData...)
946
-			}	
939
+				utx.Exec(thisSQL, insertData...)
940
+			}
941
+		}
942
+	}
943
+	return
944
+}
945
+
946
+func FindOrgCulture(org_id int64, lastUploadTime int64, nowTime int64) (culture []*models.XtDeviceCulture, err error) {
947
+
948
+	err = UserReadDB().Model(&culture).Where("status = 1 and user_org_id = ? and speling_date>=? and speling_date<=?", org_id, lastUploadTime, nowTime).Find(&culture).Error
949
+	return culture, err
950
+}
951
+
952
+func CreateLisCulture(wms []*sz.TempHdLisCulture, rdb *gorm.DB) (err error) {
953
+
954
+	if len(wms) > 0 {
955
+		utx := rdb
956
+		if len(wms) > 0 {
957
+			for _, wm := range wms {
958
+				thisSQL := "INSERT INTO t_hd_dm_dialysate_bc (sn,hospital_id,equipment_id,inspection_time,is_qualified,is_substitution_qualified,case_order,create_time,sjscsj,xgbz) VALUES "
959
+				insertParams := make([]string, 0)
960
+				insertData := make([]interface{}, 0)
961
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
962
+				insertData = append(insertData, wm.Sn)
963
+				insertData = append(insertData, wm.HospitalId)
964
+				insertData = append(insertData, wm.EquitmentId)
965
+				insertData = append(insertData, wm.InspectionTime)
966
+				insertData = append(insertData, wm.IsQualified)
967
+				insertData = append(insertData, wm.IsSubstitutionQualified)
968
+				insertData = append(insertData, wm.CaseOrder)
969
+				insertData = append(insertData, wm.CreateTime)
970
+				insertData = append(insertData, wm.Sjscsj)
971
+				insertData = append(insertData, wm.Xgbz)
972
+				thisSQL += strings.Join(insertParams, ", ")
973
+				utx.Exec(thisSQL, insertData...)
974
+			}
975
+		}
976
+	}
977
+	return
978
+}
979
+
980
+func FindOrgDialysate(org_id int64, lastUploadTime int64, nowTime int64) (dialysate []*models.XtDeviceDialysate, err error) {
981
+
982
+	err = UserReadDB().Model(&dialysate).Where("status = 1 and user_org_id = ? and sampling_date>=? and sampling_date<=?", org_id, lastUploadTime, nowTime).Find(&dialysate).Error
983
+	return dialysate, err
984
+}
985
+
986
+func CreateLisDialysate(wms []*sz.TempHdLisDialysate, rdb *gorm.DB) (err error) {
987
+
988
+	if len(wms) > 0 {
989
+		utx := rdb
990
+		if len(wms) > 0 {
991
+			for _, wm := range wms {
992
+				thisSQL := "INSERT INTO t_hd_dm_dialysate_en (sn,hospital_id,equipment_id,inspection_time,is_qualified,case_order,create_time,sjscsj,xgbz) VALUES "
993
+				insertParams := make([]string, 0)
994
+				insertData := make([]interface{}, 0)
995
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?)")
996
+				insertData = append(insertData, wm.Sn)
997
+				insertData = append(insertData, wm.HospitalId)
998
+				insertData = append(insertData, wm.EquitmentId)
999
+				insertData = append(insertData, wm.InspectionTime)
1000
+				insertData = append(insertData, wm.IsQualified)
1001
+				insertData = append(insertData, wm.CaseOrder)
1002
+				insertData = append(insertData, wm.CreateTime)
1003
+				insertData = append(insertData, wm.Sjscsj)
1004
+				insertData = append(insertData, wm.Xgbz)
1005
+				thisSQL += strings.Join(insertParams, ", ")
1006
+				utx.Exec(thisSQL, insertData...)
1007
+			}
1008
+		}
1009
+	}
1010
+	return
1011
+}
1012
+
1013
+func FindOrgArialDetection(org_id int64, lastUploadTime int64, nowTime int64) (airdetection []*models.XtAerialDetection, err error) {
1014
+
1015
+	err = XTReadDB().Model(&airdetection).Where("user_org_id = ? and status=1 and created_time>=? and created_time<=?", org_id, lastUploadTime, nowTime).Find(&airdetection).Error
1016
+	return airdetection, err
1017
+}
1018
+
1019
+func CreateAirDisinfect(wms []*sz.TempHdLisAirDisinfect, rdb *gorm.DB) (err error) {
1020
+
1021
+	if len(wms) > 0 {
1022
+		utx := rdb
1023
+		if len(wms) > 0 {
1024
+			for _, wm := range wms {
1025
+				thisSQL := "INSERT INTO t_hd_air_disinfect (sn,hospital_id,inspection_time,is_qualified,inspected_value,case_order,create_time,sjscsj,xgbz) VALUES "
1026
+				insertParams := make([]string, 0)
1027
+				insertData := make([]interface{}, 0)
1028
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?)")
1029
+				insertData = append(insertData, wm.Sn)
1030
+				insertData = append(insertData, wm.HospitalId)
1031
+				insertData = append(insertData, wm.InspectionTime)
1032
+				insertData = append(insertData, wm.IsQualified)
1033
+				insertData = append(insertData, wm.InspectedValue)
1034
+				insertData = append(insertData, wm.CaseOrder)
1035
+				insertData = append(insertData, wm.CreateTime)
1036
+				insertData = append(insertData, wm.Sjscsj)
1037
+				insertData = append(insertData, wm.Xgbz)
1038
+				thisSQL += strings.Join(insertParams, ", ")
1039
+				utx.Exec(thisSQL, insertData...)
1040
+			}
1041
+		}
1042
+	}
1043
+	return
1044
+}
1045
+
1046
+func FindOrgBodyDetection(org_id int64, lastUploadTime int64, nowTime int64) (body []*models.XtBodyDetection, err error) {
1047
+	err = XTReadDB().Model(&body).Where("user_org_id = ? and status=1 and created_time>=? and created_time<=?", org_id, lastUploadTime, nowTime).Find(&body).Error
1048
+	return body, err
1049
+}
1050
+
1051
+func CreateBodyDisinfect(wms []*sz.TempHdLisBodyDisinfect, rdb *gorm.DB) (err error) {
1052
+	if len(wms) > 0 {
1053
+		utx := rdb
1054
+		if len(wms) > 0 {
1055
+			for _, wm := range wms {
1056
+				thisSQL := "INSERT INTO t_hd_surface_disinfect (sn,hospital_id,inspection_time,is_qualified,inspected_value,case_order,create_time,sjscsj,xgbz,update_time) VALUES "
1057
+				insertParams := make([]string, 0)
1058
+				insertData := make([]interface{}, 0)
1059
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
1060
+				insertData = append(insertData, wm.Sn)
1061
+				insertData = append(insertData, wm.HospitalId)
1062
+				insertData = append(insertData, wm.InspectionTime)
1063
+				insertData = append(insertData, wm.IsQualified)
1064
+				insertData = append(insertData, wm.InspectedValue)
1065
+				insertData = append(insertData, wm.CaseOrder)
1066
+				insertData = append(insertData, wm.CreateTime)
1067
+				insertData = append(insertData, wm.Sjscsj)
1068
+				insertData = append(insertData, wm.Xgbz)
1069
+				insertData = append(insertData, wm.UpdateTime)
1070
+				thisSQL += strings.Join(insertParams, ", ")
1071
+				utx.Exec(thisSQL, insertData...)
1072
+			}
1073
+		}
1074
+	}
1075
+	return
1076
+}
1077
+
1078
+func FindOrgWaterFc(org_id int64, lastUploadTime int64, nowTime int64) (water []*models.XtDeviceWater, err error) {
1079
+
1080
+	err = UserReadDB().Model(&water).Where("user_org_id = ? and status = 1 and sampling_date>=? and sampling_date<=?", org_id, lastUploadTime, nowTime).Find(&water).Error
1081
+	return water, err
1082
+}
1083
+
1084
+func CreateWaterFc(wms []*sz.TempHdLisWaterFc, rdb *gorm.DB) (err error) {
1085
+
1086
+	if len(wms) > 0 {
1087
+		utx := rdb
1088
+		if len(wms) > 0 {
1089
+			for _, wm := range wms {
1090
+				thisSQL := "INSERT INTO t_hd_water_fc(sn,hospital_id,equitpment_id,water_type,inspection_org_id,inspection_time,is_qualified,inspected_value,case_order,create_time,sjscsj,xgbz,update_time) VALUES "
1091
+				insertParams := make([]string, 0)
1092
+				insertData := make([]interface{}, 0)
1093
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?)")
1094
+				insertData = append(insertData, wm.Sn)
1095
+				insertData = append(insertData, wm.HospitalId)
1096
+				insertData = append(insertData, wm.EquitmentId)
1097
+				insertData = append(insertData, wm.WaterType)
1098
+				insertData = append(insertData, wm.InspectionOrgId)
1099
+				insertData = append(insertData, wm.InspectionTime)
1100
+				insertData = append(insertData, wm.IsQualified)
1101
+				insertData = append(insertData, wm.InspectedValue)
1102
+				insertData = append(insertData, wm.CaseOrder)
1103
+				insertData = append(insertData, wm.CreateTime)
1104
+				insertData = append(insertData, wm.Sjscsj)
1105
+				insertData = append(insertData, wm.Xgbz)
1106
+				insertData = append(insertData, wm.UpdateTime)
1107
+				thisSQL += strings.Join(insertParams, ", ")
1108
+				utx.Exec(thisSQL, insertData...)
1109
+			}
1110
+		}
1111
+	}
1112
+	return
1113
+}
1114
+
1115
+func FindOrgWaterNc(org_id int64, lastUploadTime int64, nowTime int64) (water []*models.XtDeviceOxygenates, err error) {
1116
+
1117
+	err = UserReadDB().Model(&water).Where("user_org_id = ? and status = 1 and sampling_date>=? and sampling_date<=?", org_id, lastUploadTime, nowTime).Find(&water).Error
1118
+	return water, err
1119
+}
1120
+
1121
+func CreateWaterNc(wms []*sz.TempHdLisWaterNc, rdb *gorm.DB) (err error) {
1122
+	if len(wms) > 0 {
1123
+		utx := rdb
1124
+		if len(wms) > 0 {
1125
+			for _, wm := range wms {
1126
+				thisSQL := "INSERT INTO t_hd_water_nc(sn,hospital_id,equitpment_id,water_type,inspection_org_id,inspection_time,is_qualified,inspected_value,case_order,create_time,sjscsj,xgbz,update_time) VALUES "
1127
+				insertParams := make([]string, 0)
1128
+				insertData := make([]interface{}, 0)
1129
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?)")
1130
+				insertData = append(insertData, wm.Sn)
1131
+				insertData = append(insertData, wm.HospitalId)
1132
+				insertData = append(insertData, wm.EquitmentId)
1133
+				insertData = append(insertData, wm.WaterType)
1134
+				insertData = append(insertData, wm.InspectionOrgId)
1135
+				insertData = append(insertData, wm.InspectionTime)
1136
+				insertData = append(insertData, wm.IsQualified)
1137
+				insertData = append(insertData, wm.InspectedValue)
1138
+				insertData = append(insertData, wm.CaseOrder)
1139
+				insertData = append(insertData, wm.CreateTime)
1140
+				insertData = append(insertData, wm.Sjscsj)
1141
+				insertData = append(insertData, wm.Xgbz)
1142
+				insertData = append(insertData, wm.UpdateTime)
1143
+				thisSQL += strings.Join(insertParams, ", ")
1144
+				utx.Exec(thisSQL, insertData...)
1145
+			}
1146
+		}
1147
+	}
1148
+	return
1149
+}
1150
+
1151
+func FindOrgWaterPh(org_id int64, lastUploadTime int64, nowTime int64) (water []*models.XtDevicePh, err error) {
1152
+
1153
+	err = UserReadDB().Model(&water).Where("user_org_id = ? and sampling_date>? and sampling_date<=?", org_id, lastUploadTime, nowTime).Find(&water).Error
1154
+	return water, err
1155
+}
1156
+
1157
+func CreateWaterPh(wms []*sz.TempHdLisWaterPh, rdb *gorm.DB) (err error) {
1158
+	if len(wms) > 0 {
1159
+		utx := rdb
1160
+		if len(wms) > 0 {
1161
+			for _, wm := range wms {
1162
+				thisSQL := "INSERT INTO t_hd_water_ph(sn,hospital_id,equitpment_id,water_type,inspection_org_id,inspection_time,is_qualified,inspected_value,case_order,create_time,sjscsj,xgbz,update_time) VALUES "
1163
+				insertParams := make([]string, 0)
1164
+				insertData := make([]interface{}, 0)
1165
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?)")
1166
+				insertData = append(insertData, wm.Sn)
1167
+				insertData = append(insertData, wm.HospitalId)
1168
+				insertData = append(insertData, wm.EquitmentId)
1169
+				insertData = append(insertData, wm.WaterType)
1170
+				insertData = append(insertData, wm.InspectionOrgId)
1171
+				insertData = append(insertData, wm.InspectionTime)
1172
+				insertData = append(insertData, wm.IsQualified)
1173
+				insertData = append(insertData, wm.InspectedValue)
1174
+				insertData = append(insertData, wm.CaseOrder)
1175
+				insertData = append(insertData, wm.CreateTime)
1176
+				insertData = append(insertData, wm.Sjscsj)
1177
+				insertData = append(insertData, wm.Xgbz)
1178
+				insertData = append(insertData, wm.UpdateTime)
1179
+				thisSQL += strings.Join(insertParams, ", ")
1180
+				utx.Exec(thisSQL, insertData...)
1181
+			}
1182
+		}
1183
+	}
1184
+	return
1185
+}
1186
+
1187
+func FindOrgWaterWh(org_id int64, lastUploadTime int64, nowTime int64) (water []*models.XtDeviceHadwater, err error) {
1188
+
1189
+	err = UserReadDB().Model(&water).Where("user_org_id = ? and sampling_date>=? and sampling_date<=? and status =1", org_id, lastUploadTime, nowTime).Find(&water).Error
1190
+	return water, err
1191
+}
1192
+
1193
+func CreateWaterWh(wms []*sz.TempHdLisWaterWh, rdb *gorm.DB) (err error) {
1194
+	if len(wms) > 0 {
1195
+		utx := rdb
1196
+		if len(wms) > 0 {
1197
+			for _, wm := range wms {
1198
+				thisSQL := "INSERT INTO t_hd_water_wh(sn,hospital_id,equitpment_id,water_type,inspection_org_id,inspection_time,is_qualified,inspected_value,case_order,create_time,sjscsj,xgbz,update_time) VALUES "
1199
+				insertParams := make([]string, 0)
1200
+				insertData := make([]interface{}, 0)
1201
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?)")
1202
+				insertData = append(insertData, wm.Sn)
1203
+				insertData = append(insertData, wm.HospitalId)
1204
+				insertData = append(insertData, wm.EquitmentId)
1205
+				insertData = append(insertData, wm.WaterType)
1206
+				insertData = append(insertData, wm.InspectionOrgId)
1207
+				insertData = append(insertData, wm.InspectionTime)
1208
+				insertData = append(insertData, wm.IsQualified)
1209
+				insertData = append(insertData, wm.InspectedValue)
1210
+				insertData = append(insertData, wm.CaseOrder)
1211
+				insertData = append(insertData, wm.CreateTime)
1212
+				insertData = append(insertData, wm.Sjscsj)
1213
+				insertData = append(insertData, wm.Xgbz)
1214
+				insertData = append(insertData, wm.UpdateTime)
1215
+				thisSQL += strings.Join(insertParams, ", ")
1216
+				utx.Exec(thisSQL, insertData...)
1217
+			}
1218
+		}
1219
+	}
1220
+	return
1221
+}
1222
+
1223
+func FindOrgHdCi(org_id int64, lastUploadTime int64, nowTime int64) (access []*models.XtPatientVascularAccess, err error) {
1224
+
1225
+	err = XTReadDB().Model(&access).Where("user_org_id = ? and start_time>=? and start_time<=? and access_project = 2 and status =1", org_id, lastUploadTime, nowTime).Find(&access).Error
1226
+	return access, err
1227
+}
1228
+
1229
+func CreateHdCi(wms []*sz.TempHdCi, rdb *gorm.DB) (err error) {
1230
+
1231
+	if len(wms) > 0 {
1232
+		utx := rdb
1233
+		if len(wms) > 0 {
1234
+			for _, wm := range wms {
1235
+				thisSQL := "INSERT INTO t_hd_ci(infect_sn,hospital_id,patient_nk,access_id,ci_type,blood_culture,infection_date,create_time,sjscsj,xgbz) VALUES "
1236
+				insertParams := make([]string, 0)
1237
+				insertData := make([]interface{}, 0)
1238
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
1239
+				insertData = append(insertData, wm.InfectSn)
1240
+				insertData = append(insertData, wm.HospitalId)
1241
+				insertData = append(insertData, wm.PatientNk)
1242
+				insertData = append(insertData, wm.AccessId)
1243
+				insertData = append(insertData, wm.CiType)
1244
+				insertData = append(insertData, wm.BloodCulture)
1245
+				insertData = append(insertData, wm.InfectionDate)
1246
+				insertData = append(insertData, wm.CreateTime)
1247
+				insertData = append(insertData, wm.Sjscsj)
1248
+				insertData = append(insertData, wm.Xgbz)
1249
+				thisSQL += strings.Join(insertParams, ", ")
1250
+				utx.Exec(thisSQL, insertData...)
1251
+			}
947 1252
 		}
948 1253
 	}
949 1254
 	return
950
-}
1255
+}
1256
+
1257
+func FindOrgHdCiOutCome(org_id int64, lastUploadTime int64, nowTime int64) (access []*models.XtPatientVascularAccess, err error) {
1258
+
1259
+	err = XTReadDB().Model(&access).Where("user_org_id = ? and start_time>=? and start_time<=? and access_project = 2 and status =1", org_id, lastUploadTime, nowTime).Find(&access).Error
1260
+	return access, err
1261
+}
1262
+
1263
+func CreateHdCiOutCome(wms []*sz.TempHdCiOutCome, rdb *gorm.DB) (err error) {
1264
+
1265
+	if len(wms) > 0 {
1266
+		utx := rdb
1267
+		if len(wms) > 0 {
1268
+			for _, wm := range wms {
1269
+				thisSQL := "INSERT INTO t_hd_ci_outcome(hospital_id,sn,infect_sn,patient_nk,sequelae_type,sjscsj,xgbz,create_time,update_time) VALUES "
1270
+				insertParams := make([]string, 0)
1271
+				insertData := make([]interface{}, 0)
1272
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?)")
1273
+				insertData = append(insertData, wm.HospitalId)
1274
+				insertData = append(insertData, wm.Sn)
1275
+				insertData = append(insertData, wm.InfectSn)
1276
+				insertData = append(insertData, wm.PatientNk)
1277
+				insertData = append(insertData, wm.SequelaeType)
1278
+				insertData = append(insertData, wm.Sjscsj)
1279
+				insertData = append(insertData, wm.Xgbz)
1280
+				insertData = append(insertData, wm.CreateTime)
1281
+				insertData = append(insertData, wm.UpdateTime)
1282
+				thisSQL += strings.Join(insertParams, ", ")
1283
+				utx.Exec(thisSQL, insertData...)
1284
+			}
1285
+		}
1286
+	}
1287
+	return
1288
+}
1289
+
1290
+func CreateLisWaterBc(wms []*sz.TempHdLisWaterBc, rdb *gorm.DB) (err error) {
1291
+	if len(wms) > 0 {
1292
+		utx := rdb
1293
+		if len(wms) > 0 {
1294
+			for _, wm := range wms {
1295
+				thisSQL := "INSERT INTO t_hd_water_bc (hospital_id,sn,equipment_id,water_type,inspection_org_id,inspection_time,is_qualified,inspected_value,case_order,sjscsj,xgbz,create_time,update_time) VALUES "
1296
+				insertParams := make([]string, 0)
1297
+				insertData := make([]interface{}, 0)
1298
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?)")
1299
+				insertData = append(insertData, wm.HospitalId)
1300
+				insertData = append(insertData, wm.Sn)
1301
+				insertData = append(insertData, wm.EquitmentId)
1302
+				insertData = append(insertData, wm.WaterType)
1303
+				insertData = append(insertData, wm.InspectionOrgId)
1304
+				insertData = append(insertData, wm.InspectionTime)
1305
+				insertData = append(insertData, wm.IsQualified)
1306
+				insertData = append(insertData, wm.InspectedValue)
1307
+				insertData = append(insertData, wm.CaseOrder)
1308
+				insertData = append(insertData, wm.Sjscsj)
1309
+				insertData = append(insertData, wm.Xgbz)
1310
+				insertData = append(insertData, wm.CreateTime)
1311
+				insertData = append(insertData, wm.UpdateTime)
1312
+				thisSQL += strings.Join(insertParams, ", ")
1313
+				utx.Exec(thisSQL, insertData...)
1314
+			}
1315
+		}
1316
+	}
1317
+	return
1318
+}
1319
+
1320
+func CreateLisWaterEn(wms []*sz.TempHdLisWaterEn, rdb *gorm.DB) (err error) {
1321
+	if len(wms) > 0 {
1322
+		utx := rdb
1323
+		if len(wms) > 0 {
1324
+			for _, wm := range wms {
1325
+				thisSQL := "INSERT INTO t_hd_water_en (hospital_id,sn,equipment_id,water_type,inspection_org_id,inspection_time,is_qualified,inspected_value,case_order,sjscsj,xgbz,create_time,update_time) VALUES "
1326
+				insertParams := make([]string, 0)
1327
+				insertData := make([]interface{}, 0)
1328
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?)")
1329
+				insertData = append(insertData, wm.HospitalId)
1330
+				insertData = append(insertData, wm.Sn)
1331
+				insertData = append(insertData, wm.EquitmentId)
1332
+				insertData = append(insertData, wm.WaterType)
1333
+				insertData = append(insertData, wm.InspectionOrgId)
1334
+				insertData = append(insertData, wm.InspectionTime)
1335
+				insertData = append(insertData, wm.IsQualified)
1336
+				insertData = append(insertData, wm.InspectedValue)
1337
+				insertData = append(insertData, wm.CaseOrder)
1338
+				insertData = append(insertData, wm.Sjscsj)
1339
+				insertData = append(insertData, wm.Xgbz)
1340
+				insertData = append(insertData, wm.CreateTime)
1341
+				insertData = append(insertData, wm.UpdateTime)
1342
+				thisSQL += strings.Join(insertParams, ", ")
1343
+				utx.Exec(thisSQL, insertData...)
1344
+			}
1345
+		}
1346
+	}
1347
+	return
1348
+}