28169 1 месяц назад
Родитель
Сommit
e7e77b0dde

+ 6 - 0
controllers/his_api_controller.go Просмотреть файл

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

+ 6 - 2
controllers/schedule_api_controller.go Просмотреть файл

@@ -2852,8 +2852,8 @@ func (this *ScheduleApiController) ExportSchedule() {
2852 2852
 	theTimeStart, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
2853 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 2858
 	if dataBody["failed_schedule"] != nil || reflect.TypeOf(dataBody["failed_schedule"]).String() == "[]interface {}" {
2859 2859
 		tempSchedule := dataBody["failed_schedule"].([]interface{})
@@ -4096,6 +4096,10 @@ func (this *ScheduleApiController) GetNextWeekDaySchedule() {
4096 4096
 		solutionLastWeek, _ := service.GetDialysisSolutionLastWeek(item.UserOrgId, item.PatientId, item.ModeId)
4097 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 4104
 	if err != nil {
4101 4105
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

+ 2 - 0
models/schedule_models.go Просмотреть файл

@@ -330,6 +330,7 @@ type WeekScheduleSix struct {
330 330
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate"`
331 331
 	XtDialysisOrderSix         XtDialysisOrderSix         `json:"dialysis_order" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
332 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 336
 func (WeekScheduleSix) TableName() string {
@@ -419,6 +420,7 @@ type VmBloodSchedule struct {
419 420
 	XtAssessmentAfterDislysis  XtAssessmentAfterDislysis  `gorm:"ForeignKey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate" json:"xt_assesment_after_dislysis"`
420 421
 	LastAfterWeight            AssessmentAfterDislysis    `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
421 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 426
 func (VmBloodSchedule) TableName() string {

+ 2 - 0
service/dialysis_solution_service.go Просмотреть файл

@@ -676,6 +676,7 @@ func GetDialysisGatherList(keywords string, limit int64, page int64, partition_i
676 676
 				return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgID, scheduleDate)
677 677
 			}).
678 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 680
 			Preload("XtDoctorAdviceOne", "status = 1 AND user_org_id = ? and advice_date = ? and (advice_type = 2 or advice_type =3)", orgID, scheduleDate).
680 681
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
681 682
 	} else {
@@ -686,6 +687,7 @@ func GetDialysisGatherList(keywords string, limit int64, page int64, partition_i
686 687
 			Preload("XtAssessmentBeforeDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
687 688
 			Preload("ReceiveTreatmentAsses", "status = 1 AND user_org_id = ? and record_date = ?", orgID, scheduleDate).
688 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 691
 			Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ? and advice_date = ? and advice_type = 1", orgID, scheduleDate).
690 692
 			Preload("XtDoctorAdviceOne", "status = 1 AND user_org_id = ? and advice_date = ? and (advice_type = 2 or advice_type =3)", orgID, scheduleDate).
691 693
 			Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {

+ 1 - 2
service/new_warehouse_service.go Просмотреть файл

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