Browse Source

Merge remote-tracking branch 'origin/20220812' into 20220812

mainqaq 2 years ago
parent
commit
421c810203

+ 29 - 8
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -759,8 +759,13 @@ func (c *PatientApiController) ExecDoctorAdvice() {
759 759
 									prescriptionConfig, _ := service.FindPrescriptionConfigById(item.UserOrgId)
760 760
 									pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
761 761
 									if prescriptionConfig.IsOpen == 1 {
762
-										if medical.IsUse == 2 && pharmacyConfig.IsOpen != 1 {
763
-											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
762
+										if medical.IsUse == 2 {
763
+											if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 2 {
764
+												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
765
+											}
766
+											if pharmacyConfig.IsOpen != 1 {
767
+												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
768
+											}
764 769
 
765 770
 											//更新字典里面的库存
766 771
 											stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
@@ -773,8 +778,13 @@ func (c *PatientApiController) ExecDoctorAdvice() {
773 778
 									}
774 779
 								} else {
775 780
 									pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
776
-									if medical.IsUse == 2 && pharmacyConfig.IsOpen != 1 {
777
-										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
781
+									if medical.IsUse == 2 {
782
+										if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 2 {
783
+											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
784
+										}
785
+										if pharmacyConfig.IsOpen != 1 {
786
+											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
787
+										}
778 788
 
779 789
 										stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
780 790
 										var sum_count int64
@@ -864,8 +874,13 @@ func (c *PatientApiController) ExecDoctorAdvice() {
864 874
 
865 875
 							if prescribing_number_total <= total {
866 876
 								pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
867
-								if medical.IsUse == 2 && pharmacyConfig.IsOpen != 1 {
868
-									service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
877
+								if medical.IsUse == 2 {
878
+									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 2 {
879
+										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
880
+									}
881
+									if pharmacyConfig.IsOpen != 1 {
882
+										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
883
+									}
869 884
 
870 885
 									//更新字典里面的库存
871 886
 									stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
@@ -1169,10 +1184,16 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1169 1184
 
1170 1185
 						if prescribing_number_total <= total {
1171 1186
 							pharmacyConfig, _ := service.FindPharmacyConfig(advice.UserOrgId)
1172
-							if medical.IsUse == 2 && pharmacyConfig.IsOpen != 1 {
1187
+							if medical.IsUse == 2 {
1173 1188
 
1174 1189
 								if config.IsOpen != 1 {
1175
-									service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1190
+									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 2 {
1191
+										service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1192
+									}
1193
+									if pharmacyConfig.IsOpen != 1 {
1194
+										service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1195
+									}
1196
+
1176 1197
 									//更新字典里面的库存
1177 1198
 									stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1178 1199
 									var sum_count int64

+ 36 - 9
controllers/patient_api_controller.go View File

@@ -1711,8 +1711,14 @@ func (c *PatientApiController) ExecGroupAdvice() {
1711 1711
 			}
1712 1712
 			if prescribing_number_total <= total {
1713 1713
 				pharmacyConfig, _ := service.FindPharmacyConfig(advice.UserOrgId)
1714
-				if medical.IsUse == 2 && pharmacyConfig.IsOpen != 1 {
1715
-					service.DrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
1714
+				if medical.IsUse == 2 {
1715
+					if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 2 {
1716
+						service.DrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
1717
+					}
1718
+					if pharmacyConfig.IsOpen != 1 {
1719
+						service.DrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
1720
+					}
1721
+
1716 1722
 					//查询默认仓库
1717 1723
 					storeHouseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
1718 1724
 					//查询默认仓库剩余多少库存
@@ -1936,8 +1942,17 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1936 1942
 						prescriptionConfig, _ := service.FindPrescriptionConfigById(item.UserOrgId)
1937 1943
 						pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
1938 1944
 						if prescriptionConfig.IsOpen == 1 {
1939
-							if medical.IsUse == 2 && pharmacyConfig.IsOpen != 1 {
1940
-								service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1945
+
1946
+							if medical.IsUse == 2 {
1947
+								//是通过药房发药
1948
+								if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 2 {
1949
+									service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1950
+								}
1951
+								//不通过药房发药
1952
+								if pharmacyConfig.IsOpen != 1 {
1953
+									service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1954
+								}
1955
+
1941 1956
 								//查询默认仓库
1942 1957
 								storeHouseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
1943 1958
 								//查询默认仓库剩余多少库存
@@ -1974,8 +1989,15 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1974 1989
 
1975 1990
 					} else {
1976 1991
 						pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
1977
-						if medical.IsUse == 2 && pharmacyConfig.IsOpen != 1 {
1978
-							service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1992
+						if medical.IsUse == 2 {
1993
+							//是通过药房发药
1994
+							if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 2 {
1995
+								service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
1996
+							}
1997
+							//不通过药房发药
1998
+							if pharmacyConfig.IsOpen != 1 {
1999
+								service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2000
+							}
1979 2001
 							//更新字典里面的库存
1980 2002
 							var sum_count int64
1981 2003
 							stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
@@ -2255,11 +2277,16 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2255 2277
 
2256 2278
 					if prescribing_number_total <= total {
2257 2279
 						pharmacyConfig, _ := service.FindPharmacyConfig(item.UserOrgId)
2258
-						if medical.IsUse == 2 && pharmacyConfig.IsOpen != 1 {
2259 2280
 
2281
+						if medical.IsUse == 2 {
2260 2282
 							if config.IsOpen != 1 {
2261
-
2262
-								service.HisDrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
2283
+								if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 2 {
2284
+									service.HisDrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2285
+								}
2286
+								//不通过药房发药
2287
+								if pharmacyConfig.IsOpen != 1 {
2288
+									service.HisDrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2289
+								}
2263 2290
 								//查询默认仓库
2264 2291
 								storeHouseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
2265 2292
 								//查询默认仓库剩余多少库存