28169 il y a 1 an
Parent
révision
1da0a59045

+ 32 - 0
controllers/manage_api_controller.go Voir le fichier

@@ -145,6 +145,8 @@ func ManageRouters() {
145 145
 	beego.Router("/api/manage/getobjecttabledisinfectbyidlist", &MachineApiController{}, "Get:GetObjectTableDisinfectByList")
146 146
 	beego.Router("/api/manage/updateobjecttabledisinfect", &MachineApiController{}, "Post:UpdateObjectTableDisinfect")
147 147
 	beego.Router("/api/manage/deleteobjecttabledisinfect", &MachineApiController{}, "Get:DeleteObjectTableDisinfect")
148
+	beego.Router("/api/manage/getairdisinfectionlongtime", &MachineApiController{}, "Get:GetAirDisinfectionLongTime")
149
+	beego.Router("/api/manage/getobjcttabledisinfectlongtime", &MachineApiController{}, "Get:GetObjectDisInfectionLongTime")
148 150
 }
149 151
 
150 152
 func (this *MachineApiController) SaveManageInfo() {
@@ -5389,3 +5391,33 @@ func (this *MachineApiController) DeleteObjectTableDisinfect() {
5389 5391
 	this.ServeSuccessJSON(returnData)
5390 5392
 	return
5391 5393
 }
5394
+
5395
+func (this *MachineApiController) GetAirDisinfectionLongTime() {
5396
+
5397
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5398
+
5399
+	list, err := service.GetAirDisInfectionLongTime(orgId)
5400
+
5401
+	if err != nil {
5402
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
5403
+		return
5404
+	}
5405
+	this.ServeSuccessJSON(map[string]interface{}{
5406
+		"list": list,
5407
+	})
5408
+}
5409
+
5410
+func (this *MachineApiController) GetObjectDisInfectionLongTime() {
5411
+
5412
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5413
+
5414
+	list, err := service.GetObjectDisInfectionLongTime(orgId)
5415
+
5416
+	if err != nil {
5417
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
5418
+		return
5419
+	}
5420
+	this.ServeSuccessJSON(map[string]interface{}{
5421
+		"list": list,
5422
+	})
5423
+}

+ 92 - 86
controllers/mobile_api_controllers/patient_api_controller.go Voir le fichier

@@ -688,20 +688,13 @@ func (c *PatientApiController) ExecDoctorAdvice() {
688 688
 
689 689
 		if drugStockConfig.IsOpen == 1 {
690 690
 			if groupno > 0 {
691
-				advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
692
-
693
-				isHasWay := false //用来判断是否包含来自药品库的医嘱
694
-				for _, item := range advices {
695
-					if item.Way == 1 {
696
-						isHasWay = true
697
-					}
691
+				advices, _ := service.FindAllDoctorAdviceByGoroupNoTwety(adminUserInfo.Org.Id, groupno)
698 692
 
699
-				}
700
-
701
-				if isHasWay {
693
+				if len(advices) > 0 {
702 694
 					var total int64
703 695
 					var prescribing_number_total int64
704 696
 
697
+					//判断库存
705 698
 					for _, item := range advices {
706 699
 						if item.Way == 1 {
707 700
 							houseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
@@ -753,39 +746,22 @@ func (c *PatientApiController) ExecDoctorAdvice() {
753 746
 								}
754 747
 							}
755 748
 
756
-							if prescribing_number_total <= total {
749
+						}
750
+					}
757 751
 
758
-								//查询是否出库按钮开启
759
-								adviceSetting, _ := service.FindAdviceSettingById(item.UserOrgId)
760
-								if adviceSetting.IsAdviceOpen == 1 {
761
-									//查询是否出库按钮开启
762
-									prescriptionConfig, _ := service.FindPrescriptionConfigById(item.UserOrgId)
763
-									pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
764
-									if prescriptionConfig.IsOpen == 1 {
765
-										if medical.IsUse == 2 {
766
-											if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
767
-												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
768
-											}
769
-											if pharmacyConfig.IsOpen != 1 {
770
-												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
771
-											}
752
+					//出库
753
+					for _, item := range advices {
754
+						if item.Way == 1 {
772 755
 
773
-											//更新字典里面的库存
774
-											stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
775
-											var sum_count int64
776
-											for _, its := range stockInfo {
777
-												if its.MaxUnit == medical.MaxUnit {
778
-													its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
779
-												}
780
-												sum_count += its.StockMaxNumber + its.StockMinNumber
781
-											}
782
-											service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
783
-											//剩余库存
784
-											service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
785
-										}
786
-									}
787
-								} else {
788
-									pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
756
+							//查询是否出库按钮开启
757
+							adviceSetting, _ := service.FindAdviceSettingById(item.UserOrgId)
758
+							//查询改药品信息
759
+							medical, _ := service.GetBaseDrugMedical(item.DrugId)
760
+							if adviceSetting.IsAdviceOpen == 1 {
761
+								//查询是否出库按钮开启
762
+								prescriptionConfig, _ := service.FindPrescriptionConfigById(item.UserOrgId)
763
+								pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
764
+								if prescriptionConfig.IsOpen == 1 {
789 765
 									if medical.IsUse == 2 {
790 766
 										if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
791 767
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
@@ -794,6 +770,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
794 770
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
795 771
 										}
796 772
 
773
+										//更新字典里面的库存
797 774
 										stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
798 775
 										var sum_count int64
799 776
 										for _, its := range stockInfo {
@@ -807,23 +784,47 @@ func (c *PatientApiController) ExecDoctorAdvice() {
807 784
 										service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
808 785
 									}
809 786
 								}
787
+							} else {
788
+								pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
789
+								if medical.IsUse == 2 {
790
+									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
791
+										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
792
+									}
793
+									if pharmacyConfig.IsOpen != 1 {
794
+										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
795
+									}
796
+
797
+									stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
798
+									var sum_count int64
799
+									for _, its := range stockInfo {
800
+										if its.MaxUnit == medical.MaxUnit {
801
+											its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
802
+										}
803
+										sum_count += its.StockMaxNumber + its.StockMinNumber
804
+									}
805
+									service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
806
+									//剩余库存
807
+									service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
808
+								}
810 809
 							}
811 810
 						}
811
+
812 812
 					}
813 813
 
814 814
 				}
815
-			} else {
816 815
 
817
-				advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
818
-				isHasWay := false //用来判断是否包含来自药品库的医嘱
816
+				c.ServeSuccessJSON(map[string]interface{}{
817
+					"msg":    "1",
818
+					"advice": advice,
819
+					"ids":    ids,
820
+				})
821
+				return
819 822
 
820
-				for _, item := range advices {
821
-					if item.Way == 1 {
822
-						isHasWay = true
823
-					}
824
-				}
823
+			} else {
824
+
825
+				advices, _ := service.FindDoctorAdviceByIdsTwety(adminUserInfo.Org.Id, ids)
825 826
 
826
-				if isHasWay {
827
+				if len(advices) > 0 {
827 828
 					var total int64
828 829
 					var prescribing_number_total int64
829 830
 					for _, item := range advices {
@@ -880,51 +881,56 @@ func (c *PatientApiController) ExecDoctorAdvice() {
880 881
 								}
881 882
 							}
882 883
 
883
-							if prescribing_number_total <= total {
884
-								pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
885
-								if medical.IsUse == 2 {
886
-									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
887
-										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
888
-									}
889
-									if pharmacyConfig.IsOpen != 1 {
890
-										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
891
-									}
884
+						}
885
+					}
892 886
 
893
-									//更新字典里面的库存
894
-									stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
895
-									var sum_count int64
896
-									for _, its := range stockInfo {
897
-										baseDrug, _ := service.GetBaseDrugMedical(its.DrugId)
898
-										if its.MaxUnit == baseDrug.MaxUnit {
899
-											its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
900
-										}
901
-										sum_count += its.StockMaxNumber + its.StockMinNumber
902
-									}
903
-									service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
904
-									//剩余库存
905
-									service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
887
+					for _, item := range advices {
888
+						if item.Way == 1 {
889
+							//查询改药品信息
890
+							medical, _ := service.GetBaseDrugMedical(item.DrugId)
891
+							pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
892
+							if medical.IsUse == 2 {
893
+								if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
894
+									service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
906 895
 								}
907
-								if medical.IsUse == 1 {
908
-									c.ServeSuccessJSON(map[string]interface{}{
909
-										"msg":    "1",
910
-										"advice": advice,
911
-										"ids":    ids,
912
-									})
913
-									return
896
+								if pharmacyConfig.IsOpen != 1 {
897
+									service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
914 898
 								}
915 899
 
900
+								//更新字典里面的库存
901
+								stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
902
+								var sum_count int64
903
+								for _, its := range stockInfo {
904
+									baseDrug, _ := service.GetBaseDrugMedical(its.DrugId)
905
+									if its.MaxUnit == baseDrug.MaxUnit {
906
+										its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
907
+									}
908
+									sum_count += its.StockMaxNumber + its.StockMinNumber
909
+								}
910
+								service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
911
+								//剩余库存
912
+								service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
916 913
 							}
914
+							if medical.IsUse == 1 {
915
+								c.ServeSuccessJSON(map[string]interface{}{
916
+									"msg":    "1",
917
+									"advice": advice,
918
+									"ids":    ids,
919
+								})
920
+								return
921
+							}
922
+
917 923
 						}
924
+
918 925
 					}
919 926
 				}
927
+				c.ServeSuccessJSON(map[string]interface{}{
928
+					"msg":    "1",
929
+					"advice": advice,
930
+					"ids":    ids,
931
+				})
932
+				return
920 933
 			}
921
-
922
-			c.ServeSuccessJSON(map[string]interface{}{
923
-				"msg":    "1",
924
-				"advice": advice,
925
-				"ids":    ids,
926
-			})
927
-			return
928 934
 		}
929 935
 
930 936
 		if privateDrugConfig != nil && privateDrugConfig.DrugStart == 1 {

+ 1 - 1
controllers/print_data_api_controller.go Voir le fichier

@@ -339,7 +339,7 @@ func (this *PrintDataAPIController) GetGoodDetailPrintList() {
339 339
 	if types == 2 {
340 340
 		//list, err := service.GetWarehouseOutInfoGoodDetailPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, limit, page)
341 341
 		list, _ := service.GetWarehouseOutInfoPrintList(adminUserInfo.CurrentOrgId, startTime, endTime)
342
-		fmt.Println("list23323232233232", list)
342
+
343 343
 		stockTotal, err := service.GetOutStockTotalCountTwo(startTime, endTime, adminUserInfo.CurrentOrgId)
344 344
 		if err != nil {
345 345
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

+ 1 - 1
service/dialysis_service.go Voir le fichier

@@ -1111,7 +1111,7 @@ func BatchCheckOldDoctorAdvice(m *models.DoctorAdvice, ids []string, org_id int6
1111 1111
 
1112 1112
 func ModifyScheduleMode(mode_id int64, patient_id int64, recordDate int64, org_id int64, dialysis_machine_name string) {
1113 1113
 	ut := writeDb.Begin()
1114
-	err = writeDb.Model(&models.Schedule{}).Where("status = 1   AND user_org_id = ? AND patient_id = ? AND schedule_date = ?", org_id, patient_id, recordDate).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "mode_id": mode_id, "dialysis_machine_name": dialysis_machine_name}).Error
1114
+	err = writeDb.Model(&models.Schedule{}).Where("status = 1   AND user_org_id = ? AND patient_id = ? AND schedule_date >= ?", org_id, patient_id, recordDate).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "mode_id": mode_id, "dialysis_machine_name": dialysis_machine_name}).Error
1115 1115
 	if err != nil {
1116 1116
 		ut.Rollback()
1117 1117
 		return

+ 12 - 0
service/manage_service.go Voir le fichier

@@ -1729,3 +1729,15 @@ func DeleteObjectTableDisinfect(id int64) error {
1729 1729
 	err := XTWriteDB().Model(&models.XtNewObjectDisinfect{}).Where("id=? and status= 1", id).Updates(map[string]interface{}{"status": 0}).Error
1730 1730
 	return err
1731 1731
 }
1732
+
1733
+func GetAirDisInfectionLongTime(user_org_id int64) (list []*models.XtNewAriDisinfect, err error) {
1734
+
1735
+	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&list).Error
1736
+	return
1737
+}
1738
+
1739
+func GetObjectDisInfectionLongTime(user_org_id int64) (list []*models.XtNewObjectDisinfect, err error) {
1740
+
1741
+	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&list).Error
1742
+	return
1743
+}

+ 10 - 0
service/patient_service.go Voir le fichier

@@ -1580,11 +1580,21 @@ func FindAllDoctorAdviceByGoroupNo(orgID int64, groupno int64) (advice []models.
1580 1580
 	return
1581 1581
 }
1582 1582
 
1583
+func FindAllDoctorAdviceByGoroupNoTwety(orgID int64, groupno int64) (advice []models.DoctorAdvice, err error) {
1584
+	err = readDb.Model(&models.DoctorAdvice{}).Where("user_org_id=?  AND groupno = ? AND status = 1 and (drug_id >0 or drug_name_id >0)", orgID, groupno).Find(&advice).Error
1585
+	return
1586
+}
1587
+
1583 1588
 func FindDoctorAdviceByIds(orgID int64, ids []string) (advice []models.DoctorAdvice, err error) {
1584 1589
 	err = readDb.Model(&models.DoctorAdvice{}).Where("id IN (?) AND user_org_id = ? AND status = 1", ids, orgID).Find(&advice).Error
1585 1590
 	return
1586 1591
 }
1587 1592
 
1593
+func FindDoctorAdviceByIdsTwety(orgID int64, ids []string) (advice []models.DoctorAdvice, err error) {
1594
+	err = readDb.Model(&models.DoctorAdvice{}).Where("id IN (?) AND user_org_id = ? AND status = 1 and (drug_id >0 or drug_name_id >0)", ids, orgID).Find(&advice).Error
1595
+	return
1596
+}
1597
+
1588 1598
 func BatchDeleteDoctorAdvice(ids []string, user_id int64) (err error) {
1589 1599
 	ut := writeDb.Begin()
1590 1600
 	err = ut.Model(&models.DoctorAdvice{}).Where("status = 1   AND id IN (?)", ids).Updates(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix(), "modifier": user_id}).Error