Browse Source

11月8日库存管理

XMLWAN 2 years ago
parent
commit
65bc33a40f

+ 74 - 20
controllers/his_api_controller.go View File

@@ -995,7 +995,6 @@ func (c *HisApiController) CreateHisPrescription() {
995 995
 								var drug_id int64
996 996
 								var prescribing_number float64
997 997
 								var prescribingNumberUnit string
998
-								//var prescribingNumber string
999 998
 
1000 999
 								var adviceId int64
1001 1000
 								if advice.(map[string]interface{})["id"] != nil || reflect.TypeOf(advice.(map[string]interface{})["id"]).String() == "float64" {
@@ -1004,7 +1003,6 @@ func (c *HisApiController) CreateHisPrescription() {
1004 1003
 								if advice.(map[string]interface{})["prescribing_number"] != nil || reflect.TypeOf(advice.(map[string]interface{})["prescribing_number"]).String() == "string" {
1005 1004
 									prescribing_number_str := advice.(map[string]interface{})["prescribing_number"].(string)
1006 1005
 									prescribing_number, _ = strconv.ParseFloat(prescribing_number_str, 64)
1007
-									//prescribingNumber = advice.(map[string]interface{})["prescribing_number"].(string)
1008 1006
 								}
1009 1007
 
1010 1008
 								if advice.(map[string]interface{})["prescribing_number_unit"] != nil && reflect.TypeOf(advice.(map[string]interface{})["prescribing_number_unit"]).String() == "string" {
@@ -1024,6 +1022,7 @@ func (c *HisApiController) CreateHisPrescription() {
1024 1022
 								storeConfig, _ := service.GetAllStoreHouseConfig(adminInfo.CurrentOrgId)
1025 1023
 								//查询药品的所有库存
1026 1024
 								list, _ := service.GetDrugWarehouseInfoPrescriptionSeven(drug_id, adminInfo.CurrentOrgId, storeConfig.DrugStorehouseOut)
1025
+
1027 1026
 								var total_count int64
1028 1027
 								for _, it := range list {
1029 1028
 									total_count += it.StockMaxNumber*drug.MinNumber + it.StockMinNumber
@@ -1031,26 +1030,47 @@ func (c *HisApiController) CreateHisPrescription() {
1031 1030
 								totals := strconv.FormatInt(total_count, 10)
1032 1031
 								//查询该药品是否存在开药记录
1033 1032
 								advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
1034
-								fmt.Println("advicleise23223323233223w", advicelist.PrescribingNumber)
1033
+
1034
+								//查询最新批次库存
1035
+								info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
1036
+								var batch_number_count int64
1037
+								batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
1038
+								batch_number_counts := strconv.FormatInt(batch_number_count, 10)
1035 1039
 								//新增处方
1036 1040
 								if advicelist.ID == 0 {
1037 1041
 									all_count, _ := strconv.ParseFloat(totals, 64)
1042
+									batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
1038 1043
 									if prescribingNumberUnit == drug.MinUnit {
1039
-										if prescribing_number > all_count {
1040
-											c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1041
-											return
1044
+
1045
+										if drug.IsUse != 1 {
1046
+											if prescribing_number > all_count {
1047
+												c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1048
+												return
1049
+											}
1050
+
1051
+											if prescribing_number > batch_number_all_count {
1052
+												c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1053
+												return
1054
+											}
1042 1055
 										}
1043 1056
 
1044 1057
 									}
1045 1058
 									if prescribingNumberUnit == drug.MaxUnit {
1046 1059
 										num := prescribing_number * float64(drug.MinNumber)
1047
-										if num > all_count {
1048
-											c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1049
-											return
1060
+										if drug.IsUse != 1 {
1061
+											if num > all_count {
1062
+												c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1063
+												return
1064
+											}
1065
+
1066
+											if num > batch_number_all_count {
1067
+												c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1068
+												return
1069
+											}
1050 1070
 										}
1051 1071
 									}
1052
-
1053 1072
 								}
1073
+
1054 1074
 								drugOutConfig, _ := service.GetDrugOpenConfigOne(adminInfo.CurrentOrgId)
1055 1075
 								if drugOutConfig.IsOpen != 1 {
1056 1076
 									//修改处方
@@ -1096,24 +1116,51 @@ func (c *HisApiController) CreateHisPrescription() {
1096 1116
 
1097 1117
 										//新增处方
1098 1118
 										if advicelist.ID == 0 {
1119
+											//查询最新批次库存
1120
+											info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
1121
+											var batch_number_count int64
1122
+											batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
1123
+											batch_number_counts := strconv.FormatInt(batch_number_count, 10)
1099 1124
 											all_count, _ := strconv.ParseFloat(totals, 64)
1100 1125
 											if prescribingNumberUnit == drug.MinUnit {
1101
-												if prescribing_number > all_count {
1102
-													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1103
-													return
1126
+												batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
1127
+												if drug.IsUse != 1 {
1128
+													if prescribing_number > all_count {
1129
+														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1130
+														return
1131
+													}
1132
+													if prescribing_number > batch_number_all_count {
1133
+														c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1134
+														return
1135
+													}
1104 1136
 												}
1137
+
1105 1138
 											} else {
1106 1139
 												if prescribingNumberUnit == drug.MaxUnit {
1140
+													batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
1107 1141
 													num := prescribing_number * float64(drug.MinNumber)
1108
-													if num > all_count {
1109
-														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1110
-														return
1142
+													if drug.IsUse != 1 {
1143
+														if num > all_count {
1144
+															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1145
+															return
1146
+														}
1147
+
1148
+														if prescribing_number > batch_number_all_count {
1149
+															c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1150
+															return
1151
+														}
1111 1152
 													}
1153
+
1112 1154
 												}
1113 1155
 											}
1114 1156
 										}
1115 1157
 										//修改处方
1116 1158
 										if advicelist.ID > 0 {
1159
+											//查询最新批次库存
1160
+											info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
1161
+											var batch_number_count int64
1162
+											batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
1163
+
1117 1164
 											var device_number int64
1118 1165
 
1119 1166
 											if advicelist.PrescribingNumberUnit == drug.MaxUnit {
@@ -1140,10 +1187,17 @@ func (c *HisApiController) CreateHisPrescription() {
1140 1187
 											//如果修改的数量大于之前修改的数量
1141 1188
 											if (number_count - device_number) > 0 {
1142 1189
 												//如果修改的差数量 大于库存数量
1143
-												if (number_count - device_number) > total_count {
1144
-													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1145
-													return
1190
+												if drug.IsUse != 1 {
1191
+													if (number_count - device_number) > total_count {
1192
+														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1193
+														return
1194
+													}
1195
+													if (number_count - device_number) > batch_number_count {
1196
+														c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1197
+														return
1198
+													}
1146 1199
 												}
1200
+
1147 1201
 											}
1148 1202
 
1149 1203
 											if device_number != number_count {
@@ -2315,7 +2369,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
2315 2369
 		if drugStockConfig.IsOpen == 1 {
2316 2370
 
2317 2371
 			//查询是否在处方中出库
2318
-			openConfig, _ := service.GetDrugOpenConfig(c.GetAdminUserInfo().CurrentOrgId)
2372
+			openConfig, _ := service.GetDrugOpenConfigOne(c.GetAdminUserInfo().CurrentOrgId)
2319 2373
 			if openConfig.IsOpen != 1 {
2320 2374
 
2321 2375
 				//判断该医嘱是否执行了

+ 4 - 0
controllers/manager_center_api_controller.go View File

@@ -313,6 +313,8 @@ func (c *ManagerCenterApiController) EditBaseDrugLib() {
313 313
 	lmt_used_flag, _ := c.GetInt64("lmt_used_flag")
314 314
 	prescribing_number_unit := c.GetString("prescribing_number_unit")
315 315
 	is_user, _ := c.GetInt64("is_user")
316
+	sum_count, _ := c.GetInt64("sum_count")
317
+	sum_in_count, _ := c.GetInt64("sum_in_count")
316 318
 	adminInfo := c.GetAdminUserInfo()
317 319
 	drug, _ := service.FindBaseDrugLibRecord(adminInfo.CurrentOrgId, id)
318 320
 	drugLib := &models.BaseDrugLib{
@@ -382,6 +384,8 @@ func (c *ManagerCenterApiController) EditBaseDrugLib() {
382 384
 		SingleDose:                  drug_dose,
383 385
 		ProvincesCode:               provinces_code,
384 386
 		IsUse:                       is_user,
387
+		SumCount:                    sum_count,
388
+		SumInCount:                  sum_in_count,
385 389
 	}
386 390
 
387 391
 	err := service.UpdateBaseDrugLib(drugLib)

+ 2 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -532,7 +532,7 @@ func (this *DialysisAPIController) DialysisRecord() {
532 532
 	}
533 533
 
534 534
 	prescribeOne, _ := service.MobileGetDialysisPrescribeByModeIdOne(adminInfo.Org.Id, patientID, date.Unix())
535
-
535
+	fmt.Println("prescribeOne23223323232323223320303203200320320w02323232")
536 536
 	_, is_open_config := service.FindXTHisRecordByOrgId(adminInfo.Org.Id)
537 537
 
538 538
 	_, is_project_open_config = service.FindXTHisProjectByOrgId(adminInfo.Org.Id)
@@ -571,6 +571,7 @@ func (this *DialysisAPIController) DialysisRecord() {
571 571
 	if is_advice_open.IsAdviceOpen == 1 {
572 572
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
573 573
 	}
574
+
574 575
 	returnData := map[string]interface{}{
575 576
 		"patient":                        patient,
576 577
 		"schedual":                       schedual,

+ 67 - 37
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -725,24 +725,34 @@ func (c *PatientApiController) ExecDoctorAdvice() {
725 725
 								prescribing_number_total = count
726 726
 							}
727 727
 
728
-							if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
728
+							if medical.IsUse == 1 {
729 729
 								c.ServeSuccessJSON(map[string]interface{}{
730
-									"msg":    "3",
730
+									"msg":    "1",
731 731
 									"advice": advice,
732 732
 									"ids":    ids,
733 733
 								})
734 734
 								return
735 735
 							}
736
-							if prescribing_number_total > total {
737
-								c.ServeSuccessJSON(map[string]interface{}{
738
-									"msg":    "2",
739
-									"advice": advice,
740
-									"ids":    ids,
741
-								})
742
-								return
736
+
737
+							if medical.IsUse != 1 {
738
+								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
739
+									c.ServeSuccessJSON(map[string]interface{}{
740
+										"msg":    "3",
741
+										"advice": advice,
742
+										"ids":    ids,
743
+									})
744
+									return
745
+								}
746
+								if prescribing_number_total > total {
747
+									c.ServeSuccessJSON(map[string]interface{}{
748
+										"msg":    "2",
749
+										"advice": advice,
750
+										"ids":    ids,
751
+									})
752
+									return
753
+								}
743 754
 							}
744
-							fmt.Println("total23323232323232323232", total)
745
-							fmt.Println("total23323232323232323232", prescribing_number_total)
755
+
746 756
 							if prescribing_number_total <= total {
747 757
 
748 758
 								//查询是否出库按钮开启
@@ -826,24 +836,31 @@ func (c *PatientApiController) ExecDoctorAdvice() {
826 836
 								prescribing_number_total = count
827 837
 							}
828 838
 
829
-							fmt.Println("开医嘱数量", prescribing_number_total)
830
-							fmt.Println("剩余库存", total)
831
-
832
-							if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
839
+							if medical.IsUse == 1 {
833 840
 								c.ServeSuccessJSON(map[string]interface{}{
834
-									"msg":    "3",
841
+									"msg":    "1",
835 842
 									"advice": advice,
836 843
 									"ids":    ids,
837 844
 								})
838 845
 								return
839 846
 							}
840
-							if prescribing_number_total > total {
841
-								c.ServeSuccessJSON(map[string]interface{}{
842
-									"msg":    "2",
843
-									"advice": advice,
844
-									"ids":    ids,
845
-								})
846
-								return
847
+							if medical.IsUse != 1 {
848
+								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
849
+									c.ServeSuccessJSON(map[string]interface{}{
850
+										"msg":    "3",
851
+										"advice": advice,
852
+										"ids":    ids,
853
+									})
854
+									return
855
+								}
856
+								if prescribing_number_total > total {
857
+									c.ServeSuccessJSON(map[string]interface{}{
858
+										"msg":    "2",
859
+										"advice": advice,
860
+										"ids":    ids,
861
+									})
862
+									return
863
+								}
847 864
 							}
848 865
 
849 866
 							if prescribing_number_total <= total {
@@ -1121,21 +1138,34 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1121 1138
 							prescribing_number_total = count
1122 1139
 						}
1123 1140
 
1124
-						if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1125
-							c.ServeSuccessJSON(map[string]interface{}{
1126
-								"msg":    "3",
1127
-								"advice": advice,
1128
-								"ids":    ids,
1129
-							})
1130
-							return
1141
+						if medical.IsUse == 1 {
1142
+
1143
+							if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1144
+								c.ServeSuccessJSON(map[string]interface{}{
1145
+									"msg":    "1",
1146
+									"advice": advice,
1147
+									"ids":    ids,
1148
+								})
1149
+								return
1150
+							}
1131 1151
 						}
1132
-						if prescribing_number_total > total {
1133
-							c.ServeSuccessJSON(map[string]interface{}{
1134
-								"msg":    "2",
1135
-								"advice": advice,
1136
-								"ids":    ids,
1137
-							})
1138
-							return
1152
+						if medical.IsUse != 1 {
1153
+							if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1154
+								c.ServeSuccessJSON(map[string]interface{}{
1155
+									"msg":    "3",
1156
+									"advice": advice,
1157
+									"ids":    ids,
1158
+								})
1159
+								return
1160
+							}
1161
+							if prescribing_number_total > total {
1162
+								c.ServeSuccessJSON(map[string]interface{}{
1163
+									"msg":    "2",
1164
+									"advice": advice,
1165
+									"ids":    ids,
1166
+								})
1167
+								return
1168
+							}
1139 1169
 						}
1140 1170
 
1141 1171
 						if prescribing_number_total <= total {

+ 58 - 29
controllers/patient_api_controller.go View File

@@ -1687,20 +1687,30 @@ func (c *PatientApiController) ExecGroupAdvice() {
1687 1687
 
1688 1688
 			}
1689 1689
 
1690
-			if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1690
+			if medical.IsUse == 1 {
1691 1691
 				c.ServeSuccessJSON(map[string]interface{}{
1692
-					"msg":    "3",
1692
+					"msg":    "1",
1693 1693
 					"advice": advice,
1694 1694
 				})
1695 1695
 				return
1696 1696
 			}
1697
-			if prescribing_number_total > total {
1698
-				c.ServeSuccessJSON(map[string]interface{}{
1699
-					"msg":    "2",
1700
-					"advice": advice,
1701
-				})
1702
-				return
1697
+			if medical.IsUse != 1 {
1698
+				if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1699
+					c.ServeSuccessJSON(map[string]interface{}{
1700
+						"msg":    "3",
1701
+						"advice": advice,
1702
+					})
1703
+					return
1704
+				}
1705
+				if prescribing_number_total > total {
1706
+					c.ServeSuccessJSON(map[string]interface{}{
1707
+						"msg":    "2",
1708
+						"advice": advice,
1709
+					})
1710
+					return
1711
+				}
1703 1712
 			}
1713
+
1704 1714
 			if prescribing_number_total <= total {
1705 1715
 				if medical.IsUse == 2 {
1706 1716
 					service.DrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
@@ -1891,20 +1901,31 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1891 1901
 					prescribing_number_total = count
1892 1902
 				}
1893 1903
 
1894
-				if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1895
-					c.ServeSuccessJSON(map[string]interface{}{
1896
-						"msg":    "3",
1897
-						"advice": advice,
1898
-					})
1899
-					return
1904
+				if medical.IsUse != 1 {
1905
+					if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1906
+						c.ServeSuccessJSON(map[string]interface{}{
1907
+							"msg":    "3",
1908
+							"advice": advice,
1909
+						})
1910
+						return
1911
+					}
1912
+					if prescribing_number_total > total {
1913
+						c.ServeSuccessJSON(map[string]interface{}{
1914
+							"msg":    "2",
1915
+							"advice": advice,
1916
+						})
1917
+						return
1918
+					}
1900 1919
 				}
1901
-				if prescribing_number_total > total {
1920
+
1921
+				if medical.IsUse == 1 {
1902 1922
 					c.ServeSuccessJSON(map[string]interface{}{
1903
-						"msg":    "2",
1923
+						"msg":    "1",
1904 1924
 						"advice": advice,
1905 1925
 					})
1906 1926
 					return
1907 1927
 				}
1928
+
1908 1929
 				if prescribing_number_total <= total {
1909 1930
 
1910 1931
 					//查询是否门诊处方和临时医嘱同步到透析医嘱的开关是否开启
@@ -1914,7 +1935,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1914 1935
 					if adviceSetting.IsAdviceOpen == 1 {
1915 1936
 						//查询是否出库按钮开启
1916 1937
 						prescriptionConfig, _ := service.FindPrescriptionConfigById(item.UserOrgId)
1917
-						fmt.Println("prescriptionConfigwodweweeeweweweweweewewewwewew", prescriptionConfig.IsOpen)
1938
+
1918 1939
 						if prescriptionConfig.IsOpen == 1 {
1919 1940
 							if medical.IsUse == 2 {
1920 1941
 								service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
@@ -2135,7 +2156,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2135 2156
 
2136 2157
 		//药品管理信息
2137 2158
 		_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(adminUserInfo.CurrentOrgId)
2138
-		fmt.Println("h2h332o2o23o32o32o32oo32o23o23o23o23o23o32o23o232o3wode", drugStockConfig.IsOpen)
2159
+
2139 2160
 		if drugStockConfig.IsOpen == 1 {
2140 2161
 			//查询已经执行的医嘱
2141 2162
 			advices, _ := service.GetHisExecutionDoctorsTwo(adminUserInfo.CurrentOrgId, patient, id)
@@ -2207,26 +2228,34 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2207 2228
 
2208 2229
 					}
2209 2230
 
2210
-					if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
2231
+					if medical.IsUse == 1 {
2211 2232
 						c.ServeSuccessJSON(map[string]interface{}{
2212
-							"msg":    "3",
2233
+							"msg":    "1",
2213 2234
 							"advice": advice,
2214 2235
 						})
2215 2236
 						return
2216 2237
 					}
2217
-					fmt.Println("prescribing_number_totalwodeeeeeeeeeeeeee", prescribing_number_total)
2218
-					fmt.Println("total3233332323223322323322323", total)
2219
-					if prescribing_number_total > total {
2220
-						c.ServeSuccessJSON(map[string]interface{}{
2221
-							"msg":    "2",
2222
-							"advice": advice,
2223
-						})
2224
-						return
2238
+					if medical.IsUse != 1 {
2239
+						if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
2240
+							c.ServeSuccessJSON(map[string]interface{}{
2241
+								"msg":    "3",
2242
+								"advice": advice,
2243
+							})
2244
+							return
2245
+						}
2246
+
2247
+						if prescribing_number_total > total {
2248
+							c.ServeSuccessJSON(map[string]interface{}{
2249
+								"msg":    "2",
2250
+								"advice": advice,
2251
+							})
2252
+							return
2253
+						}
2225 2254
 					}
2226 2255
 
2227 2256
 					if prescribing_number_total <= total {
2228 2257
 						if medical.IsUse == 2 {
2229
-							fmt.Println("config233232323232232333223232332323233223322232wode", config.IsOpen)
2258
+
2230 2259
 							if config.IsOpen != 1 {
2231 2260
 								service.HisDrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
2232 2261
 								//查询默认仓库

File diff suppressed because it is too large
+ 249 - 758
controllers/stock_in_api_controller.go


+ 16 - 15
models/his_charge_models.go View File

@@ -87,21 +87,22 @@ func (SettlePatient) TableName() string {
87 87
 }
88 88
 
89 89
 type HisChargeOrder struct {
90
-	ID                 int64                 `gorm:"column:id" json:"id" form:"id"`
91
-	UserOrgId          int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
92
-	HisPatientId       int64                 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
93
-	SettleAccountsDate int64                 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
94
-	Status             int64                 `gorm:"column:status" json:"status" form:"status"`
95
-	Number             string                `gorm:"column:number" json:"number" form:"number"`
96
-	OrderStatus        int64                 `gorm:"column:order_status" json:"order_status" form:"order_status"`
97
-	MdtrtId            string                `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
98
-	PatientId          int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
99
-	HifesPay           float64               `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
100
-	MafPay             float64               `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
101
-	FundPaySumamt      float64               `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
102
-	AcctPay            float64               `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
103
-	PsnCashPay         float64               `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
104
-	HisChargeOrderInfo []*HisChargeOrderInfo `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"order_info"`
90
+	ID                  int64                 `gorm:"column:id" json:"id" form:"id"`
91
+	UserOrgId           int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
92
+	HisPatientId        int64                 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
93
+	SettleAccountsDate  int64                 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
94
+	Status              int64                 `gorm:"column:status" json:"status" form:"status"`
95
+	Number              string                `gorm:"column:number" json:"number" form:"number"`
96
+	OrderStatus         int64                 `gorm:"column:order_status" json:"order_status" form:"order_status"`
97
+	MdtrtId             string                `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
98
+	PatientId           int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
99
+	HifesPay            float64               `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
100
+	MafPay              float64               `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
101
+	FundPaySumamt       float64               `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
102
+	AcctPay             float64               `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
103
+	PsnCashPay          float64               `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
104
+	IsMedicineInsurance int64                 `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
105
+	HisChargeOrderInfo  []*HisChargeOrderInfo `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"order_info"`
105 106
 }
106 107
 
107 108
 func (HisChargeOrder) TableName() string {

+ 1 - 1
models/his_models.go View File

@@ -1036,7 +1036,7 @@ type HisOrder struct {
1036 1036
 	HisOrderInfo           HisOrderInfo           `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
1037 1037
 	Patients               Patients               `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
1038 1038
 	HisPatient             HisPatient             `gorm:"ForeignKey:MdtrtId;AssociationForeignKey:Number" json:"his_patient"`
1039
-	HisHospitalCheckRecord HisHospitalCheckRecord `gorm:"ForeignKey:MdtrtId,PatientId;AssociationForeignKey:Number,PatientId" json:"his_hospital_patient"`
1039
+	HisHospitalCheckRecord HisHospitalCheckRecord `gorm:"ForeignKey:MdtrtId;AssociationForeignKey:Number" json:"his_hospital_patient"`
1040 1040
 
1041 1041
 	HisPrescriptionInfo HisPrescriptionInfo `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"p_info"`
1042 1042
 

+ 1 - 0
service/his_service.go View File

@@ -775,6 +775,7 @@ type BaseDrugLib struct {
775 775
 	Total                       float64 `gorm:"column:total" json:"total" form:"total"`
776 776
 	PrescribingNumberUnit       string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
777 777
 	BatchRetaiPrice             float64 `gorm:"column:batch_retai_price" json:"batch_retai_price" form:"batch_retai_price"`
778
+	IsUser                      int64   `gorm:"column:is_user" json:"is_user" form:"is_user"`
778 779
 	SumCount                    int64   `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
779 780
 	SumInCount                  int64   `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
780 781
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`

+ 1 - 1
service/his_summary_service.go View File

@@ -9,7 +9,7 @@ import (
9 9
 func GetHisSummaryDetailList(keyword string, item_type int64, patient_id int64, org_id int64, start_time int64, end_time int64) (patients []*models.ChargePatient, err error) {
10 10
 
11 11
 	err = XTReadDB().Table("xt_patients as p").Select("p.id,p.user_org_id,p.name,p.lapseto,p.status").Joins("JOIN his_order AS orders ON orders.patient_id = p.id AND orders.status = 1  AND orders.ctime >= ? AND orders.ctime <= ? AND orders.user_org_id = ? AND orders.order_status = 2 and orders.patient_id = ?", start_time, end_time, org_id, patient_id).Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
12
-		return db.Select("id,user_org_id,his_patient_id,settle_accounts_date,status,number,order_status,mdtrt_id,patient_id,psn_cash_pay,acct_pay,fund_pay_sumamt").
12
+		return db.Select("id,user_org_id,his_patient_id,settle_accounts_date,status,number,order_status,mdtrt_id,patient_id,psn_cash_pay,acct_pay,fund_pay_sumamt,is_medicine_insurance").
13 13
 			Preload("HisChargeOrderInfo", func(db *gorm.DB) *gorm.DB {
14 14
 				return db.Select("id,order_number,advice_id,det_item_fee_sumamt,cnt,pric,med_chrgitm_type,status,chld_medc_flag,chrgitm_lv,user_org_id,project_id,type").Where("status = 1").
15 15
 					Preload("HisChargeDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {

+ 1 - 1
service/mobile_dialysis_service.go View File

@@ -2149,7 +2149,7 @@ func MobileGetDialysisPrescribeByModeId(orgID int64, patientID int64, recordDate
2149 2149
 
2150 2150
 	// cur_date := time.Now().Format("2006-01-02")
2151 2151
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2152
-
2152
+	fmt.Println("key23322323232323", key)
2153 2153
 	dialysis_prescribe_str, _ := redis.Get(key).Result()
2154 2154
 
2155 2155
 	if len(dialysis_prescribe_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis

+ 2 - 2
service/stock_service.go View File

@@ -4341,7 +4341,7 @@ func GetOutExprotList(orgid int64, ids []string, startime int64, endtime int64)
4341 4341
 		db = db.Where("x.ctime<=?", endtime)
4342 4342
 	}
4343 4343
 
4344
-	err = db.Select("x.id,x.warehouse_out_id,x.good_id,x.good_type_id,x.warehousing_out_target,x.count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.remark,x.number,x.license_number,t.good_name,t.specification_name,t.min_number,t.packing_price,t.min_unit,t.packing_unit,t.manufacturer,t.dealer").Joins("left join xt_good_information as t on t.id = x.good_id").Scan(&out).Error
4344
+	err = db.Select("x.id,x.warehouse_out_id,x.good_id,x.good_type_id,x.warehousing_out_target,x.count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.remark,x.number,x.license_number,t.good_name,t.specification_name,t.min_number,t.packing_price,t.min_unit,t.packing_unit,x.manufacturer,x.dealer").Joins("left join xt_good_information as t on t.id = x.good_id").Scan(&out).Error
4345 4345
 	return out, err
4346 4346
 
4347 4347
 }
@@ -4776,7 +4776,7 @@ func GetExportOutOrderDrugListOne(warehouse_out_id []string) (out []*models.StDr
4776 4776
 	if len(warehouse_out_id) > 0 {
4777 4777
 		db = db.Where("x.warehouse_out_id in(?)", warehouse_out_id)
4778 4778
 	}
4779
-	err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.count,x.max_unit as count_unit,x.price,x.product_date,x.expire_date,x.warehouse_out_order_number,x.dealer,x.manufacturer,x.is_sys,x.number,x.batch_number,x.patient_id,b.dose,b.dose_unit,b.min_number,b.min_unit,b.max_unit,b.drug_name,b.drug_type,b.min_price").Joins("left join xt_base_drug as b on b.id = x.drug_id").Scan(&out).Error
4779
+	err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.count,x.max_unit as count_unit,x.price,x.product_date,x.expire_date,x.warehouse_out_order_number,x.dealer,x.manufacturer,x.is_sys,x.number,x.batch_number,x.patient_id,x.ctime,b.dose,b.dose_unit,b.min_number,b.min_unit,b.max_unit,b.drug_name,b.drug_type,b.min_price").Joins("left join xt_base_drug as b on b.id = x.drug_id").Scan(&out).Error
4780 4780
 	return out, err
4781 4781
 }
4782 4782