|
@@ -1831,10 +1831,17 @@ func (c *PatientApiController) ExecGroupAdvice() {
|
1831
|
1831
|
pharmacyConfig, _ := service.FindPharmacyConfig(advice.UserOrgId)
|
1832
|
1832
|
if medical.IsUse == 2 {
|
1833
|
1833
|
if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
|
1834
|
|
- service.DrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
|
|
1834
|
+ drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
|
|
1835
|
+ if drugOutInfo.ID == 0 {
|
|
1836
|
+ service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
|
|
1837
|
+ }
|
|
1838
|
+
|
1835
|
1839
|
}
|
1836
|
1840
|
if pharmacyConfig.IsOpen != 1 {
|
1837
|
|
- service.DrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
|
|
1841
|
+ drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
|
|
1842
|
+ if drugOutInfo.ID == 0 {
|
|
1843
|
+ service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
|
|
1844
|
+ }
|
1838
|
1845
|
}
|
1839
|
1846
|
|
1840
|
1847
|
|
|
@@ -2029,7 +2036,12 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
2029
|
2036
|
}
|
2030
|
2037
|
|
2031
|
2038
|
if medical.IsUse != 1 {
|
|
2039
|
+
|
2032
|
2040
|
if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
|
|
2041
|
+ service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
|
|
2042
|
+ advice.ExecutionState = 2
|
|
2043
|
+ advice.ExecutionStaff = 0
|
|
2044
|
+ advice.ExecutionTime = 0
|
2033
|
2045
|
c.ServeSuccessJSON(map[string]interface{}{
|
2034
|
2046
|
"msg": "3",
|
2035
|
2047
|
"advice": advice,
|
|
@@ -2037,6 +2049,10 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
2037
|
2049
|
return
|
2038
|
2050
|
}
|
2039
|
2051
|
if prescribing_number_total > total {
|
|
2052
|
+ service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
|
|
2053
|
+ advice.ExecutionState = 2
|
|
2054
|
+ advice.ExecutionStaff = 0
|
|
2055
|
+ advice.ExecutionTime = 0
|
2040
|
2056
|
c.ServeSuccessJSON(map[string]interface{}{
|
2041
|
2057
|
"msg": "2",
|
2042
|
2058
|
"advice": advice,
|
|
@@ -2069,12 +2085,20 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
2069
|
2085
|
|
2070
|
2086
|
if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
|
2071
|
2087
|
|
2072
|
|
- service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
|
|
2088
|
+
|
|
2089
|
+ drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
|
|
2090
|
+ if drugOutInfo.ID == 0 {
|
|
2091
|
+ service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
|
|
2092
|
+ }
|
2073
|
2093
|
}
|
2074
|
2094
|
|
2075
|
2095
|
if pharmacyConfig.IsOpen != 1 {
|
2076
|
2096
|
|
2077
|
|
- service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
|
|
2097
|
+
|
|
2098
|
+ drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
|
|
2099
|
+ if drugOutInfo.ID == 0 {
|
|
2100
|
+ service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
|
|
2101
|
+ }
|
2078
|
2102
|
}
|
2079
|
2103
|
|
2080
|
2104
|
|
|
@@ -2091,6 +2115,9 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
2091
|
2115
|
}
|
2092
|
2116
|
|
2093
|
2117
|
service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
|
|
2118
|
+
|
|
2119
|
+
|
|
2120
|
+ service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
|
2094
|
2121
|
break
|
2095
|
2122
|
c.ServeSuccessJSON(map[string]interface{}{
|
2096
|
2123
|
"msg": "1",
|
|
@@ -2120,11 +2147,19 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
2120
|
2147
|
if medical.IsUse == 2 {
|
2121
|
2148
|
|
2122
|
2149
|
if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
|
2123
|
|
- service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
|
|
2150
|
+
|
|
2151
|
+ drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
|
|
2152
|
+ if drugOutInfo.ID == 0 {
|
|
2153
|
+ service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
|
|
2154
|
+ }
|
2124
|
2155
|
}
|
2125
|
2156
|
|
2126
|
2157
|
if pharmacyConfig.IsOpen != 1 {
|
2127
|
|
- service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
|
|
2158
|
+
|
|
2159
|
+ drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
|
|
2160
|
+ if drugOutInfo.ID == 0 {
|
|
2161
|
+ service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
|
|
2162
|
+ }
|
2128
|
2163
|
}
|
2129
|
2164
|
|
2130
|
2165
|
var sum_count int64
|
|
@@ -2136,6 +2171,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
2136
|
2171
|
sum_count += its.StockMaxNumber + its.StockMinNumber
|
2137
|
2172
|
}
|
2138
|
2173
|
service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
|
|
2174
|
+
|
|
2175
|
+ service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
|
2139
|
2176
|
break
|
2140
|
2177
|
c.ServeSuccessJSON(map[string]interface{}{
|
2141
|
2178
|
"msg": "1",
|