Bladeren bron

历史排班

28169 1 jaar geleden
bovenliggende
commit
85364da5ca

+ 0 - 1
controllers/dialysis_api_controller.go Bestand weergeven

2115
 	assessment.AdditionalWeight = data.AdditionalWeight
2115
 	assessment.AdditionalWeight = data.AdditionalWeight
2116
 	assessment.OtherComplication = data.OtherComplication
2116
 	assessment.OtherComplication = data.OtherComplication
2117
 	assessment.Ktv = data.Ktv
2117
 	assessment.Ktv = data.Ktv
2118
-	fmt.Println("data.wooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo", data.Urr)
2119
 	assessment.Urr = data.Urr
2118
 	assessment.Urr = data.Urr
2120
 	assessment.Hypertenison = data.Hypertenison
2119
 	assessment.Hypertenison = data.Hypertenison
2121
 	assessment.Hypopiesia = data.Hypopiesia
2120
 	assessment.Hypopiesia = data.Hypopiesia

+ 122 - 88
controllers/his_api_controller.go Bestand weergeven

1828
 										fmt.Println("prescribing_number", prescribing_number)
1828
 										fmt.Println("prescribing_number", prescribing_number)
1829
 										fmt.Println("all_count", all_count)
1829
 										fmt.Println("all_count", all_count)
1830
 										if drug.IsUse != 1 {
1830
 										if drug.IsUse != 1 {
1831
-											if all_count == 0 {
1832
-												c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1833
-												return
1834
-											}
1831
+											if drug.IsProject == 0 || drug.IsProject == 2 {
1832
+												if all_count == 0 {
1833
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1834
+													return
1835
+												}
1835
 
1836
 
1836
-											if prescribing_number > all_count {
1837
-												c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1838
-												return
1837
+												if prescribing_number > all_count {
1838
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1839
+													return
1840
+												}
1839
 											}
1841
 											}
1840
 
1842
 
1841
 										}
1843
 										}
1844
 									if prescribingNumberUnit == drug.MaxUnit {
1846
 									if prescribingNumberUnit == drug.MaxUnit {
1845
 										num := prescribing_number * float64(drug.MinNumber)
1847
 										num := prescribing_number * float64(drug.MinNumber)
1846
 										if drug.IsUse != 1 {
1848
 										if drug.IsUse != 1 {
1847
-											if all_count == 0 {
1848
-												c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1849
-												return
1850
-											}
1851
-											if num > all_count {
1852
-												c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1853
-												return
1849
+											if drug.IsProject == 0 || drug.IsProject == 2 {
1850
+												if all_count == 0 {
1851
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1852
+													return
1853
+												}
1854
+												if num > all_count {
1855
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1856
+													return
1857
+												}
1854
 											}
1858
 											}
1859
+
1855
 										}
1860
 										}
1856
 									}
1861
 									}
1857
 								}
1862
 								}
1904
 											all_count, _ := strconv.ParseFloat(totals, 64)
1909
 											all_count, _ := strconv.ParseFloat(totals, 64)
1905
 											if prescribingNumberUnit == drug.MinUnit {
1910
 											if prescribingNumberUnit == drug.MinUnit {
1906
 												if drug.IsUse != 1 {
1911
 												if drug.IsUse != 1 {
1907
-													if all_count == 0 {
1908
-														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1909
-														return
1910
-													}
1911
-													if prescribing_number > all_count {
1912
-														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1913
-														return
1914
-													}
1915
-												}
1916
-											} else {
1917
-												if prescribingNumberUnit == drug.MaxUnit {
1918
-													num := prescribing_number * float64(drug.MinNumber)
1919
-													if drug.IsUse != 1 {
1912
+													if drug.IsProject == 0 || drug.IsProject == 2 {
1920
 														if all_count == 0 {
1913
 														if all_count == 0 {
1921
 															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1914
 															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1922
 															return
1915
 															return
1923
 														}
1916
 														}
1924
-														if num > all_count {
1917
+														if prescribing_number > all_count {
1925
 															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1918
 															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1926
 															return
1919
 															return
1927
 														}
1920
 														}
1921
+													}
1922
+
1923
+												}
1924
+											} else {
1925
+												if prescribingNumberUnit == drug.MaxUnit {
1926
+													num := prescribing_number * float64(drug.MinNumber)
1927
+													if drug.IsUse != 1 {
1928
+														if drug.IsProject == 0 || drug.IsProject == 2 {
1929
+															if all_count == 0 {
1930
+																c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1931
+																return
1932
+															}
1933
+															if num > all_count {
1934
+																c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1935
+																return
1936
+															}
1937
+														}
1928
 
1938
 
1929
 													}
1939
 													}
1930
 
1940
 
2042
 									if prescribingNumberUnit == drug.MinUnit {
2052
 									if prescribingNumberUnit == drug.MinUnit {
2043
 
2053
 
2044
 										if drug.IsUse != 1 {
2054
 										if drug.IsUse != 1 {
2045
-											if all_count == 0 {
2046
-												c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2047
-												return
2048
-											}
2049
-											if prescribing_number > all_count {
2050
-												c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2051
-												return
2055
+
2056
+											if drug.IsProject == 0 || drug.IsProject == 2 {
2057
+												if all_count == 0 {
2058
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2059
+													return
2060
+												}
2061
+												if prescribing_number > all_count {
2062
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2063
+													return
2064
+												}
2052
 											}
2065
 											}
2053
 
2066
 
2054
 											if adminInfo.CurrentOrgId == 10215 {
2067
 											if adminInfo.CurrentOrgId == 10215 {
2064
 									if prescribingNumberUnit == drug.MaxUnit {
2077
 									if prescribingNumberUnit == drug.MaxUnit {
2065
 										num := prescribing_number * float64(drug.MinNumber)
2078
 										num := prescribing_number * float64(drug.MinNumber)
2066
 										if drug.IsUse != 1 {
2079
 										if drug.IsUse != 1 {
2067
-											if all_count == 0 {
2068
-												c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2069
-												return
2070
-											}
2071
-											if num > all_count {
2072
-												c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2073
-												return
2080
+											if drug.IsProject == 0 || drug.IsProject == 2 {
2081
+												if all_count == 0 {
2082
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2083
+													return
2084
+												}
2085
+												if num > all_count {
2086
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2087
+													return
2088
+												}
2074
 											}
2089
 											}
2090
+
2075
 											if adminInfo.CurrentOrgId == 10215 {
2091
 											if adminInfo.CurrentOrgId == 10215 {
2076
 												if num > batch_number_all_count {
2092
 												if num > batch_number_all_count {
2077
 													c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2093
 													c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2137
 											if prescribingNumberUnit == drug.MinUnit {
2153
 											if prescribingNumberUnit == drug.MinUnit {
2138
 												batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
2154
 												batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
2139
 												if drug.IsUse != 1 {
2155
 												if drug.IsUse != 1 {
2140
-													if all_count == 0 {
2141
-														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2142
-														return
2143
-													}
2144
-													if prescribing_number > all_count {
2145
-														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2146
-														return
2156
+													if drug.IsProject == 0 || drug.IsProject == 2 {
2157
+														if all_count == 0 {
2158
+															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2159
+															return
2160
+														}
2161
+														if prescribing_number > all_count {
2162
+															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2163
+															return
2164
+														}
2147
 													}
2165
 													}
2166
+
2148
 													if adminInfo.CurrentOrgId == 10215 {
2167
 													if adminInfo.CurrentOrgId == 10215 {
2149
 														if prescribing_number > batch_number_all_count {
2168
 														if prescribing_number > batch_number_all_count {
2150
 															c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2169
 															c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2159
 													batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
2178
 													batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
2160
 													num := prescribing_number * float64(drug.MinNumber)
2179
 													num := prescribing_number * float64(drug.MinNumber)
2161
 													if drug.IsUse != 1 {
2180
 													if drug.IsUse != 1 {
2162
-														if all_count == 0 {
2163
-															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2164
-															return
2165
-														}
2166
-														if num > all_count {
2167
-															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2168
-															return
2181
+														if drug.IsProject == 0 || drug.IsProject == 2 {
2182
+															if all_count == 0 {
2183
+																c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2184
+																return
2185
+															}
2186
+															if num > all_count {
2187
+																c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2188
+																return
2189
+															}
2169
 														}
2190
 														}
2191
+
2170
 														if adminInfo.CurrentOrgId == 10215 {
2192
 														if adminInfo.CurrentOrgId == 10215 {
2171
 															if prescribing_number > batch_number_all_count {
2193
 															if prescribing_number > batch_number_all_count {
2172
 																c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2194
 																c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2214
 											if (number_count - device_number) > 0 {
2236
 											if (number_count - device_number) > 0 {
2215
 												//如果修改的差数量 大于库存数量
2237
 												//如果修改的差数量 大于库存数量
2216
 												if drug.IsUse != 1 {
2238
 												if drug.IsUse != 1 {
2217
-													if total_count == 0 {
2218
-														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2219
-														return
2220
-													}
2221
-													if (number_count - device_number) > total_count {
2222
-														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2223
-														return
2224
-													}
2239
+													if drug.IsProject == 0 || drug.IsProject == 2 {
2240
+														if total_count == 0 {
2241
+															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2242
+															return
2243
+														}
2244
+														if (number_count - device_number) > total_count {
2245
+															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2246
+															return
2247
+														}
2225
 
2248
 
2226
-													if (number_count - device_number) > batch_number_count {
2227
-														c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2228
-														return
2249
+														if (number_count - device_number) > batch_number_count {
2250
+															c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2251
+															return
2252
+														}
2229
 													}
2253
 													}
2254
+
2230
 													if adminInfo.CurrentOrgId == 10215 {
2255
 													if adminInfo.CurrentOrgId == 10215 {
2231
 														// 查询该药品最后一次出库记录
2256
 														// 查询该药品最后一次出库记录
2232
 														outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
2257
 														outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
2383
 											if prescribingNumberUnit == drug.MinUnit {
2408
 											if prescribingNumberUnit == drug.MinUnit {
2384
 												batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
2409
 												batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
2385
 												if drug.IsUse != 1 {
2410
 												if drug.IsUse != 1 {
2386
-													if all_count == 0 {
2387
-														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2388
-														return
2389
-													}
2390
-													if prescribing_number > all_count {
2391
-														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2392
-														return
2411
+													if drug.IsProject == 0 || drug.IsProject == 2 {
2412
+														if all_count == 0 {
2413
+															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2414
+															return
2415
+														}
2416
+														if prescribing_number > all_count {
2417
+															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2418
+															return
2419
+														}
2393
 													}
2420
 													}
2421
+
2394
 													if adminInfo.CurrentOrgId == 10215 {
2422
 													if adminInfo.CurrentOrgId == 10215 {
2395
 														if prescribing_number > batch_number_all_count {
2423
 														if prescribing_number > batch_number_all_count {
2396
 															c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2424
 															c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2405
 													batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
2433
 													batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
2406
 													num := prescribing_number * float64(drug.MinNumber)
2434
 													num := prescribing_number * float64(drug.MinNumber)
2407
 													if drug.IsUse != 1 {
2435
 													if drug.IsUse != 1 {
2408
-														if all_count == 0 {
2409
-															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2410
-															return
2411
-														}
2412
-														if num > all_count {
2413
-															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2414
-															return
2436
+														if drug.IsProject == 0 || drug.IsProject == 2 {
2437
+															if all_count == 0 {
2438
+																c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2439
+																return
2440
+															}
2441
+															if num > all_count {
2442
+																c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2443
+																return
2444
+															}
2415
 														}
2445
 														}
2446
+
2416
 														if adminInfo.CurrentOrgId == 10215 {
2447
 														if adminInfo.CurrentOrgId == 10215 {
2417
 															if prescribing_number > batch_number_all_count {
2448
 															if prescribing_number > batch_number_all_count {
2418
 																c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2449
 																c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2458
 											if (number_count - device_number) > 0 {
2489
 											if (number_count - device_number) > 0 {
2459
 												//如果修改的差数量 大于库存数量
2490
 												//如果修改的差数量 大于库存数量
2460
 												if drug.IsUse != 1 {
2491
 												if drug.IsUse != 1 {
2461
-													if total_count == 0 {
2462
-														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2463
-														return
2464
-													}
2465
-													if (number_count - device_number) > total_count {
2466
-														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2467
-														return
2492
+													if drug.IsProject == 0 || drug.IsProject == 2 {
2493
+														if total_count == 0 {
2494
+															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2495
+															return
2496
+														}
2497
+														if (number_count - device_number) > total_count {
2498
+															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2499
+															return
2500
+														}
2468
 													}
2501
 													}
2502
+
2469
 													if adminInfo.CurrentOrgId == 10215 {
2503
 													if adminInfo.CurrentOrgId == 10215 {
2470
 														if (number_count - device_number) > batch_number_count {
2504
 														if (number_count - device_number) > batch_number_count {
2471
 															c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
2505
 															c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)

+ 4 - 2
controllers/manager_center_api_controller.go Bestand weergeven

160
 	is_pharmacy, _ := c.GetInt64("is_pharmacy")
160
 	is_pharmacy, _ := c.GetInt64("is_pharmacy")
161
 	bbx01 := c.GetString("bbx01")
161
 	bbx01 := c.GetString("bbx01")
162
 	bby01 := c.GetString("bby01")
162
 	bby01 := c.GetString("bby01")
163
-
163
+	is_project, _ := c.GetInt64("is_project")
164
 	adminInfo := c.GetAdminUserInfo()
164
 	adminInfo := c.GetAdminUserInfo()
165
 	drugLib := &models.BaseDrugLib{
165
 	drugLib := &models.BaseDrugLib{
166
 		DrugName:                    drug_name,
166
 		DrugName:                    drug_name,
230
 		Bby01:                       bby01,
230
 		Bby01:                       bby01,
231
 		ZuobiaoId:                   bbx01,
231
 		ZuobiaoId:                   bbx01,
232
 		Bbx01:                       bbx01,
232
 		Bbx01:                       bbx01,
233
+		IsProject:                   is_project,
233
 	}
234
 	}
234
 
235
 
235
 	total := service.FindAllDrugLibRecordTotal(adminInfo.CurrentOrgId)
236
 	total := service.FindAllDrugLibRecordTotal(adminInfo.CurrentOrgId)
339
 
340
 
340
 	bbx01 := c.GetString("bbx01")
341
 	bbx01 := c.GetString("bbx01")
341
 	bby01 := c.GetString("bby01")
342
 	bby01 := c.GetString("bby01")
342
-
343
+	is_project, _ := c.GetInt64("is_project")
343
 	adminInfo := c.GetAdminUserInfo()
344
 	adminInfo := c.GetAdminUserInfo()
344
 	drug, _ := service.FindBaseDrugLibRecord(adminInfo.CurrentOrgId, id)
345
 	drug, _ := service.FindBaseDrugLibRecord(adminInfo.CurrentOrgId, id)
345
 	drugLib := &models.BaseDrugLib{
346
 	drugLib := &models.BaseDrugLib{
415
 		ZuobiaoId:                   bbx01,
416
 		ZuobiaoId:                   bbx01,
416
 		Bby01:                       bby01,
417
 		Bby01:                       bby01,
417
 		Bbx01:                       bbx01,
418
 		Bbx01:                       bbx01,
419
+		IsProject:                   is_project,
418
 	}
420
 	}
419
 	if adminInfo.CurrentOrgId == 10206 || adminInfo.CurrentOrgId == 10344 {
421
 	if adminInfo.CurrentOrgId == 10206 || adminInfo.CurrentOrgId == 10344 {
420
 
422
 

+ 31 - 27
controllers/pharmacy_controller.go Bestand weergeven

325
 	}
325
 	}
326
 	var list []*models.PharmacyContent
326
 	var list []*models.PharmacyContent
327
 	list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
327
 	list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
328
+
328
 	if err != nil {
329
 	if err != nil {
329
 		utils.ErrorLog(err.Error())
330
 		utils.ErrorLog(err.Error())
330
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
331
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
373
 		for _, item := range advicelist {
374
 		for _, item := range advicelist {
374
 			//查询改药品信息
375
 			//查询改药品信息
375
 			medical, _ := service.GetBaseDrugMedical(item.DrugId)
376
 			medical, _ := service.GetBaseDrugMedical(item.DrugId)
376
-			if medical.IsPharmacy == 1 {
377
-				houseConfig, _ := service.GetAllStoreHouseConfig(orgid)
378
-				//查询该药品是否有库存
379
-				list, _ := service.GetDrugTotalCountTwenty(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
380
-
381
-				//判断单位是否相等
382
-				if medical.MaxUnit == item.PrescribingNumberUnit {
383
-					prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
384
-					count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
385
-					//转化为最小单位
386
-					total = list.Count*medical.MinNumber + list.StockMinNumber
387
-					prescribing_number_total = count * medical.MinNumber
388
-				}
389
-				if medical.MinUnit == item.PrescribingNumberUnit {
390
-					prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
391
-					count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
392
-					total = list.Count*medical.MinNumber + list.StockMinNumber
393
-					prescribing_number_total = count
394
-				}
377
+			//针对阜阳经沃
378
+			if orgid != 10480 {
379
+				if medical.IsPharmacy == 1 {
380
+					houseConfig, _ := service.GetAllStoreHouseConfig(orgid)
381
+					//查询该药品是否有库存
382
+					list, _ := service.GetDrugTotalCountTwenty(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
383
+
384
+					//判断单位是否相等
385
+					if medical.MaxUnit == item.PrescribingNumberUnit {
386
+						prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
387
+						count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
388
+						//转化为最小单位
389
+						total = list.Count*medical.MinNumber + list.StockMinNumber
390
+						prescribing_number_total = count * medical.MinNumber
391
+					}
392
+					if medical.MinUnit == item.PrescribingNumberUnit {
393
+						prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
394
+						count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
395
+						total = list.Count*medical.MinNumber + list.StockMinNumber
396
+						prescribing_number_total = count
397
+					}
395
 
398
 
396
-				if medical.IsUse != 1 {
397
-					//如果出库数量大于库存数量
398
-					if prescribing_number_total > total {
399
-						err := fmt.Errorf(service.FindDrugsName(item.DrugId) + "库存不足")
400
-						if err != nil {
401
-							utils.ErrorLog(err.Error())
402
-							this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
403
-							return
399
+					if medical.IsUse != 1 {
400
+						//如果出库数量大于库存数量
401
+						if prescribing_number_total > total {
402
+							err := fmt.Errorf(service.FindDrugsName(item.DrugId) + "库存不足")
403
+							if err != nil {
404
+								utils.ErrorLog(err.Error())
405
+								this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
406
+								return
407
+							}
404
 						}
408
 						}
405
 					}
409
 					}
406
 				}
410
 				}

+ 2 - 0
models/drug.go Bestand weergeven

86
 	Bbx01     string `gorm:"column:bbx01" json:"bbx01" form:"bbx01"`
86
 	Bbx01     string `gorm:"column:bbx01" json:"bbx01" form:"bbx01"`
87
 
87
 
88
 	FirstLetter string `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
88
 	FirstLetter string `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
89
+	IsProject   int64  `gorm:"column:is_project" json:"is_project" form:"is_project"`
89
 }
90
 }
90
 
91
 
91
 func (BaseDrugLib) TableName() string {
92
 func (BaseDrugLib) TableName() string {
102
 	IsUse      int64  `gorm:"column:is_user" json:"is_user" form:"is_user"`
103
 	IsUse      int64  `gorm:"column:is_user" json:"is_user" form:"is_user"`
103
 	IsPharmacy int64  `gorm:"column:is_pharmacy" json:"is_pharmacy" form:"is_pharmacy"`
104
 	IsPharmacy int64  `gorm:"column:is_pharmacy" json:"is_pharmacy" form:"is_pharmacy"`
104
 	OrgId      int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
105
 	OrgId      int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
106
+	IsProject  int64  `gorm:"column:is_project" json:"is_project" form:"is_project"`
105
 }
107
 }
106
 
108
 
107
 func (BaseDrugLibSeven) TableName() string {
109
 func (BaseDrugLibSeven) TableName() string {

+ 1 - 1
service/his_service.go Bestand weergeven

808
 	SumInCount            int64   `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
808
 	SumInCount            int64   `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
809
 	FirstLetter           string  `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
809
 	FirstLetter           string  `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
810
 	Bby01                 string  `gorm:"column:bby01" json:"bby01" form:"bby01"`
810
 	Bby01                 string  `gorm:"column:bby01" json:"bby01" form:"bby01"`
811
-
811
+	IsProject             int64   `gorm:"column:is_project" json:"is_project" form:"is_project"`
812
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
812
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
813
 	OtherDrugWarehouseInfo []*OtherDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"stock_in"`
813
 	OtherDrugWarehouseInfo []*OtherDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"stock_in"`
814
 	VMDrugSalesReturnInfo  []*VMDrugSalesReturnInfo  `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"sales_return"`
814
 	VMDrugSalesReturnInfo  []*VMDrugSalesReturnInfo  `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"sales_return"`

+ 78 - 68
service/pharmacy_service.go Bestand weergeven

675
 	if err != nil {
675
 	if err != nil {
676
 		return
676
 		return
677
 	}
677
 	}
678
-	for _, v := range advice_info {
679
-		tmp_bool := IsPharmacyConfig(orgid)
680
-		if tmp_bool {
681
-			if PettyCash(v.DrugId) {
682
-				continue
683
-			}
684
-			if orgid != 10217 && orgid != 10188 && orgid != 9671 && orgid != 10164 && orgid != 10387 && orgid != 10375 {
685
-				////判断药品库存是否充足
686
-				kou := FenDrugInventory(v, orgid)
687
-				if !kou {
688
-					err = fmt.Errorf(FindDrugsName(v.DrugId) + "库存不足")
689
-					return
678
+
679
+	if orgid != 10480 {
680
+		for _, v := range advice_info {
681
+			tmp_bool := IsPharmacyConfig(orgid)
682
+			if tmp_bool {
683
+				if PettyCash(v.DrugId) {
684
+					continue
685
+				}
686
+				if orgid != 10217 && orgid != 10188 && orgid != 9671 && orgid != 10164 && orgid != 10387 && orgid != 10375 && orgid != 10480 {
687
+					////判断药品库存是否充足
688
+					kou := FenDrugInventory(v, orgid)
689
+					if !kou {
690
+						err = fmt.Errorf(FindDrugsName(v.DrugId) + "库存不足")
691
+						return
692
+					}
690
 				}
693
 				}
691
-			}
692
 
694
 
693
-			//扣减库存
694
-			err = FenStock(orgid, creater, v)
695
-			if err != nil {
696
-				err = fmt.Errorf("!:%v", err)
697
-				return
695
+				//扣减库存
696
+				err = FenStock(orgid, creater, v)
697
+				if err != nil {
698
+					err = fmt.Errorf("!:%v", err)
699
+					return
700
+				}
698
 			}
701
 			}
699
 		}
702
 		}
700
 	}
703
 	}
704
+
701
 	//修改状态
705
 	//修改状态
702
 	errs := XTWriteDB().Model(&models.HisDoctorAdviceInfoL{}).Where("id in (?)", hid).Updates(map[string]interface{}{
706
 	errs := XTWriteDB().Model(&models.HisDoctorAdviceInfoL{}).Where("id in (?)", hid).Updates(map[string]interface{}{
703
 		"is_medicine":     1,
707
 		"is_medicine":     1,
714
 	}
718
 	}
715
 
719
 
716
 	//针对大丰响水
720
 	//针对大丰响水
717
-	if orgid != 10217 && orgid != 10188 && orgid != 9671 && orgid != 10164 && orgid != 10387 && orgid != 10375 {
721
+	if orgid != 10217 && orgid != 10188 && orgid != 9671 && orgid != 10164 && orgid != 10387 && orgid != 10375 && orgid != 10480 {
718
 		err = tx.Raw("select id from xt_doctor_advice where status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and "+
722
 		err = tx.Raw("select id from xt_doctor_advice where status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and "+
719
 			"user_org_id = ? and patient_id = ? and is_medicine = 0 and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, orgid).Scan(&xids).Error
723
 			"user_org_id = ? and patient_id = ? and is_medicine = 0 and drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1)", stime, etime, orgid, patient_id, orgid).Scan(&xids).Error
720
 		if err != nil {
724
 		if err != nil {
820
 	if err != nil {
824
 	if err != nil {
821
 		return
825
 		return
822
 	}
826
 	}
823
-	for _, v := range advice_info {
824
-		//扣减库存
825
-		if !IsPharmacyDelivery(v.DrugId, orgid) {
826
-			continue
827
-		}
828
-		err = DrugAutoAddCancelInfo(v, creater)
829
-		if err != nil {
830
-			err = fmt.Errorf("!:%v", err)
831
-			return
832
-		}
833
-		//drug, _ := FindBaseDrugLibRecordSeven(orgid, v.DrugId)
834
-		//查询默认仓库
835
-		storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
836
-		//查询默认仓库剩余多少库存
837
-		var sum_count int64
838
-		stockInfo, _ := GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, orgid, v.DrugId)
839
-		for _, its := range stockInfo {
840
-			baseDrug, _ := GetBaseDrugMedical(its.DrugId)
841
-			if its.MaxUnit == baseDrug.MaxUnit {
842
-				its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
827
+
828
+	//针对阜阳经沃
829
+	if orgid != 10480 {
830
+		for _, v := range advice_info {
831
+			//扣减库存
832
+			if !IsPharmacyDelivery(v.DrugId, orgid) {
833
+				continue
834
+			}
835
+			err = DrugAutoAddCancelInfo(v, creater)
836
+			if err != nil {
837
+				err = fmt.Errorf("!:%v", err)
838
+				return
839
+			}
840
+			//drug, _ := FindBaseDrugLibRecordSeven(orgid, v.DrugId)
841
+			//查询默认仓库
842
+			storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
843
+			//查询默认仓库剩余多少库存
844
+			var sum_count int64
845
+			stockInfo, _ := GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, orgid, v.DrugId)
846
+			for _, its := range stockInfo {
847
+				baseDrug, _ := GetBaseDrugMedical(its.DrugId)
848
+				if its.MaxUnit == baseDrug.MaxUnit {
849
+					its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
850
+				}
851
+				sum_count += its.StockMaxNumber + its.StockMinNumber
843
 			}
852
 			}
844
-			sum_count += its.StockMaxNumber + its.StockMinNumber
845
-		}
846
 
853
 
847
-		UpdateBaseDrugSumTwo(v.DrugId, sum_count, orgid)
848
-		//扣减库存
849
-		UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
854
+			UpdateBaseDrugSumTwo(v.DrugId, sum_count, orgid)
855
+			//扣减库存
856
+			UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
850
 
857
 
858
+		}
851
 	}
859
 	}
852
 
860
 
853
 	err = tx.Raw("select id,dispensing_time from xt_doctor_advice where status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and "+
861
 	err = tx.Raw("select id,dispensing_time from xt_doctor_advice where status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and "+
875
 	if err != nil {
883
 	if err != nil {
876
 		return
884
 		return
877
 	}
885
 	}
878
-	for _, v := range advice {
879
-		//扣减库存
880
-		if !IsPharmacyDelivery(v.DrugId, orgid) {
881
-			continue
882
-		}
883
-		err = DrugAutoAddCancelInfo(v, creater)
884
-		if err != nil {
885
-			err = fmt.Errorf("!:%v", err)
886
-			return
887
-		}
888
-		//drug, _ := FindBaseDrugLibRecordSeven(orgid, v.DrugId)
889
-		//查询默认仓库
890
-		storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
891
-		//查询默认仓库剩余多少库存
892
-		var sum_count int64
893
-		stockInfo, _ := GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, orgid, v.DrugId)
894
-		for _, its := range stockInfo {
895
-			baseDrug, _ := GetBaseDrugMedical(its.DrugId)
896
-			if its.MaxUnit == baseDrug.MaxUnit {
897
-				its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
886
+	if orgid != 10480 {
887
+		for _, v := range advice {
888
+			//扣减库存
889
+			if !IsPharmacyDelivery(v.DrugId, orgid) {
890
+				continue
891
+			}
892
+			err = DrugAutoAddCancelInfo(v, creater)
893
+			if err != nil {
894
+				err = fmt.Errorf("!:%v", err)
895
+				return
896
+			}
897
+			//drug, _ := FindBaseDrugLibRecordSeven(orgid, v.DrugId)
898
+			//查询默认仓库
899
+			storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
900
+			//查询默认仓库剩余多少库存
901
+			var sum_count int64
902
+			stockInfo, _ := GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, orgid, v.DrugId)
903
+			for _, its := range stockInfo {
904
+				baseDrug, _ := GetBaseDrugMedical(its.DrugId)
905
+				if its.MaxUnit == baseDrug.MaxUnit {
906
+					its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
907
+				}
908
+				sum_count += its.StockMaxNumber + its.StockMinNumber
898
 			}
909
 			}
899
-			sum_count += its.StockMaxNumber + its.StockMinNumber
910
+			UpdateBaseDrugSumTwo(v.DrugId, sum_count, orgid)
911
+			//扣减库存
912
+			UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
900
 		}
913
 		}
901
-		UpdateBaseDrugSumTwo(v.DrugId, sum_count, orgid)
902
-		//扣减库存
903
-		UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
904
 	}
914
 	}
905
 
915
 
906
 	//删除掉发药明细
916
 	//删除掉发药明细