Browse Source

耗材参数

XMLWAN 3 years ago
parent
commit
f016fd2049

+ 24 - 8
controllers/drug_stock_api_contorller.go View File

@@ -197,13 +197,20 @@ func (c *StockDrugApiController) CreateDrugWarehouse() {
197 197
 				}
198 198
 				batch_number, _ := items["batch_number"].(string)
199 199
 
200
-				if items["packing_unit"] == nil || reflect.TypeOf(items["packing_unit"]).String() != "string" {
201
-					utils.ErrorLog("packing_unit")
200
+				if items["max_unit"] == nil || reflect.TypeOf(items["max_unit"]).String() != "string" {
201
+					utils.ErrorLog("max_unit")
202 202
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
203 203
 					return
204 204
 				}
205
-				packing_unit, _ := items["packing_unit"].(string)
206
-
205
+				max_unit, _ := items["max_unit"].(string)
206
+				fmt.Println("最大单位00000000000000000000000000000000", max_unit)
207
+				if items["min_unit"] == nil || reflect.TypeOf(items["min_unit"]).String() != "string" {
208
+					utils.ErrorLog("min_unit")
209
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
210
+					return
211
+				}
212
+				min_unit, _ := items["min_unit"].(string)
213
+				fmt.Println("最下单位0090000000000000000000", min_unit)
207 214
 				var remark string
208 215
 				if items["remark"] == nil || reflect.TypeOf(items["remark"]).String() != "string" {
209 216
 					remark = ""
@@ -232,7 +239,8 @@ func (c *StockDrugApiController) CreateDrugWarehouse() {
232 239
 					StockMaxNumber:   warehousing_count,
233 240
 					RetailTotalPrice: retail_price_total,
234 241
 					BatchNumber:      batch_number,
235
-					MaxUnit:          packing_unit,
242
+					MaxUnit:          max_unit,
243
+					MinUnit:          min_unit,
236 244
 				}
237 245
 				warehousingInfo = append(warehousingInfo, warehouseInfo)
238 246
 
@@ -611,6 +619,10 @@ func (c *StockDrugApiController) EditDrugWarehouse() {
611 619
 				}
612 620
 				batch_number, _ := items["batch_number"].(string)
613 621
 
622
+				max_unit, _ := items["max_unit"].(string)
623
+
624
+				min_unit, _ := items["min_unit"].(string)
625
+
614 626
 				var remark string
615 627
 				if items["remark"] == nil || reflect.TypeOf(items["remark"]).String() != "string" {
616 628
 					remark = ""
@@ -659,6 +671,8 @@ func (c *StockDrugApiController) EditDrugWarehouse() {
659 671
 						RetailPrice:      last_price,
660 672
 						RetailTotalPrice: retail_price_total,
661 673
 						BatchNumber:      batch_number,
674
+						MaxUnit:          max_unit,
675
+						MinUnit:          min_unit,
662 676
 					}
663 677
 					warehousingInfo = append(warehousingInfo, warehouseInfo)
664 678
 
@@ -684,6 +698,8 @@ func (c *StockDrugApiController) EditDrugWarehouse() {
684 698
 						RetailPrice:      last_price,
685 699
 						RetailTotalPrice: retail_price_total,
686 700
 						StockMaxNumber:   warehousing_count,
701
+						MaxUnit:          max_unit,
702
+						MinUnit:          min_unit,
687 703
 					}
688 704
 					upDateWarehousingInfo = append(upDateWarehousingInfo, warehouseInfo)
689 705
 				}
@@ -1209,9 +1225,9 @@ func (c *StockDrugApiController) CreateDrugWarehouseOut() {
1209 1225
 				total := float64(count) * price
1210 1226
 				retail_price_total := float64(count) * last_price
1211 1227
 				remark := items["remark"].(string)
1212
-				packing_unit := items["packing_unit"].(string)
1228
+				max_unit := items["max_unit"].(string)
1213 1229
 
1214
-				fmt.Println("包装单位999999999999", packing_unit)
1230
+				fmt.Println("包装单位999999999999", max_unit)
1215 1231
 
1216 1232
 				warehouseOutInfo := &models.DrugWarehouseOutInfo{
1217 1233
 					WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
@@ -1229,7 +1245,7 @@ func (c *StockDrugApiController) CreateDrugWarehouseOut() {
1229 1245
 					Dealer:                  dealer_id,
1230 1246
 					RetailPrice:             last_price,
1231 1247
 					RetailTotalPrice:        retail_price_total,
1232
-					CountUnit:               packing_unit,
1248
+					CountUnit:               max_unit,
1233 1249
 				}
1234 1250
 				warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1235 1251
 

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

@@ -989,7 +989,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
989 989
 						}
990 990
 						//查询 该患者是否已出库
991 991
 						out, errcode := service.GetSelfOutStock(adminUserInfo.Org.Id, item.AdviceDate, item.PatientId, item.AdviceName, item.AdviceDesc)
992
-						fmt.Println("errcode ------------------22222", errcode)
992
+
993 993
 						if errcode == gorm.ErrRecordNotFound {
994 994
 							service.CreateOutStock(&outStock)
995 995
 						} else if errcode == nil {
@@ -1093,6 +1093,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1093 1093
 		if err == nil {
1094 1094
 			//药品管理信息
1095 1095
 			_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(adminInfo.Org.Id)
1096
+			fmt.Println("drugstockconfig000000000000000000000000", drugStockConfig.IsOpen)
1096 1097
 			if drugStockConfig.IsOpen == 1 {
1097 1098
 				advice, _ := service.FindHisDoctorAdviceById(adminInfo.Org.Id, advice_id)
1098 1099
 				record_time := advice.RecordDate

+ 2 - 1
controllers/patient_api_controller.go View File

@@ -1570,6 +1570,7 @@ func (c *PatientApiController) ExecGroupAdvice() {
1570 1570
 
1571 1571
 func (c *PatientApiController) ExecDoctorAdvice() {
1572 1572
 
1573
+	fmt.Println("hhhhhhhhhhhhhhh9999999999")
1573 1574
 	origin, _ := c.GetInt64("origin", 0)
1574 1575
 
1575 1576
 	patient, _ := c.GetInt64("patient", 0)
@@ -2173,7 +2174,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2173 2174
 
2174 2175
 		//药品管理信息
2175 2176
 		_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(adminUserInfo.CurrentOrgId)
2176
-
2177
+		fmt.Println("000000000000000000000000000000000000", drugStockConfig.IsOpen)
2177 2178
 		if drugStockConfig.IsOpen == 1 {
2178 2179
 			//查询已经执行的医嘱
2179 2180
 			advices, _ := service.GetHisExecutionDoctors(adminUserInfo.CurrentOrgId, patient, id)

+ 5 - 3
service/stock_service.go View File

@@ -417,11 +417,11 @@ func CreateDrugWarehousingInfo(warehousingInfo []*models.DrugWarehouseInfo) (err
417 417
 	if len(warehousingInfo) > 0 {
418 418
 		utx := writeDb.Begin()
419 419
 		if len(warehousingInfo) > 0 {
420
-			thisSQL := "INSERT INTO xt_drug_warehouse_info (warehousing_id, drug_id, number, product_date,expiry_date,warehousing_count,price,total_price,dealer,manufacturer,remark,ctime,mtime,status,org_id,warehousing_order,type,retail_price,retail_total_price,stock_max_number) VALUES "
420
+			thisSQL := "INSERT INTO xt_drug_warehouse_info (warehousing_id, drug_id, number, product_date,expiry_date,warehousing_count,price,total_price,dealer,manufacturer,remark,ctime,mtime,status,org_id,warehousing_order,type,retail_price,retail_total_price,stock_max_number,max_unit,min_unit) VALUES "
421 421
 			insertParams := make([]string, 0)
422 422
 			insertData := make([]interface{}, 0)
423 423
 			for _, info := range warehousingInfo {
424
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
424
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
425 425
 				insertData = append(insertData, info.WarehousingId)
426 426
 				insertData = append(insertData, info.DrugId)
427 427
 				insertData = append(insertData, info.Number)
@@ -442,6 +442,8 @@ func CreateDrugWarehousingInfo(warehousingInfo []*models.DrugWarehouseInfo) (err
442 442
 				insertData = append(insertData, info.RetailPrice)
443 443
 				insertData = append(insertData, info.RetailTotalPrice)
444 444
 				insertData = append(insertData, info.StockMaxNumber)
445
+				insertData = append(insertData, info.MaxUnit)
446
+				insertData = append(insertData, info.MinUnit)
445 447
 			}
446 448
 			thisSQL += strings.Join(insertParams, ", ")
447 449
 			err = utx.Exec(thisSQL, insertData...).Error
@@ -1029,7 +1031,7 @@ func FindAllDrugWarehouseOutList(orgId int64, page int64, limit int64, startTime
1029 1031
 }
1030 1032
 
1031 1033
 func FindWarehouseOutInfoById(id int64) (list []*models.WarehouseOutInfo, err error) {
1032
-	err = readDb.Model(&models.WarehouseOutInfo{}).Where("warehouse_out_id = ? AND status = 1 AND count <> 0 AND good_id <> 0", id).Order("good_type_id desc").Find(&list).Error
1034
+	err = readDb.Model(&models.WarehouseOutInfo{}).Where("warehouse_out_id = ? AND status = 1 AND count <> 0 AND good_id <> 0", id).Preload("GoodInfo", "status = 1").Order("good_type_id desc").Find(&list).Error
1033 1035
 	return list, err
1034 1036
 }
1035 1037
 

+ 8 - 6
service/warhouse_service.go View File

@@ -105,8 +105,11 @@ func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *model
105 105
 	warehouse, err := FindLastDrugWarehousingInfoByID(advice.DrugId)
106 106
 
107 107
 	if err != nil {
108
+		fmt.Println("9999998888888888888888888888888")
108 109
 
109
-		return err
110
+		returnData := make(map[string]interface{}, 0)
111
+		returnData["msg"] = "ok"
112
+		return
110 113
 	}
111 114
 
112 115
 	// 将该批次的剩余库存数量转换为拆零数量
@@ -265,10 +268,8 @@ func HisDrugsDelivery(orgID int64, advice *models.HisDoctorAdviceInfo) (err erro
265 268
 	// 3.1 实现先进先出逻辑 由于药品执行后,不可以修改和删除,所以不考虑出库后的退库和修改出库数量等
266 269
 	isHasWay := false
267 270
 	record_time := int64(0)
268
-	if advice.Way == 1 {
269
-		isHasWay = true
270
-		record_time = advice.RecordDate
271
-	}
271
+	isHasWay = true
272
+	record_time = advice.RecordDate
272 273
 	if isHasWay {
273 274
 		//判断当天当前机构有没有创建出库单,没有则创建
274 275
 		out, err := FindDrugStockOutByIsSys(orgID, 1, record_time)
@@ -330,7 +331,8 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
330 331
 
331 332
 	prescribingNumber_temp := strconv.FormatFloat(math.Abs(prescribingNumber), 'f', 0, 64)
332 333
 	count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
333
-
334
+	fmt.Println("单位99999999999999999999999999", advice.PrescribingNumberUnit)
335
+	fmt.Println("drup777777777777766666666", drup.MaxUnit)
334 336
 	if advice.PrescribingNumberUnit == drup.MaxUnit {
335 337
 		deliver_number = count * drup.MinNumber
336 338
 	} else {