Browse Source

11月8日库存管理

XMLWAN 3 years ago
parent
commit
b765af41cc

+ 5 - 1
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go View File

@@ -375,6 +375,7 @@ func (this *StaffScheduleApiController) UpdatePatientScheduleById() {
375 375
 func (this *StaffScheduleApiController) UpdateDialysisPrescription() {
376 376
 	patient_id, _ := this.GetInt64("patient_id")
377 377
 	start_time, _ := this.GetInt64("start_time")
378
+	mode_id, _ := this.GetInt64("mode_id")
378 379
 	dialyzer_perfusion_apparatus := this.GetString("dialyzer_perfusion_apparatus")
379 380
 	//更改透析模式
380 381
 	_, errcode := service.GetDialyisSolution(patient_id, start_time)
@@ -388,8 +389,10 @@ func (this *StaffScheduleApiController) UpdateDialysisPrescription() {
388 389
 			Status:                     1,
389 390
 			RecordDate:                 start_time,
390 391
 			CreatedTime:                time.Now().Unix(),
392
+			ModeId:                     mode_id,
391 393
 		}
392 394
 		err := service.CreateDialysisPrescription(&prescription)
395
+
393 396
 		if err != nil {
394 397
 			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
395 398
 			return
@@ -401,8 +404,9 @@ func (this *StaffScheduleApiController) UpdateDialysisPrescription() {
401 404
 		prescription := models.DialysisPrescription{
402 405
 			DialyzerPerfusionApparatus: dialyzer_perfusion_apparatus,
403 406
 			DialysisDialyszers:         dialyzer_perfusion_apparatus,
407
+			ModeId:                     mode_id,
404 408
 		}
405
-		err := service.UpdateDialysisPrescriptionOne(prescription, patient_id, start_time)
409
+		err := service.UpdateDialysisPrescriptionOne(prescription, patient_id, start_time, mode_id)
406 410
 		if err != nil {
407 411
 			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
408 412
 			return

+ 8 - 2
service/doctor_schedule_service.go View File

@@ -717,8 +717,14 @@ func CreateDialysisPrescription(prescription *models.DialysisPrescription) error
717 717
 	return err
718 718
 }
719 719
 
720
-func UpdateDialysisPrescriptionOne(prescription models.DialysisPrescription, patientid int64, recordate int64) error {
720
+func CreateDialysisSolution(solution models.DialysisSolution) error {
721 721
 
722
-	err := XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and status = 1", patientid, recordate).Updates(map[string]interface{}{"dialysis_dialyszers": prescription.DialysisDialyszers, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus}).Error
722
+	err := XTReadDB().Create(&solution).Error
723
+	return err
724
+}
725
+
726
+func UpdateDialysisPrescriptionOne(prescription models.DialysisPrescription, patientid int64, recordate int64, mode_id int64) error {
727
+
728
+	err := XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and status = 1 and mode_id = ?", patientid, recordate).Updates(map[string]interface{}{"dialysis_dialyszers": prescription.DialysisDialyszers, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "mode_id": mode_id}).Error
723 729
 	return err
724 730
 }