XMLWAN 4 år sedan
förälder
incheckning
346d7b682e

+ 10 - 10
controllers/manage_api_controller.go Visa fil

@@ -210,7 +210,7 @@ func (this *MachineApiController) SaveManageInfo() {
210 210
 		DeviceName:          device_name,
211 211
 		ManufactureFactory:  manufacture_factory,
212 212
 		ServiceManufacturer: service_manufacturer,
213
-		UnitType:            unit_type,
213
+		UnitType:            unittype,
214 214
 		UseSection:          use_section,
215 215
 		SectionNumber:       section_number,
216 216
 		BuyDate:             buydate,
@@ -294,8 +294,8 @@ func (this *MachineApiController) UpdateMachineInfo() {
294 294
 	//fmt.Println("生产厂家", manufacture_factory)
295 295
 	service_manufacturer := dataBody["service_manufacturer"].(string)
296 296
 	//fmt.Println("维修厂家", service_manufacturer)
297
-	unittype := int64(dataBody["unit_type"].(float64))
298
-	unit_type := strconv.FormatInt(unittype, 10)
297
+	unit_type := int64(dataBody["unit_type"].(float64))
298
+	//unit_type := strconv.FormatInt(unittype, 10)
299 299
 	fmt.Println("设备型号", unit_type)
300 300
 
301 301
 	use_section := dataBody["use_section"].(string)
@@ -435,8 +435,8 @@ func (this *MachineApiController) UpdateMachinetwo() {
435 435
 	//fmt.Println("生产厂家", manufacture_factory)
436 436
 	service_manufacturer := dataBody["service_manufacturer"].(string)
437 437
 	//fmt.Println("维修厂家", service_manufacturer)
438
-	unittype := int64(dataBody["unit_type"].(float64))
439
-	unit_type := strconv.FormatInt(unittype, 10)
438
+	unit_type := int64(dataBody["unit_type"].(float64))
439
+	//unit_type := strconv.FormatInt(unittype, 10)
440 440
 	//fmt.Println("设备型号", unit_type)
441 441
 	use_section := dataBody["use_section"].(string)
442 442
 	//fmt.Println("使用科室", use_section)
@@ -568,7 +568,7 @@ func (this *MachineApiController) Updatemacheinetwo() {
568 568
 	service_manufacturer := dataBody["service_manufacturer"].(string)
569 569
 	//fmt.Println("维修厂家", service_manufacturer)
570 570
 	unittype := int64(dataBody["unit_type"].(float64))
571
-	unit_type := strconv.FormatInt(unittype, 10)
571
+	//unit_type := strconv.FormatInt(unittype, 10)
572 572
 	//fmt.Println("设备型号", unit_type)
573 573
 	use_section := dataBody["use_section"].(string)
574 574
 	//fmt.Println("使用科室", use_section)
@@ -635,7 +635,7 @@ func (this *MachineApiController) Updatemacheinetwo() {
635 635
 		DeviceName:          device_name,
636 636
 		ManufactureFactory:  manufacture_factory,
637 637
 		ServiceManufacturer: service_manufacturer,
638
-		UnitType:            unit_type,
638
+		UnitType:            unittype,
639 639
 		UseSection:          use_section,
640 640
 		SectionNumber:       section_number,
641 641
 		BuyDate:             buydate,
@@ -2651,9 +2651,9 @@ func (this *MachineApiController) SaveManageinfoTwo() {
2651 2651
 	fmt.Println("生产厂家", manufacture_factory)
2652 2652
 	service_manufacturer := dataBody["service_manufacturer"].(string)
2653 2653
 	fmt.Println("维修厂家", service_manufacturer)
2654
-	unittype := int64(dataBody["unit_type"].(float64))
2655
-	unit_type := strconv.FormatInt(unittype, 10)
2656
-	fmt.Println("设备型号", unit_type)
2654
+	unit_type := int64(dataBody["unit_type"].(float64))
2655
+	//unit_type := strconv.FormatInt(unittype, 10)
2656
+	//fmt.Println("设备型号", unit_type)
2657 2657
 	use_section := dataBody["use_section"].(string)
2658 2658
 	fmt.Println("使用科室", use_section)
2659 2659
 	section_number := dataBody["section_number"].(string)

+ 7 - 4
controllers/new_mobile_api_controllers/new_manage_api_controller.go Visa fil

@@ -38,13 +38,16 @@ func (this *NewManageApiController) GetDisInfectionTime() {
38 38
 	scheduleweek, _ := this.GetInt64("schedule_week")
39 39
 	fmt.Println(scheduleweek)
40 40
 	scheduledate, _ := this.GetInt64("schedule_date")
41
+
42
+	//根据床位号获取设备型号
43
+	unitType, _ := service.GetUnitType(bedid, orgid)
41 44
 	//查询使用登记最后一条消毒记录
42 45
 	infomation, err := service.GetLaseDeviceInfomation(orgid, bedid, scheduledate)
43 46
 	fmt.Println("infomation========", infomation)
44 47
 	fmt.Println("err-------", err)
45 48
 	if err == gorm.ErrRecordNotFound {
46 49
 		//查询改设备是否有消毒计划
47
-		plan, errcode := service.GetDisInfectionTime(orgid, bedid, scheduletype, scheduleweek)
50
+		plan, errcode := service.GetDisInfectionTime(orgid, unitType.UnitType, scheduletype, scheduleweek)
48 51
 		//如果没有消毒计划,去查询该设备的上次消毒时间
49 52
 		if errcode == gorm.ErrRecordNotFound {
50 53
 			infor, errco := service.GetLaseDeviceInfomationTwo(orgid, bedid)
@@ -128,9 +131,9 @@ func (this *NewManageApiController) SaveDisInfectionInfo() {
128 131
 	fmt.Println("透析减少", dislysis.WeightLoss)
129 132
 	//			//根据床位号获取设备id
130 133
 	addmacher, _ := service.GetEquimentIDTwo(bedid, orgid)
131
-	unitype, _ := strconv.ParseInt(addmacher.UnitType, 10, 64)
132
-	fmt.Println(unitype)
133
-	plan, errplan := service.GetDisinfectionTwo(unitype, scheduletype, orgid)
134
+	//unitype, _ := strconv.ParseInt(addmacher.UnitType, 10, 64)
135
+	//fmt.Println(unitype)
136
+	plan, errplan := service.GetDisinfectionTwo(addmacher.UnitType, scheduletype, orgid)
134 137
 	//counts, errplan := service.GetUserTotalCount(orgid, bedid)
135 138
 	//var usertoal  int64
136 139
 	//fmt.Println(usertoal)

+ 1 - 1
models/device_models.go Visa fil

@@ -215,7 +215,7 @@ type DeviceAddmacher struct {
215 215
 	DeviceName          string `gorm:"column:device_name" json:"device_name" form:"device_name"`
216 216
 	ManufactureFactory  string `gorm:"column:manufacture_factory" json:"manufacture_factory" form:"manufacture_factory"`
217 217
 	ServiceManufacturer string `gorm:"column:service_manufacturer" json:"service_manufacturer" form:"service_manufacturer"`
218
-	UnitType            string `gorm:"column:unit_type" json:"unit_type" form:"unit_type"`
218
+	UnitType            int64  `gorm:"column:unit_type" json:"unit_type" form:"unit_type"`
219 219
 	UseSection          string `gorm:"column:use_section" json:"use_section" form:"use_section"`
220 220
 	SectionNumber       string `gorm:"column:section_number" json:"section_number" form:"section_number"`
221 221
 	BuyDate             int64  `gorm:"column:buy_date" json:"buy_date" form:"buy_date"`

+ 2 - 2
service/auto_create_week_disinfection.go Visa fil

@@ -82,14 +82,14 @@ func AutoCreateWeekDisinfectionJob() {
82 82
 				fmt.Print("透析时长", dislysis.ActualTreatmentHour+'h'+dislysis.ActualTreatmentMinute+'m'+'i'+'n')
83 83
 				//			//根据床位号获取设备id
84 84
 				addmacher, _ := GetEquimentID(schedules.BedId, it.UserOrgId)
85
-				unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
85
+				//unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
86 86
 				fmt.Println(" 设备id", addmacher.ID)
87 87
 				//根据设备id获取设备类型
88 88
 				//equimentname, _ := GetAddmacher(addmacher.ID, it.UserOrgId)
89 89
 
90 90
 				fmt.Println("班次", it.SchedualType)
91 91
 				//查看该设备是否有消毒计划,无怎返回,有则添加
92
-				plan, errplan := GetDisinfection(unitype, it.SchedualType, it.UserOrgId)
92
+				plan, errplan := GetDisinfection(addmacher.UnitType, it.SchedualType, it.UserOrgId)
93 93
 				fmt.Print("plan", plan)
94 94
 				fmt.Println("错误是什么", errplan)
95 95
 				if errplan == gorm.ErrRecordNotFound {

+ 2 - 2
service/auto_create_week_plan.go Visa fil

@@ -77,14 +77,14 @@ func AutoCreateWeekPlanJob() {
77 77
 				fmt.Println("透后", err)
78 78
 				//			//根据床位号获取设备id
79 79
 				addmacher, _ := GetEquimentID(schedules.BedId, it.UserOrgId)
80
-				unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
80
+				//unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
81 81
 				fmt.Println(" 设备id", addmacher.ID)
82 82
 				//根据设备id获取设备类型
83 83
 				//equimentname, _ := GetAddmacher(addmacher.ID, it.UserOrgId)
84 84
 
85 85
 				fmt.Println("班次", it.SchedualType)
86 86
 				//查看该设备是否有消毒计划,无怎返回,有则添加
87
-				plan, errplan := GetDisinfection(unitype, it.SchedualType, it.UserOrgId)
87
+				plan, errplan := GetDisinfection(addmacher.UnitType, it.SchedualType, it.UserOrgId)
88 88
 				fmt.Print("plan", plan)
89 89
 				fmt.Println("错误", errplan)
90 90
 				if errplan == gorm.ErrRecordNotFound {

+ 9 - 2
service/manage_service.go Visa fil

@@ -1138,9 +1138,9 @@ func GetUserTotal(orgid int64, id int64) (models.DeviceAddmacher, error) {
1138 1138
 	return addmacher, err
1139 1139
 }
1140 1140
 
1141
-func GetDisInfectionTime(orgid int64, bedid int64, scheduletype int64, scheduleweek int64) (*models.DevicePlan, error) {
1141
+func GetDisInfectionTime(orgid int64, unitype int64, scheduletype int64, scheduleweek int64) (*models.DevicePlan, error) {
1142 1142
 	plan := models.DevicePlan{}
1143
-	err = UserReadDB().Model(&plan).Where("user_org_id = ? and bed_id = ? and classtime = ? and time = ? and status = 1", orgid, bedid, scheduletype, scheduleweek).Find(&plan).Error
1143
+	err = UserReadDB().Model(&plan).Where("user_org_id = ? and device_type = ? and classtime = ? and time = ? and status = 1", orgid, unitype, scheduletype, scheduleweek).Find(&plan).Error
1144 1144
 	if err == gorm.ErrRecordNotFound {
1145 1145
 		return nil, err
1146 1146
 	}
@@ -1150,6 +1150,13 @@ func GetDisInfectionTime(orgid int64, bedid int64, scheduletype int64, schedulew
1150 1150
 	return &plan, nil
1151 1151
 }
1152 1152
 
1153
+func GetUnitType(bedid int64, orgid int64) (models.DeviceAddmacher, error) {
1154
+
1155
+	addmacher := models.DeviceAddmacher{}
1156
+	err := UserReadDB().Model(&addmacher).Where("bed_id = ? and user_org_id = ? and status = 1", bedid, orgid).Find(&addmacher).Error
1157
+	return addmacher, err
1158
+}
1159
+
1153 1160
 func GetLaseDeviceInfomation(orgid int64, bedid int64, date int64) (*models.DeviceInformation, error) {
1154 1161
 
1155 1162
 	information := models.DeviceInformation{}