XMLWAN 4 anni fa
parent
commit
2ebc731d83

+ 15 - 17
controllers/mobile_api_controllers/patient_api_controller.go Vedi File

@@ -552,11 +552,9 @@ func (c *PatientApiController) ExecDoctorAdvice() {
552 552
 	//}
553 553
 
554 554
 	var advice models.DoctorAdvice
555
-	var tempAdvices []models.DoctorAdvice
556 555
 
557 556
 	if groupno > 0 {
558
-		advices, _ := service.FindAllDoctorAdviceByGoroupNoTwo(adminUserInfo.Org.Id, groupno)
559
-		tempAdvices = advices
557
+		advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
560 558
 		for _, item := range advices {
561 559
 			if item.ExecutionState == 2 {
562 560
 				advice = item
@@ -564,9 +562,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
564 562
 			}
565 563
 		}
566 564
 	} else {
567
-		advices, _ := service.FindDoctorAdviceByIdsTwo(adminUserInfo.Org.Id, ids)
568
-		tempAdvices = advices
569
-
565
+		advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
570 566
 		for _, item := range advices {
571 567
 			if item.ExecutionState == 2 {
572 568
 				advice = item
@@ -626,10 +622,10 @@ func (c *PatientApiController) ExecDoctorAdvice() {
626 622
 
627 623
 	if drugStockConfig.IsOpen == 1 {
628 624
 		if groupno > 0 {
629
-			//advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
625
+			advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
630 626
 			isHasWay := false //用来判断是否包含来自药品库的医嘱
631 627
 			record_time := int64(0)
632
-			for _, item := range tempAdvices {
628
+			for _, item := range advices {
633 629
 				if item.Way == 1 {
634 630
 					isHasWay = true
635 631
 					record_time = item.RecordDate
@@ -666,7 +662,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
666 662
 					if err != nil {
667 663
 						utils.TraceLog("创建出库单失败 err = %v", err)
668 664
 					} else {
669
-						for _, item := range tempAdvices {
665
+						for _, item := range advices {
670 666
 							if item.Way == 1 {
671 667
 								if item.PrescribingNumber > 0 {
672 668
 									warehouseOutInfo := &models.DrugWarehouseOutInfo{
@@ -711,7 +707,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
711 707
 					}
712 708
 
713 709
 				} else if err == nil {
714
-					for _, item := range tempAdvices {
710
+					for _, item := range advices {
715 711
 						if item.Way == 1 {
716 712
 							outInfo, err := service.FindDrugStockOutInfoByTypeId(adminUserInfo.Org.Id, item.DrugId, out.ID, out.WarehouseOutOrderNumber)
717 713
 							if err == gorm.ErrRecordNotFound {
@@ -785,10 +781,10 @@ func (c *PatientApiController) ExecDoctorAdvice() {
785 781
 
786 782
 			}
787 783
 		} else {
788
-			//advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
784
+			advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
789 785
 			isHasWay := false //用来判断是否包含来自药品库的医嘱
790 786
 			record_time := int64(0)
791
-			for _, item := range tempAdvices {
787
+			for _, item := range advices {
792 788
 				if item.Way == 1 {
793 789
 					isHasWay = true
794 790
 					record_time = item.RecordDate
@@ -825,7 +821,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
825 821
 					if err != nil {
826 822
 						utils.TraceLog("创建出库单失败 err = %v", err)
827 823
 					} else {
828
-						for _, item := range tempAdvices {
824
+						for _, item := range advices {
829 825
 							if item.Way == 1 {
830 826
 								if item.PrescribingNumber > 0 {
831 827
 									warehouseOutInfo := &models.DrugWarehouseOutInfo{
@@ -870,7 +866,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
870 866
 					}
871 867
 
872 868
 				} else if err == nil {
873
-					for _, item := range tempAdvices {
869
+					for _, item := range advices {
874 870
 						if item.Way == 1 {
875 871
 							outInfo, err := service.FindDrugStockOutInfoByTypeId(adminUserInfo.Org.Id, item.DrugId, out.ID, out.WarehouseOutOrderNumber)
876 872
 							if err == gorm.ErrRecordNotFound {
@@ -954,8 +950,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
954 950
 
955 951
 	if privateDrugConfig != nil && privateDrugConfig.DrugStart == 1 {
956 952
 		if groupno > 0 {
957
-			//advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
958
-			for _, item := range tempAdvices {
953
+			advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
954
+			for _, item := range advices {
959 955
 
960 956
 				if item.ExecutionState == 1 && item.Way == 2 {
961 957
 					prescribingNumber := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
@@ -991,7 +987,9 @@ func (c *PatientApiController) ExecDoctorAdvice() {
991 987
 			}
992 988
 		} else {
993 989
 
994
-			for _, item := range tempAdvices {
990
+			advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
991
+			for _, item := range advices {
992
+				fmt.Println("item222222222222", item.ExecutionState)
995 993
 				if item.ExecutionState == 1 && item.Way == 2 {
996 994
 
997 995
 					prescribingNumber := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)

+ 5 - 5
controllers/new_mobile_api_controllers/dialysis_parameter_api_controller.go Vedi File

@@ -151,7 +151,7 @@ func (this *DialysisParamerterApiController) GetMobileCollectList() {
151 151
 	orgId := this.GetMobileAdminUserInfo().Org.Id
152 152
 	keyword := this.GetString("keyword")
153 153
 	//获取透析参数数据
154
-	schedule, err, _ := service.GetCollectList(limit, page, partitiontype, scheduletype, startime.Unix(), orgId, keyword)
154
+	//schedule, err, _ := service.GetCollectList(limit, page, partitiontype, scheduletype, startime.Unix(), orgId, keyword)
155 155
 	//查询今日排班的病人
156 156
 	patient, err := service.GetDialysisTodaySchedulePatient(orgId, startime.Unix(), page, limit, keyword)
157 157
 	var vlist []interface{}
@@ -176,9 +176,9 @@ func (this *DialysisParamerterApiController) GetMobileCollectList() {
176 176
 			"dialysis_goods": dialysisGoods,
177 177
 			"good_type":      goodTypes,
178 178
 			"total":          total,
179
-			"schedule":       schedule,
180
-			"prescription":   vlist,
181
-			"patient":        patient,
179
+			//"schedule":       schedule,
180
+			"prescription": vlist,
181
+			"patient":      patient,
182 182
 		})
183 183
 		return
184 184
 
@@ -200,7 +200,7 @@ func (this *DialysisParamerterApiController) GetMobileCollectList() {
200 200
 				"dialysis_goods": dialysisGoods,
201 201
 				"good_type":      goodTypes,
202 202
 				"total":          total,
203
-				"schedule":       schedule,
203
+				//"schedule":       schedule,
204 204
 				//"consumables":    consumables,
205 205
 				"prescription": vlist,
206 206
 				"reducelist":   clist,

+ 3 - 0
service/doctor_advice_service.go Vedi File

@@ -324,6 +324,9 @@ type DoctorAdvice struct {
324 324
 	TemplateId            string          `gorm:"column:template_id" json:"template_id"`
325 325
 	Modifier              int64           `gorm:"column:modifier" json:"modifier" form:"modifier"`
326 326
 	IsCheck               int64           `gorm:"-" json:"is_check" form:"is_check"`
327
+	Way                   int64           `gorm:"column:way" json:"way" form:"way"`
328
+	DrugId                int64           `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
329
+	DrugNameId            int64           `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
327 330
 }
328 331
 
329 332
 func (DoctorAdvice) TableName() string {

+ 13 - 0
service/mobile_dialysis_service.go Vedi File

@@ -639,6 +639,19 @@ func MobileGetDialysisPrescribe(orgID int64, patientID int64, recordDate int64)
639 639
 	return &record, nil
640 640
 }
641 641
 
642
+func MobileGetDialysisSchedual(orgID int64, patientID int64, scheduleDate int64) (*models.XtSchedule, error) {
643
+	var schedule models.XtSchedule
644
+	err := readDb.Model(&models.XtSchedule{}).Where("patient_id = ? and user_org_id = ? and status = 1 and schedule_date = ?", patientID, orgID, scheduleDate).First(&schedule).Error
645
+	if err != nil {
646
+		if err == gorm.ErrRecordNotFound {
647
+			return nil, nil
648
+		} else {
649
+			return nil, err
650
+		}
651
+	}
652
+	return &schedule, nil
653
+}
654
+
642 655
 // 透析方案
643 656
 func MobileGetDialysisSolution(orgID int64, patientID int64) (*models.DialysisSolution, error) {
644 657
 	var record models.DialysisSolution