Browse Source

新增多个上传类型

csx 4 years ago
parent
commit
19574ae925
3 changed files with 386 additions and 32 deletions
  1. 196 0
      controllers/sync.go
  2. 61 31
      models/src_data.go
  3. 129 1
      service/city_data_uoload_service.go

+ 196 - 0
controllers/sync.go View File

@@ -687,3 +687,199 @@ func (c *SyncController) SyncMiddle(rdb *gorm.DB, org_id int64, hospital_id int6
687 687
 	}
688 688
 
689 689
 }
690
+
691
+// 同步设备
692
+func (c *SyncController) SyncOtherMachine(rdb *gorm.DB, org_id int64, hospital_id int64) {
693
+	// 第一步:根据机构id获取上次同步时间
694
+	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 13)
695
+	var sync_time int64
696
+	if syncLastInfo.ID > 0 {
697
+		sync_time = syncLastInfo.SyncTime
698
+	} else {
699
+		sync_time = 0
700
+	}
701
+
702
+	//同步设备
703
+	waterMachine, _ := service.FindOrgOtherMachineData(org_id, sync_time, time.Now().Unix())
704
+	var wms []*sz.TempHdOtherMachine
705
+	for _, item := range waterMachine {
706
+		wm := &sz.TempHdOtherMachine{
707
+			HospitalId:     strconv.FormatInt(hospital_id, 10),
708
+			EquipmentId:    strconv.FormatInt(item.ID, 10),
709
+			EquipmentBrand: item.ManufactureFactory,
710
+			EquipmentModel: strconv.FormatInt(item.UnitType, 10),
711
+			EnableTime:     time.Unix(item.StartDate, 0),
712
+			DiscardedTime:  time.Unix(item.RubbishDate, 0),
713
+			CreateTime:     time.Now(),
714
+			UpdateTime:     time.Now(),
715
+			Sjscsj:         time.Now(),
716
+			Xgbz:           strconv.FormatInt(0, 10),
717
+		}
718
+		switch item.MachineStatus {
719
+		case 1:
720
+			wm.Status = "1"
721
+			break
722
+		case 4:
723
+			wm.Status = "3"
724
+			break
725
+		}
726
+
727
+		wms = append(wms, wm)
728
+	}
729
+
730
+	err := service.BatchCreateOtherMachineRecord(wms, rdb)
731
+	if err == nil {
732
+		// 第三步:同步成功后,添加同步记录
733
+		upload := &sz.DataUpload{
734
+			SyncType:       13,
735
+			OrgId:          org_id,
736
+			SyncTime:       time.Now().Unix(),
737
+			SyncResultType: 1,
738
+			CreateTime:     time.Now().Unix(),
739
+			UpdateTime:     time.Now().Unix(),
740
+		}
741
+		err := service.CreateUploadRecord(upload)
742
+		if err != nil {
743
+			utils.ErrorLog("%v", err)
744
+		}
745
+	} else {
746
+		//错误处理
747
+
748
+	}
749
+
750
+}
751
+
752
+// 同步维修
753
+func (c *SyncController) SyncMachineRepair(rdb *gorm.DB, org_id int64, hospital_id int64) {
754
+	// 第一步:根据机构id获取上次同步时间
755
+	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 11)
756
+	var sync_time int64
757
+	if syncLastInfo.ID > 0 {
758
+		sync_time = syncLastInfo.SyncTime
759
+	} else {
760
+		sync_time = 0
761
+	}
762
+
763
+	//同步设备
764
+	hdMaintain, _ := service.FindOrgMachineRepairData(org_id, sync_time, time.Now().Unix())
765
+	var maintain []*sz.TempHdMaintain
766
+	for _, item := range hdMaintain {
767
+		mt := &sz.TempHdMaintain{
768
+			HospitalId:  strconv.FormatInt(hospital_id, 10),
769
+			EquipmentId: strconv.FormatInt(item.VMDeviceAddmacher.ID, 10),
770
+			RepairTime:  time.Unix(item.GuaranteeDate, 0),
771
+			CreateTime:  time.Now(),
772
+			Sjscsj:      time.Now(),
773
+			Xgbz:        strconv.FormatInt(0, 10),
774
+		}
775
+		switch item.VMDeviceAddmacher.DeviceType {
776
+		case 1:
777
+			mt.EquipmentType = "11"
778
+			break
779
+		case 2:
780
+			mt.EquipmentType = "21"
781
+			break
782
+		case 3:
783
+			mt.EquipmentType = "99"
784
+			break
785
+		}
786
+
787
+		maintain = append(maintain, mt)
788
+	}
789
+
790
+	err := service.BatchCreateMainTain(maintain, rdb)
791
+	if err == nil {
792
+		// 第三步:同步成功后,添加同步记录
793
+		upload := &sz.DataUpload{
794
+			SyncType:       11,
795
+			OrgId:          org_id,
796
+			SyncTime:       time.Now().Unix(),
797
+			SyncResultType: 1,
798
+			CreateTime:     time.Now().Unix(),
799
+			UpdateTime:     time.Now().Unix(),
800
+		}
801
+		err := service.CreateUploadRecord(upload)
802
+		if err != nil {
803
+			utils.ErrorLog("%v", err)
804
+		}
805
+	} else {
806
+		//错误处理
807
+
808
+	}
809
+
810
+}
811
+
812
+// 同步设备
813
+func (c *SyncController) SyncDM(rdb *gorm.DB, org_id int64, hospital_id int64) {
814
+	// 第一步:根据机构id获取上次同步时间
815
+	syncLastInfo, _ := service.GetSyncTimeByOrgId(org_id, 5)
816
+	var sync_time int64
817
+	if syncLastInfo.ID > 0 {
818
+		sync_time = syncLastInfo.SyncTime
819
+	} else {
820
+		sync_time = 0
821
+	}
822
+
823
+	//同步设备
824
+	dm, _ := service.FindOrgMachineData(org_id, sync_time, time.Now().Unix())
825
+	var hdms []*sz.TempHdDm
826
+	for _, item := range dm {
827
+		hdm := &sz.TempHdDm{
828
+			HospitalId:     strconv.FormatInt(hospital_id, 10),
829
+			EquipmentId:    strconv.FormatInt(item.ID, 10),
830
+			SickbedNo:      item.DeviceNumber.Number,
831
+			EquipmentBrand: item.ManufactureFactory,
832
+			EquipmentModel: strconv.FormatInt(item.UnitType, 10),
833
+			EnableTime:     time.Unix(item.StartDate, 0),
834
+			DiscardedTime:  time.Unix(item.RubbishDate, 0),
835
+			CreateTime:     time.Now(),
836
+			UpdateTime:     time.Now(),
837
+			Sjscsj:         time.Now(),
838
+			Xgbz:           strconv.FormatInt(0, 10),
839
+		}
840
+
841
+		switch item.MachineStatus {
842
+		case 1:
843
+			hdm.Status = "1"
844
+			break
845
+		case 4:
846
+			hdm.Status = "3"
847
+			break
848
+		}
849
+
850
+		switch item.DeviceType {
851
+		case 1:
852
+			hdm.EquipmentType = "11"
853
+			break
854
+		case 2:
855
+			hdm.EquipmentType = "98"
856
+			break
857
+		case 3:
858
+			hdm.EquipmentType = "99"
859
+			break
860
+		}
861
+
862
+		hdms = append(hdms, hdm)
863
+	}
864
+
865
+	err := service.BatchCreateHDMRecord(hdms, rdb)
866
+	if err == nil {
867
+		// 第三步:同步成功后,添加同步记录
868
+		upload := &sz.DataUpload{
869
+			SyncType:       5,
870
+			OrgId:          org_id,
871
+			SyncTime:       time.Now().Unix(),
872
+			SyncResultType: 1,
873
+			CreateTime:     time.Now().Unix(),
874
+			UpdateTime:     time.Now().Unix(),
875
+		}
876
+		err := service.CreateUploadRecord(upload)
877
+		if err != nil {
878
+			utils.ErrorLog("%v", err)
879
+		}
880
+	} else {
881
+		//错误处理
882
+
883
+	}
884
+
885
+}

+ 61 - 31
models/src_data.go View File

@@ -673,39 +673,69 @@ func (VMDialysisPrescription) TableName() string {
673 673
 }
674 674
 
675 675
 type VMDeviceAddmacher struct {
676
-	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
677
-	SerialNumber        string `gorm:"column:serial_number" json:"serial_number" form:"serial_number"`
678
-	DeviceType          int64  `gorm:"column:device_type" json:"device_type" form:"device_type"`
679
-	BedNumber           string `gorm:"column:bed_number" json:"bed_number" form:"bed_number"`
680
-	DeviceName          string `gorm:"column:device_name" json:"device_name" form:"device_name"`
681
-	ManufactureFactory  string `gorm:"column:manufacture_factory" json:"manufacture_factory" form:"manufacture_factory"`
682
-	ServiceManufacturer string `gorm:"column:service_manufacturer" json:"service_manufacturer" form:"service_manufacturer"`
683
-	UnitType            int64  `gorm:"column:unit_type" json:"unit_type" form:"unit_type"`
684
-	UseSection          string `gorm:"column:use_section" json:"use_section" form:"use_section"`
685
-	SectionNumber       string `gorm:"column:section_number" json:"section_number" form:"section_number"`
686
-	BuyDate             int64  `gorm:"column:buy_date" json:"buy_date" form:"buy_date"`
687
-	InstallDate         int64  `gorm:"column:install_date" json:"install_date" form:"install_date"`
688
-	StartDate           int64  `gorm:"column:start_date" json:"start_date" form:"start_date"`
689
-	MaintenaceEngineer  string `gorm:"column:maintenace_engineer" json:"maintenace_engineer" form:"maintenace_engineer"`
690
-	Telephone           string `gorm:"column:telephone" json:"telephone" form:"telephone"`
691
-	GuaranteeDate       string `gorm:"column:guarantee_date" json:"guarantee_date" form:"guarantee_date"`
692
-	MachineStatus       int64  `gorm:"column:machine_status" json:"machine_status" form:"machine_status"`
693
-	UserTotal           string `gorm:"column:user_total" json:"user_total" form:"user_total"`
694
-	DisinfectionMode    int64  `gorm:"column:disinfection_mode" json:"disinfection_mode" form:"disinfection_mode"`
695
-	Remarks             string `gorm:"column:remarks" json:"remarks" form:"remarks"`
696
-	RubbishDate         int64  `gorm:"column:rubbish_date" json:"rubbish_date" form:"rubbish_date"`
697
-	RubbishReason       int64  `gorm:"column:rubbish_reason" json:"rubbish_reason" form:"rubbish_reason"`
698
-	UserYear            string `gorm:"column:user_year" json:"user_year" form:"user_year"`
699
-	WorkTime            string `gorm:"column:work_time" json:"work_time" form:"work_time"`
700
-	ReversMode          int64  `gorm:"column:revers_mode" json:"revers_mode" form:"revers_mode"`
701
-	UserOrgId           int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
702
-	Status              int64  `gorm:"column:status" json:"status" form:"status"`
703
-	Ctime               int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
704
-	Mtime               int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
705
-	ZoneId              int64  `gorm:"column:zone_id" json:"zone_id" form:"zone_id"`
706
-	BedId               int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
676
+	ID                  int64        `gorm:"column:id" json:"id" form:"id"`
677
+	SerialNumber        string       `gorm:"column:serial_number" json:"serial_number" form:"serial_number"`
678
+	DeviceType          int64        `gorm:"column:device_type" json:"device_type" form:"device_type"`
679
+	BedNumber           string       `gorm:"column:bed_number" json:"bed_number" form:"bed_number"`
680
+	DeviceName          string       `gorm:"column:device_name" json:"device_name" form:"device_name"`
681
+	ManufactureFactory  string       `gorm:"column:manufacture_factory" json:"manufacture_factory" form:"manufacture_factory"`
682
+	ServiceManufacturer string       `gorm:"column:service_manufacturer" json:"service_manufacturer" form:"service_manufacturer"`
683
+	UnitType            int64        `gorm:"column:unit_type" json:"unit_type" form:"unit_type"`
684
+	UseSection          string       `gorm:"column:use_section" json:"use_section" form:"use_section"`
685
+	SectionNumber       string       `gorm:"column:section_number" json:"section_number" form:"section_number"`
686
+	BuyDate             int64        `gorm:"column:buy_date" json:"buy_date" form:"buy_date"`
687
+	InstallDate         int64        `gorm:"column:install_date" json:"install_date" form:"install_date"`
688
+	StartDate           int64        `gorm:"column:start_date" json:"start_date" form:"start_date"`
689
+	MaintenaceEngineer  string       `gorm:"column:maintenace_engineer" json:"maintenace_engineer" form:"maintenace_engineer"`
690
+	Telephone           string       `gorm:"column:telephone" json:"telephone" form:"telephone"`
691
+	GuaranteeDate       string       `gorm:"column:guarantee_date" json:"guarantee_date" form:"guarantee_date"`
692
+	MachineStatus       int64        `gorm:"column:machine_status" json:"machine_status" form:"machine_status"`
693
+	UserTotal           string       `gorm:"column:user_total" json:"user_total" form:"user_total"`
694
+	DisinfectionMode    int64        `gorm:"column:disinfection_mode" json:"disinfection_mode" form:"disinfection_mode"`
695
+	Remarks             string       `gorm:"column:remarks" json:"remarks" form:"remarks"`
696
+	RubbishDate         int64        `gorm:"column:rubbish_date" json:"rubbish_date" form:"rubbish_date"`
697
+	RubbishReason       int64        `gorm:"column:rubbish_reason" json:"rubbish_reason" form:"rubbish_reason"`
698
+	UserYear            string       `gorm:"column:user_year" json:"user_year" form:"user_year"`
699
+	WorkTime            string       `gorm:"column:work_time" json:"work_time" form:"work_time"`
700
+	ReversMode          int64        `gorm:"column:revers_mode" json:"revers_mode" form:"revers_mode"`
701
+	UserOrgId           int64        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
702
+	Status              int64        `gorm:"column:status" json:"status" form:"status"`
703
+	Ctime               int64        `gorm:"column:ctime" json:"ctime" form:"ctime"`
704
+	Mtime               int64        `gorm:"column:mtime" json:"mtime" form:"mtime"`
705
+	ZoneId              int64        `gorm:"column:zone_id" json:"zone_id" form:"zone_id"`
706
+	BedId               int64        `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
707
+	DeviceNumber        DeviceNumber `gorm:"ForeignKey:ID;AssociationForeignKey:BedId"`
707 708
 }
708 709
 
709 710
 func (VMDeviceAddmacher) TableName() string {
710 711
 	return "xt_device_addmacher"
711 712
 }
713
+
714
+type DeviceRepair struct {
715
+	ID                int64             `gorm:"column:id" json:"id" form:"id"`
716
+	GuaranteeDate     int64             `gorm:"column:guarantee_date" json:"guarantee_date" form:"guarantee_date"`
717
+	StartTime         int64             `gorm:"column:start_time" json:"start_time" form:"start_time"`
718
+	ArriveTime        int64             `gorm:"column:arrive_time" json:"arrive_time" form:"arrive_time"`
719
+	FinishTime        int64             `gorm:"column:finish_time" json:"finish_time" form:"finish_time"`
720
+	TotalDistance     string            `gorm:"column:total_distance" json:"total_distance" form:"total_distance"`
721
+	FailureStage      int64             `gorm:"column:failure_stage" json:"failure_stage" form:"failure_stage"`
722
+	FaultDescription  string            `gorm:"column:fault_description" json:"fault_description" form:"fault_description"`
723
+	CauseAnalysis     string            `gorm:"column:cause_analysis" json:"cause_analysis" form:"cause_analysis"`
724
+	TreatmentProcess  string            `gorm:"column:treatment_process" json:"treatment_process" form:"treatment_process"`
725
+	Images            string            `gorm:"column:images" json:"images" form:"images"`
726
+	Exclude           int64             `gorm:"column:exclude" json:"exclude" form:"exclude"`
727
+	Reason            string            `gorm:"column:reason" json:"reason" form:"reason"`
728
+	Ctime             int64             `gorm:"column:ctime" json:"ctime" form:"ctime"`
729
+	Mtime             int64             `gorm:"column:mtime" json:"mtime" form:"mtime"`
730
+	Status            int64             `gorm:"column:status" json:"status" form:"status"`
731
+	UserOrgId         int64             `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
732
+	BedId             int64             `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
733
+	EquitmentId       int64             `gorm:"column:equitment_id" json:"equitment_id" form:"equitment_id"`
734
+	CodeInformation   string            `gorm:"column:code_information" json:"code_information" form:"code_information"`
735
+	ImageName         string            `gorm:"column:image_name" json:"image_name" form:"image_name"`
736
+	VMDeviceAddmacher VMDeviceAddmacher `gorm:"ForeignKey:ID;AssociationForeignKey:EquitmentId"`
737
+}
738
+
739
+func (DeviceRepair) TableName() string {
740
+	return "xt_device_repair"
741
+}

+ 129 - 1
service/city_data_uoload_service.go View File

@@ -115,7 +115,7 @@ func FindOrgDeviceZoneRecordData(org_id int64, lastUploadTime int64, nowTime int
115 115
 
116 116
 func FindOrgWaterMachineData(org_id int64, lastUploadTime int64, nowTime int64) (waterMachine []*models.VMDeviceAddmacher, err error) {
117 117
 
118
-	db := readDb.Model(&models.VMDeviceAddmacher{}).Where("status = 1 AND  user_org_id = ?", org_id)
118
+	db := readUserDb.Model(&models.VMDeviceAddmacher{}).Where("status = 1 AND  user_org_id = ? AND  device_type = 2", org_id)
119 119
 
120 120
 	db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
121 121
 
@@ -426,3 +426,131 @@ func BatchCreateMonitor(advices []*sz.TempHdMiddle, rdb *gorm.DB) (err error) {
426 426
 	}
427 427
 	return
428 428
 }
429
+
430
+func FindOrgOtherMachineData(org_id int64, lastUploadTime int64, nowTime int64) (waterMachine []*models.VMDeviceAddmacher, err error) {
431
+
432
+	db := readUserDb.Model(&models.VMDeviceAddmacher{}).Where("status = 1 AND  user_org_id = ? AND (device_type = 1 OR device_type = 3)", org_id)
433
+
434
+	db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
435
+
436
+	err = db.Find(&waterMachine).Error
437
+
438
+	return
439
+}
440
+
441
+func FindOrgMachineRepairData(org_id int64, lastUploadTime int64, nowTime int64) (waterMachine []*models.DeviceRepair, err error) {
442
+	db := readUserDb.Model(&models.DeviceRepair{}).Where("status = 1 AND  user_org_id = ?", org_id).Preload("VMDeviceAddmacher", "status = 1")
443
+	db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
444
+	err = db.Find(&waterMachine).Error
445
+	return
446
+}
447
+
448
+func BatchCreateOtherMachineRecord(wms []*sz.TempHdOtherMachine, rdb *gorm.DB) (err error) {
449
+	if len(wms) > 0 {
450
+		utx := rdb.Begin()
451
+		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 "
453
+			insertParams := make([]string, 0)
454
+			insertData := make([]interface{}, 0)
455
+			for _, wm := range wms {
456
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
457
+				insertData = append(insertData, wm.HospitalId)
458
+				insertData = append(insertData, wm.EquipmentId)
459
+				insertData = append(insertData, wm.EquipmentBrand)
460
+				insertData = append(insertData, wm.EquipmentModel)
461
+				insertData = append(insertData, wm.EnableTime)
462
+				insertData = append(insertData, wm.DiscardedTime)
463
+				insertData = append(insertData, wm.Xgbz)
464
+				insertData = append(insertData, wm.CreateTime)
465
+				insertData = append(insertData, wm.UpdateTime)
466
+				insertData = append(insertData, wm.Sjscsj)
467
+
468
+			}
469
+			thisSQL += strings.Join(insertParams, ", ")
470
+			err = utx.Exec(thisSQL, insertData...).Error
471
+			if err != nil {
472
+				utx.Rollback()
473
+				return
474
+			}
475
+		}
476
+		utx.Commit()
477
+	}
478
+	return
479
+}
480
+
481
+func BatchCreateMainTain(maintain []*sz.TempHdMaintain, rdb *gorm.DB) (err error) {
482
+	if len(maintain) > 0 {
483
+		utx := rdb.Begin()
484
+		if len(maintain) > 0 {
485
+			thisSQL := "INSERT INTO t_hd_maintain (HOSPITAL_ID, EQUIPMENT_ID, EQUIPMENT_TYPE, REPAIR_TIME, XGBZ,CREATE_TIME,SJSCSJ) VALUES "
486
+			insertParams := make([]string, 0)
487
+			insertData := make([]interface{}, 0)
488
+			for _, wm := range maintain {
489
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?)")
490
+				insertData = append(insertData, wm.HospitalId)
491
+				insertData = append(insertData, wm.EquipmentId)
492
+				insertData = append(insertData, wm.EquipmentType)
493
+				insertData = append(insertData, wm.RepairTime)
494
+				insertData = append(insertData, wm.Xgbz)
495
+				insertData = append(insertData, wm.CreateTime)
496
+				insertData = append(insertData, wm.Sjscsj)
497
+			}
498
+			thisSQL += strings.Join(insertParams, ", ")
499
+			err = utx.Exec(thisSQL, insertData...).Error
500
+			if err != nil {
501
+				utx.Rollback()
502
+				return
503
+			}
504
+		}
505
+		utx.Commit()
506
+	}
507
+	return
508
+}
509
+
510
+func FindOrgMachineData(org_id int64, lastUploadTime int64, nowTime int64) (waterMachine []*models.VMDeviceAddmacher, err error) {
511
+
512
+	db := readUserDb.Model(&models.VMDeviceAddmacher{}).Where("status = 1 AND  user_org_id = ?", org_id).Preload("DeviceNumber", "status = 1")
513
+
514
+	db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
515
+
516
+	err = db.Find(&waterMachine).Error
517
+
518
+	return
519
+}
520
+
521
+func BatchCreateHDMRecord(wms []*sz.TempHdDm, rdb *gorm.DB) (err error) {
522
+	if len(wms) > 0 {
523
+		utx := rdb.Begin()
524
+		if len(wms) > 0 {
525
+			thisSQL := "INSERT INTO t_hd_dm (HOSPITAL_ID, EQUIPMENT_ID,SICKBED_NO, EQUIPMENT_BRAND, EQUIPMENT_MODEL, ENABLE_TIME,DISCARDED_TIME,STATUS,EQUIPMENT_TYPE, XGBZ,CREATE_TIME,UPDATE_TIME,SJSCSJ) VALUES "
526
+			insertParams := make([]string, 0)
527
+			insertData := make([]interface{}, 0)
528
+			for _, wm := range wms {
529
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?)")
530
+				insertData = append(insertData, wm.HospitalId)
531
+				insertData = append(insertData, wm.EquipmentId)
532
+				insertData = append(insertData, wm.SickbedNo)
533
+				insertData = append(insertData, wm.EquipmentBrand)
534
+				insertData = append(insertData, wm.EquipmentModel)
535
+				insertData = append(insertData, wm.EnableTime)
536
+				insertData = append(insertData, wm.DiscardedTime)
537
+				insertData = append(insertData, wm.Status)
538
+				insertData = append(insertData, wm.EquipmentType)
539
+
540
+				insertData = append(insertData, wm.Xgbz)
541
+				insertData = append(insertData, wm.CreateTime)
542
+				insertData = append(insertData, wm.UpdateTime)
543
+				insertData = append(insertData, wm.Sjscsj)
544
+
545
+			}
546
+			thisSQL += strings.Join(insertParams, ", ")
547
+			err = utx.Exec(thisSQL, insertData...).Error
548
+			if err != nil {
549
+				utx.Rollback()
550
+				return
551
+			}
552
+		}
553
+		utx.Commit()
554
+	}
555
+	return
556
+}