Browse Source

2024/6/17

28169 1 month ago
parent
commit
e7e77b0dde

+ 6 - 0
controllers/his_api_controller.go View File

3749
 
3749
 
3750
 								errcode := c.setProjectWithJSON(&p, project.(map[string]interface{}))
3750
 								errcode := c.setProjectWithJSON(&p, project.(map[string]interface{}))
3751
 								if errcode > 0 {
3751
 								if errcode > 0 {
3752
+									tx.Rollback()
3752
 									c.ServeFailJSONWithSGJErrorCode(errcode)
3753
 									c.ServeFailJSONWithSGJErrorCode(errcode)
3753
 									return
3754
 									return
3754
 								}
3755
 								}
3787
 											goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
3788
 											goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
3788
 											//表示该耗材已经停用,不能保存
3789
 											//表示该耗材已经停用,不能保存
3789
 											if goodInfoSeven.ID == 0 {
3790
 											if goodInfoSeven.ID == 0 {
3791
+												tx.Rollback()
3790
 												goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
3792
 												goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
3791
 												c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
3793
 												c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
3794
+
3792
 												return
3795
 												return
3796
+
3793
 											}
3797
 											}
3794
 
3798
 
3795
 											goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
3799
 											goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
3796
 											if goodInfoOne.SumCount == 0 {
3800
 											if goodInfoOne.SumCount == 0 {
3801
+												tx.Rollback()
3797
 												c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
3802
 												c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
3803
+
3798
 												return
3804
 												return
3799
 											}
3805
 											}
3800
 										}
3806
 										}

+ 6 - 2
controllers/schedule_api_controller.go View File

2852
 	theTimeStart, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
2852
 	theTimeStart, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
2853
 	theTimeEnd, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
2853
 	theTimeEnd, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
2854
 
2854
 
2855
-	fmt.Println("theTimeStart23232322332322323", theTimeStart.Unix())
2856
-	fmt.Println("theTimeStart23232322332322323", theTimeEnd.Unix())
2855
+	fmt.Println("theTimeStart", theTimeStart.Unix())
2856
+	fmt.Println("theTimeEnd", theTimeEnd.Unix())
2857
 
2857
 
2858
 	if dataBody["failed_schedule"] != nil || reflect.TypeOf(dataBody["failed_schedule"]).String() == "[]interface {}" {
2858
 	if dataBody["failed_schedule"] != nil || reflect.TypeOf(dataBody["failed_schedule"]).String() == "[]interface {}" {
2859
 		tempSchedule := dataBody["failed_schedule"].([]interface{})
2859
 		tempSchedule := dataBody["failed_schedule"].([]interface{})
4096
 		solutionLastWeek, _ := service.GetDialysisSolutionLastWeek(item.UserOrgId, item.PatientId, item.ModeId)
4096
 		solutionLastWeek, _ := service.GetDialysisSolutionLastWeek(item.UserOrgId, item.PatientId, item.ModeId)
4097
 		item.DialysisSolution = solutionLastWeek
4097
 		item.DialysisSolution = solutionLastWeek
4098
 
4098
 
4099
+		templateList, _ := service.GetHisPrescriptionTemplateList(item.UserOrgId, item.PatientId, item.ModeId)
4100
+
4101
+		item.HisPrescriptionTemplate = templateList
4102
+
4099
 	}
4103
 	}
4100
 	if err != nil {
4104
 	if err != nil {
4101
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4105
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

+ 2 - 0
models/schedule_models.go View File

330
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate"`
330
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate"`
331
 	XtDialysisOrderSix         XtDialysisOrderSix         `json:"dialysis_order" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
331
 	XtDialysisOrderSix         XtDialysisOrderSix         `json:"dialysis_order" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
332
 	DialysisPrescription       NewDialysisPrescription    `json:"prescription" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
332
 	DialysisPrescription       NewDialysisPrescription    `json:"prescription" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
333
+	HisPrescriptionTemplate    HisPrescriptionTemplateSix `json:"his_prescription_template" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId;"`
333
 }
334
 }
334
 
335
 
335
 func (WeekScheduleSix) TableName() string {
336
 func (WeekScheduleSix) TableName() string {
419
 	XtAssessmentAfterDislysis  XtAssessmentAfterDislysis  `gorm:"ForeignKey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_assesment_after_dislysis"`
420
 	XtAssessmentAfterDislysis  XtAssessmentAfterDislysis  `gorm:"ForeignKey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_assesment_after_dislysis"`
420
 	LastAfterWeight            AssessmentAfterDislysis    `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
421
 	LastAfterWeight            AssessmentAfterDislysis    `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
421
 	DialysisMachineName        string                     `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
422
 	DialysisMachineName        string                     `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
423
+	LongDoctorAdvice           []*XtDoctorAdvice          `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"long_doctor_advice"`
422
 }
424
 }
423
 
425
 
424
 func (VmBloodSchedule) TableName() string {
426
 func (VmBloodSchedule) TableName() string {

+ 2 - 0
service/dialysis_solution_service.go View File

676
 				return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgID, scheduleDate)
676
 				return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgID, scheduleDate)
677
 			}).
677
 			}).
678
 			Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ? and advice_type = 1", orgID, scheduleDate).
678
 			Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ? and advice_type = 1", orgID, scheduleDate).
679
+			Preload("LongDoctorAdvice", "status = 1 AND user_org_id = ? and advice_type =1", orgID).
679
 			Preload("XtDoctorAdviceOne", "status = 1 AND user_org_id = ? and advice_date = ? and (advice_type = 2 or advice_type =3)", orgID, scheduleDate).
680
 			Preload("XtDoctorAdviceOne", "status = 1 AND user_org_id = ? and advice_date = ? and (advice_type = 2 or advice_type =3)", orgID, scheduleDate).
680
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
681
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
681
 	} else {
682
 	} else {
686
 			Preload("XtAssessmentBeforeDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
687
 			Preload("XtAssessmentBeforeDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
687
 			Preload("ReceiveTreatmentAsses", "status = 1 AND user_org_id = ? and record_date = ?", orgID, scheduleDate).
688
 			Preload("ReceiveTreatmentAsses", "status = 1 AND user_org_id = ? and record_date = ?", orgID, scheduleDate).
688
 			Preload("XtAssessmentAfterDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
689
 			Preload("XtAssessmentAfterDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
690
+			Preload("LongDoctorAdvice", "status = 1 AND user_org_id = ? and advice_type =1", orgID).
689
 			Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ? and advice_type = 1", orgID, scheduleDate).
691
 			Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ? and advice_type = 1", orgID, scheduleDate).
690
 			Preload("XtDoctorAdviceOne", "status = 1 AND user_org_id = ? and advice_date = ? and (advice_type = 2 or advice_type =3)", orgID, scheduleDate).
692
 			Preload("XtDoctorAdviceOne", "status = 1 AND user_org_id = ? and advice_date = ? and (advice_type = 2 or advice_type =3)", orgID, scheduleDate).
691
 			Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
693
 			Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {

+ 1 - 2
service/new_warehouse_service.go View File

4607
 
4607
 
4608
 		if drup.MaxUnit != drup.MinUnit {
4608
 		if drup.MaxUnit != drup.MinUnit {
4609
 			if warehouse.StockMaxNumber < 0 && warehouse.StockMinNumber < 0 {
4609
 			if warehouse.StockMaxNumber < 0 && warehouse.StockMinNumber < 0 {
4610
+				tx.Rollback()
4610
 				return errors.New("库存数量不足")
4611
 				return errors.New("库存数量不足")
4611
 			}
4612
 			}
4612
 		}
4613
 		}
4671
 
4672
 
4672
 		}
4673
 		}
4673
 
4674
 
4674
-		fmt.Println("药品追溯码-------------------------------------------------------", advice.DrugCode)
4675
-
4676
 		drugflow := models.DrugFlow{
4675
 		drugflow := models.DrugFlow{
4677
 			WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
4676
 			WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
4678
 			WarehouseOutId:          warehouseout.ID,
4677
 			WarehouseOutId:          warehouseout.ID,