Browse Source

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

csx 4 years ago
parent
commit
a767f28ecc

+ 11 - 11
controllers/dialysis_api_controller.go View File

244
 	//fmt.Println("下机前推注鱼精蛋白",push_the_protamine)
244
 	//fmt.Println("下机前推注鱼精蛋白",push_the_protamine)
245
 	// var prescription_doctor int64
245
 	// var prescription_doctor int64
246
 	blood := c.GetString("blood")
246
 	blood := c.GetString("blood")
247
-	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
248
-	dialysis_irrigation := c.GetString("dialysis_irrigation")
247
+	//dialysis_dialyszers := c.GetString("dialysis_dialyszers")
248
+	//dialysis_irrigation := c.GetString("dialysis_irrigation")
249
 	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
249
 	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
250
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
250
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
251
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
251
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
326
 		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
326
 		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
327
 		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
327
 		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
328
 		Blood:                      blood,
328
 		Blood:                      blood,
329
-		DialysisDialyszers:         dialysis_dialyszers,
330
-		DialysisIrrigation:         dialysis_irrigation,
331
-		AntioxidantCommodityName:   antioxidant_commodity_name,
329
+		//DialysisDialyszers:         dialysis_dialyszers,
330
+		//DialysisIrrigation:         dialysis_irrigation,
331
+		AntioxidantCommodityName: antioxidant_commodity_name,
332
 	}
332
 	}
333
 
333
 
334
 	if appRole.UserType == 2 || appRole.UserType == 1 {
334
 	if appRole.UserType == 2 || appRole.UserType == 1 {
495
 	anticoagulant_stop_time_hour, _ := c.GetInt64("anticoagulant_stop_time_hour", 0)
495
 	anticoagulant_stop_time_hour, _ := c.GetInt64("anticoagulant_stop_time_hour", 0)
496
 	anticoagulant_stop_time_min, _ := c.GetInt64("anticoagulant_stop_time_min", 0)
496
 	anticoagulant_stop_time_min, _ := c.GetInt64("anticoagulant_stop_time_min", 0)
497
 	blood := c.GetString("blood")
497
 	blood := c.GetString("blood")
498
-	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
499
-	dialysis_irrigation := c.GetString("dialysis_irrigation")
498
+	//dialysis_dialyszers := c.GetString("dialysis_dialyszers")
499
+	//dialysis_irrigation := c.GetString("dialysis_irrigation")
500
 	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
500
 	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
501
 	var prescription_doctor int64
501
 	var prescription_doctor int64
502
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
502
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
588
 		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
588
 		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
589
 		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
589
 		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
590
 		Blood:                     blood,
590
 		Blood:                     blood,
591
-		DialysisIrrigation:        dialysis_irrigation,
592
-		DialysisDialyszers:        dialysis_dialyszers,
593
-		AntioxidantCommodityName:  antioxidant_commodity_name,
591
+		//DialysisIrrigation:        dialysis_irrigation,
592
+		//DialysisDialyszers:        dialysis_dialyszers,
593
+		AntioxidantCommodityName: antioxidant_commodity_name,
594
 	}
594
 	}
595
 
595
 
596
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
596
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1280
 		dewater_amount = 0
1280
 		dewater_amount = 0
1281
 		if evaluation.DryWeight > 0 {
1281
 		if evaluation.DryWeight > 0 {
1282
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
1282
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
1283
-			if templateInfo.TemplateId == 17 && templateInfo.TemplateId == 22 && templateInfo.TemplateId == 21 {
1283
+			if templateInfo.TemplateId == 17 || templateInfo.TemplateId == 22 || templateInfo.TemplateId == 21 || templateInfo.TemplateId == 34 {
1284
 				dewater_amount = dewater_amount * 1000
1284
 				dewater_amount = dewater_amount * 1000
1285
 			}
1285
 			}
1286
 			if dewater_amount <= 0 {
1286
 			if dewater_amount <= 0 {

+ 1 - 1
controllers/his_api_controller.go View File

955
 	doctor_advice := c.GetString("doctor_advice")
955
 	doctor_advice := c.GetString("doctor_advice")
956
 	remark := c.GetString("remark")
956
 	remark := c.GetString("remark")
957
 	breathingfloat, _ := strconv.ParseFloat(breathing, 64)
957
 	breathingfloat, _ := strconv.ParseFloat(breathing, 64)
958
-	fmt.Println("breathingfloat", breathingfloat)
958
+	//fmt.Println("breathingfloat", breathingfloat)
959
 	sick, _ := c.GetInt64("sick")
959
 	sick, _ := c.GetInt64("sick")
960
 	diagnose, _ := c.GetInt64("diagnose")
960
 	diagnose, _ := c.GetInt64("diagnose")
961
 	timeLayout := "2006-01-02"
961
 	timeLayout := "2006-01-02"

+ 1 - 1
controllers/mobile_api_controllers/patient_api_controller.go View File

1545
 	if evaluation.DryWeight > 0 {
1545
 	if evaluation.DryWeight > 0 {
1546
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
1546
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
1547
 
1547
 
1548
-		if template.TemplateId == 17 || template.TemplateId == 22 || template.TemplateId == 21 || template.TemplateId == 26 {
1548
+		if template.TemplateId == 17 || template.TemplateId == 22 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 34 {
1549
 			dewater_amount = dewater_amount * 1000
1549
 			dewater_amount = dewater_amount * 1000
1550
 
1550
 
1551
 		}
1551
 		}

+ 25 - 7
controllers/schedule_api_controller.go View File

548
 
548
 
549
 	schedule.UpdatedTime = time.Now().Unix()
549
 	schedule.UpdatedTime = time.Now().Unix()
550
 	err = service.UpdateSchedule(schedule)
550
 	err = service.UpdateSchedule(schedule)
551
-	if err != nil {
552
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeChangeScheduleFail)
553
-		return
551
+
552
+	prescription := models.DialysisPrescription{
553
+		ModeId: schedule.ModeId,
554
+	}
555
+	_, errcode := service.GetDialysisPrescribe(schedule.UserOrgId, schedule.PatientId, schedule.ScheduleDate)
556
+	if errcode == gorm.ErrRecordNotFound {
557
+		if err != nil {
558
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeChangeScheduleFail)
559
+			return
560
+		}
561
+		c.ServeSuccessJSON(map[string]interface{}{
562
+			"msg":      "ok",
563
+			"schedule": &schedule,
564
+		})
565
+	} else if errcode == nil {
566
+		err = service.UpdatedDialysisPrescription(&prescription, schedule.ScheduleDate, schedule.PatientId, schedule.UserOrgId)
567
+
568
+		if err != nil {
569
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeChangeScheduleFail)
570
+			return
571
+		}
572
+		c.ServeSuccessJSON(map[string]interface{}{
573
+			"msg":      "ok",
574
+			"schedule": &schedule,
575
+		})
554
 	}
576
 	}
555
-	c.ServeSuccessJSON(map[string]interface{}{
556
-		"msg":      "ok",
557
-		"schedule": &schedule,
558
-	})
559
 }
577
 }
560
 
578
 
561
 // /api/schedule/print/initdata [get]
579
 // /api/schedule/print/initdata [get]

+ 13 - 11
controllers/stock_api_controller.go View File

288
 		PinYin:           pinyin,
288
 		PinYin:           pinyin,
289
 	}
289
 	}
290
 
290
 
291
-	_, errcode := service.GetManufacturerName(adminUserInfo.CurrentOrgId, manufacturer_name)
292
-	if errcode == gorm.ErrRecordNotFound {
293
-		err := service.ModifyManufacturer(&manufacturer)
291
+	Manufacturer, _ := service.GetManufacturerName(adminUserInfo.CurrentOrgId, manufacturer_name)
294
 
292
 
295
-		if err == nil {
296
-			c.ServeSuccessJSON(map[string]interface{}{
297
-				"manufacturer": manufacturer,
298
-			})
299
-		} else {
300
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
301
-		}
302
-	} else if errcode == nil {
293
+	if Manufacturer.ID > 0 && Manufacturer.ID != manufacturer.ID {
294
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeIdCardNoExist)
295
+		return
296
+	}
297
+
298
+	err := service.ModifyManufacturer(&manufacturer)
299
+
300
+	if err == nil {
301
+		c.ServeSuccessJSON(map[string]interface{}{
302
+			"manufacturer": manufacturer,
303
+		})
304
+	} else {
303
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
305
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
304
 	}
306
 	}
305
 
307
 

+ 6 - 0
service/schedule_service.go View File

713
 
713
 
714
 	return schedule, err
714
 	return schedule, err
715
 }
715
 }
716
+
717
+func UpdatedDialysisPrescription(prescription *models.DialysisPrescription, recordDate int64, patientid int64, orgid int64) error {
718
+
719
+	err := XTWriteDB().Model(&prescription).Where("record_date = ? and patient_id = ? and user_org_id = ?", recordDate, patientid, orgid).Update(map[string]interface{}{"mode_id": prescription.ModeId, "updated_time": time.Now().Unix()}).Error
720
+	return err
721
+}