Преглед на файлове

Merge branch '20220812' of http://git.shengws.com/csx/XT_New into 20220812

test_user преди 1 година
родител
ревизия
5b4a491d5b

+ 1 - 1
controllers/dialysis_api_controller.go Целия файл

@@ -2968,7 +2968,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
2968 2968
 	}
2969 2969
 	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 10345 {
2970 2970
 
2971
-		if xttime <= 1640966400 {
2971
+		if xttime <= 1672416000 {
2972 2972
 			dialysis_count, _ := service.GetDialysisOrderCountOne(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
2973 2973
 			patientInfo.TotalDialysis = dialysis_count
2974 2974
 		}

+ 0 - 1
controllers/his_api_controller.go Целия файл

@@ -6645,7 +6645,6 @@ func (c *HisApiController) Refund() {
6645 6645
 			infos = append(infos, &info.HisDoctorAdviceInfo)
6646 6646
 		}
6647 6647
 		if info.ProjectId > 0 && info.AdviceId == 0 {
6648
-			fmt.Println("info232323233232233", order_id)
6649 6648
 			if info.HisPrescriptionProject.Type == 3 {
6650 6649
 				var good models.DialysisBeforePrepareGoods
6651 6650
 				var newGood models.NewDialysisBeforePrepareGoods

+ 3 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Целия файл

@@ -665,6 +665,9 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
665 665
 				if adminUserInfo.Org.Id == 10340 {
666 666
 					evaluation.BreathingRate = "20"
667 667
 				}
668
+				if adminUserInfo.Org.Id == 10445 {
669
+					evaluation.VenousCatheterization = lastPredialysisEvaluation.VenousCatheterization
670
+				}
668 671
 			}
669 672
 		} else {
670 673
 			evaluation.UpdatedTime = time.Now().Unix()

+ 1 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go Целия файл

@@ -531,6 +531,7 @@ func (this *DialysisAPIController) DialysisRecord() {
531 531
 	temp_team_projects, _ := service.GetHisPrescriptionTeamProjects(adminInfo.Org.Id, patientID, date.Unix())
532 532
 
533 533
 	prescriptionConfig, _ := service.FindPrescriptionConfigById(adminInfo.Org.Id)
534
+
534 535
 	var team_projects []*models.HisPrescriptionProject
535 536
 	//var index int64 = 0
536 537
 	for _, item := range temp_team_projects {

+ 20 - 1
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Целия файл

@@ -2873,6 +2873,25 @@ func (this *NewDialysisApiController) GetTreateSummary() {
2873 2873
 func (this *NewDialysisApiController) CommitDialysisOrder() {
2874 2874
 
2875 2875
 	org_id := this.GetMobileAdminUserInfo().Org.Id
2876
-	fmt.Println("org_id ===23232323232332", org_id)
2876
+
2877
+	//查询所有患者
2878
+
2879
+	list, err := service.GetAllPatientScheduleList(org_id)
2880
+
2881
+	for _, item := range list {
2882
+		//查询所有患者的2022年12月31日以前的上机记录
2883
+		orderList, _ := service.GetAllDialysiOrderList(item.ID, org_id)
2884
+		for _, it := range orderList {
2885
+			dialysOrder, _ := service.GetDialysisTotalCountThree(it.UserOrgId, it.PatientId, it.DialysisDate)
2886
+			service.UpdateDialysisOrderSix(it.PatientId, it.DialysisDate, it.UserOrgId, dialysOrder.Count)
2887
+		}
2888
+	}
2889
+
2890
+	if err == nil {
2891
+		this.ServeSuccessJSON(map[string]interface{}{
2892
+			"list": list,
2893
+		})
2894
+		return
2895
+	}
2877 2896
 
2878 2897
 }

+ 69 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Целия файл

@@ -259,6 +259,75 @@ func (this *StaffScheduleApiController) GetAllZone() {
259 259
 	})
260 260
 }
261 261
 
262
+func (this *StaffScheduleApiController) GetAllZonePb() {
263
+	orgid := this.GetMobileAdminUserInfo().Org.Id
264
+	timeLayout := "2006-01-02"
265
+	loc, _ := time.LoadLocation("Local")
266
+	start_time := this.GetString("start_time")
267
+	var startTime int64
268
+	if len(start_time) > 0 {
269
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
270
+		if err != nil {
271
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
272
+			return
273
+		}
274
+		startTime = theTime.Unix()
275
+	}
276
+	zoneid, _ := this.GetInt64("zoneid")
277
+	classtype, _ := this.GetInt64("classtype")
278
+
279
+	// is_open, _ := this.GetInt64("is_open")
280
+
281
+	
282
+	//获取空床位的排班数据
283
+	list, _ := service.GetPatientScheduleByPd(startTime, zoneid, orgid, classtype)
284
+	if len(list) > 0 {
285
+		for _, item := range list {
286
+			for _, device := range item.DeviceNumber {
287
+				item.TotalBed += 1
288
+				for _, schedule := range device.Schedule {
289
+					if schedule.ScheduleType == 1 {
290
+						item.SwBed += 1
291
+					}
292
+					if schedule.ScheduleType == 2 {
293
+						item.XwBed += 1
294
+					}
295
+					if schedule.ScheduleType == 3 {
296
+						item.WsBed += 1
297
+					}
298
+				}
299
+			}
300
+		}
301
+	}
302
+
303
+	// stockType, _ := service.GetStockType(orgid)
304
+	// zonelist, _ := service.GetPatientScheduleListByZone(startTime, classtype, orgid)
305
+	// if err != nil {
306
+	// 	this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
307
+	// 	return
308
+	// }
309
+	this.ServeSuccessJSON(map[string]interface{}{
310
+		"schedule":  list,
311
+		// "stockType": stockType,
312
+		// "zonelist":  zonelist,
313
+	})
314
+	
315
+
316
+
317
+
318
+	// id := this.GetMobileAdminUserInfo().Org.Id
319
+	// zone, err := service.GetAllMobileZonePb(id)
320
+
321
+	// if err != nil {
322
+	// 	this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
323
+	// 	return
324
+	// }
325
+	// this.ServeSuccessJSON(map[string]interface{}{
326
+	// 	"zone": zone,
327
+	// })
328
+}
329
+
330
+
262 331
 func (this *StaffScheduleApiController) GetPatientScheduleList() {
263 332
 	orgid := this.GetMobileAdminUserInfo().Org.Id
264 333
 	fmt.Println("orgid", orgid)

+ 1 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_router.go Целия файл

@@ -16,6 +16,7 @@ func StaffScheduleApiControllersRegisterRouters() {
16 16
 	beego.Router("/m/api/tosearchmobiletotal", &StaffScheduleApiController{}, "Get:ToSearchMobileTotal")
17 17
 	beego.Router("/m/api/changemobileoption", &StaffScheduleApiController{}, "Get:ChangeMobileOption")
18 18
 	beego.Router("/m/api/getallzone", &StaffScheduleApiController{}, "Get:GetAllZone")
19
+	beego.Router("/m/api/getallzonepb", &StaffScheduleApiController{}, "Get:GetAllZonePb")
19 20
 	beego.Router("/m/api/getpatientschedulelist", &StaffScheduleApiController{}, "Get:GetPatientScheduleList")
20 21
 	beego.Router("/m/api/deleteSchedule", &StaffScheduleApiController{}, "Get:DeleteSchedule")
21 22
 	beego.Router("/m/api/ssearchpatient", &StaffScheduleApiController{}, "Get:SearchPatient")

+ 0 - 3
controllers/patient_api_controller.go Целия файл

@@ -4526,10 +4526,7 @@ func (c *PatientApiController) GetRemindPatientList() {
4526 4526
 	limit, _ := c.GetInt64("limit", 10)
4527 4527
 	adminUserInfo := c.GetAdminUserInfo()
4528 4528
 	total, patients, _ := service.GetAllWaitRemindPatient(adminUserInfo.CurrentOrgId, page, limit)
4529
-	fmt.Println("机构ID2222222222222", c.GetAdminUserInfo().CurrentOrgId)
4530
-
4531 4529
 	_, errcode := service.GetOrgFollowIsExist(c.GetAdminUserInfo().CurrentOrgId)
4532
-	fmt.Println("机构ID2222222222222", errcode)
4533 4530
 	if errcode == gorm.ErrRecordNotFound {
4534 4531
 		information, err := service.GetAdminUserRoleInformation(0)
4535 4532
 		if err != nil {

+ 67 - 1
controllers/schedule_api_controller.go Целия файл

@@ -63,6 +63,7 @@ func ScheduleApiRegistRouters() {
63 63
 
64 64
 	beego.Router("/api/schedule/weekpanelone", &ScheduleApiController{}, "Get:GetWeekPanelsOne")
65 65
 	beego.Router("/api/schedule/schedulesone", &ScheduleApiController{}, "Get:GetScheduleOne")
66
+	beego.Router("/api/schedule/scheduletwo", &ScheduleApiController{}, "Get:GetScheduleTwo")
66 67
 	beego.Router("/api/schedule/postscheduletemplate", &ScheduleApiController{}, "Get:SaveScheduleTemplate")
67 68
 	beego.Router("/api/schedule/getscheduletemplate", &ScheduleApiController{}, "Get:GetScheduleTemplate")
68 69
 	beego.Router("/api/order/changefuncprint", &ScheduleApiController{}, "Get:ChangeFuncPrint")
@@ -4001,6 +4002,72 @@ func (c *ScheduleApiController) GetScheduleOne() {
4001 4002
 	return
4002 4003
 }
4003 4004
 
4005
+func (c *ScheduleApiController) GetScheduleTwo() {
4006
+
4007
+	week, _ := c.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
4008
+	patitionIdStr := c.GetString("patitionid")
4009
+
4010
+	ids := strings.Split(patitionIdStr, ",")
4011
+
4012
+	schedule_type, _ := c.GetInt64("schedule_type")
4013
+
4014
+	adminInfo := c.GetAdminUserInfo()
4015
+	weekDateStr := c.GetString("week_date")
4016
+	WeekDayIds := strings.Split(weekDateStr, ",")
4017
+
4018
+	thisTime := time.Now()
4019
+	today := thisTime.Format("2006-01-02")
4020
+	if week < 1 || week > 4 {
4021
+		week = 2
4022
+	}
4023
+	if week == 1 {
4024
+		thisTime = thisTime.AddDate(0, 0, -7)
4025
+	} else if week == 3 {
4026
+		thisTime = thisTime.AddDate(0, 0, 7)
4027
+	} else if week == 4 {
4028
+		thisTime = thisTime.AddDate(0, 0, 14)
4029
+	}
4030
+
4031
+	weekDay := int(thisTime.Weekday())
4032
+	if weekDay == 0 {
4033
+		weekDay = 7
4034
+	}
4035
+	weekEnd := 7 - weekDay
4036
+	weekStart := weekEnd - 6
4037
+	weekTitle := make([]string, 0)
4038
+	days := make([]string, 0)
4039
+	for index := weekStart; index <= weekEnd; index++ {
4040
+		theDay := thisTime.AddDate(0, 0, index)
4041
+		indexYear, indexMonthTime, indexDay := theDay.Date()
4042
+		indexMonth := int(indexMonthTime)
4043
+		indexWeek := strconv.Itoa(indexYear) + "." + strconv.Itoa(indexMonth) + "." + strconv.Itoa(indexDay)
4044
+		weekTitle = append(weekTitle, indexWeek)
4045
+		days = append(days, theDay.Format("2006-01-02"))
4046
+	}
4047
+
4048
+	weekStartDay := thisTime.AddDate(0, 0, weekStart)
4049
+	weekEndDay := thisTime.AddDate(0, 0, weekEnd)
4050
+	weekStartTime := weekStartDay.Format("2006-01-02") + " 00:00:00"
4051
+	weekEndTime := weekEndDay.Format("2006-01-02") + " 23:59:59"
4052
+
4053
+	timeLayout := "2006-01-02 15:04:05"
4054
+	loc, _ := time.LoadLocation("Local")
4055
+	theStarTime, _ := time.ParseInLocation(timeLayout, weekStartTime, loc)
4056
+	theEndTime, _ := time.ParseInLocation(timeLayout, weekEndTime, loc)
4057
+	weekStartPoint := theStarTime.Unix()
4058
+	weekEndPoint := theEndTime.Unix()
4059
+
4060
+	schdules, _ := service.GetWeekScheduleThree(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type, WeekDayIds)
4061
+
4062
+	c.ServeSuccessJSON(map[string]interface{}{
4063
+		"days":      days,
4064
+		"weekTitle": weekTitle,
4065
+		"schdules":  schdules,
4066
+		"today":     today,
4067
+	})
4068
+	return
4069
+}
4070
+
4004 4071
 func (c *ScheduleApiController) SaveScheduleTemplate() {
4005 4072
 
4006 4073
 	template_id, _ := c.GetInt64("template_id")
@@ -4050,7 +4117,6 @@ func (c *ScheduleApiController) ChangeFuncPrint() {
4050 4117
 	}
4051 4118
 
4052 4119
 	_, errcode := service.GetDataPrintByOrgId(orgId)
4053
-	fmt.Println("errcode222234444555556t66", errcode)
4054 4120
 	if errcode == gorm.ErrRecordNotFound {
4055 4121
 		service.CreateDataPrint(&dataPrint)
4056 4122
 		c.ServeSuccessJSON(map[string]interface{}{

+ 0 - 1
controllers/self_drug_api_congtroller.go Целия файл

@@ -3410,7 +3410,6 @@ func (this *SelfDrugApiController) GetDrugNewQuery() {
3410 3410
 	for _, it := range drug {
3411 3411
 		var sum_count int64
3412 3412
 		var limit_count int64
3413
-		fmt.Println("it233323323232323223", it.DrugName)
3414 3413
 		drugInfo, _ := service.GetDrugWarehouseInfoName(it.ID, orgId)
3415 3414
 		for _, item := range drugInfo {
3416 3415
 

+ 117 - 0
controllers/stock_in_api_controller.go Целия файл

@@ -154,6 +154,9 @@ func StockManagerApiRegistRouters() {
154 154
 	beego.Router("/api/settle/stock", &StockManagerApiController{}, "Get:HandleSettleStock")
155 155
 	beego.Router("/api/settle/cancelstock", &StockManagerApiController{}, "Get:HandleRefundStock")
156 156
 
157
+	beego.Router("/api/stock/getnewgoodwarehouseinfo", &StockManagerApiController{}, "Get:GetNewGoodWarehouseInfo")
158
+	beego.Router("/api/stock/getnewwarehouseoutinfolist", &StockManagerApiController{}, "Get:GetNewWarehouseOutInfoList")
159
+
157 160
 }
158 161
 func (c *StockManagerApiController) HandleRefundStock() {
159 162
 	order_id, _ := c.GetInt64("order_id", 0)
@@ -663,6 +666,7 @@ func (c *StockManagerApiController) EditWarehouse() {
663 666
 				manufacturer := int64(items["manufacturer"].(float64))
664 667
 				dealer := int64(items["dealer"].(float64))
665 668
 				license_number, _ := items["license_number"].(string)
669
+				register_number, _ := items["register_number"].(string)
666 670
 				if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
667 671
 					utils.ErrorLog("id")
668 672
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -694,6 +698,7 @@ func (c *StockManagerApiController) EditWarehouse() {
694 698
 						PackingPrice:     packing_price,
695 699
 						StorehouseId:     storehouse_id,
696 700
 						IsCheck:          2,
701
+						RegisterNumber:   register_number,
697 702
 					}
698 703
 					warehousingInfo = append(warehousingInfo, warehouseInfo)
699 704
 
@@ -721,6 +726,7 @@ func (c *StockManagerApiController) EditWarehouse() {
721 726
 						LicenseNumber:    license_number,
722 727
 						PackingPrice:     packing_price,
723 728
 						StorehouseId:     storehouse_id,
729
+						RegisterNumber:   register_number,
724 730
 					}
725 731
 					upDateWarehousingInfo = append(upDateWarehousingInfo, warehouseInfo)
726 732
 
@@ -745,6 +751,7 @@ func (c *StockManagerApiController) EditWarehouse() {
745 751
 						ConsumableType:      1,
746 752
 						WarehousingDetailId: warehouseInfo.ID,
747 753
 						StorehouseId:        storehouse_id,
754
+						RegisterNumber:      register_number,
748 755
 					}
749 756
 
750 757
 					stockFlow = append(stockFlow, flow)
@@ -7801,3 +7808,113 @@ func (this *StockManagerApiController) GetInvetoryWarehouseInfoList() {
7801 7808
 		"dealerList":       dealerList,
7802 7809
 	})
7803 7810
 }
7811
+
7812
+func (this *StockManagerApiController) GetNewGoodWarehouseInfo() {
7813
+
7814
+	timeLayout := "2006-01-02"
7815
+	loc, _ := time.LoadLocation("Local")
7816
+	start_time := this.GetString("start_time")
7817
+	end_time := this.GetString("end_time")
7818
+	var startTime int64
7819
+	if len(start_time) > 0 {
7820
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
7821
+		if err != nil {
7822
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7823
+			return
7824
+		}
7825
+		startTime = theTime.Unix()
7826
+
7827
+	}
7828
+	var endTime int64
7829
+	if len(end_time) > 0 {
7830
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
7831
+		if err != nil {
7832
+			utils.ErrorLog(err.Error())
7833
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7834
+			return
7835
+		}
7836
+		endTime = theTime.Unix()
7837
+	}
7838
+	storehouse_id, _ := this.GetInt64("storehouse_id")
7839
+
7840
+	keywords := this.GetString("keywords")
7841
+
7842
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7843
+
7844
+	var goodids []int64
7845
+	//查询商品名称
7846
+	if len(keywords) > 0 {
7847
+		//查询商品名称
7848
+		list, _ := service.GetGoodInforByGoodName(keywords, orgId)
7849
+		for _, item := range list {
7850
+			goodids = append(goodids, item.ID)
7851
+			//入库详情但里面查询
7852
+		}
7853
+	}
7854
+
7855
+	list, _ := service.GetNewGoodWarehouseInfo(startTime, endTime, orgId, goodids, storehouse_id)
7856
+	manufacturerList, _ := service.GetAllManufacturerList(orgId)
7857
+	dealerList, _ := service.GetAllDealerList(orgId)
7858
+	storeHouseList, _ := service.GetAllStoreHouseList(orgId)
7859
+	this.ServeSuccessJSON(map[string]interface{}{
7860
+		"list":             list,
7861
+		"manufacturerList": manufacturerList,
7862
+		"dealerList":       dealerList,
7863
+		"storeHouseList":   storeHouseList,
7864
+	})
7865
+}
7866
+
7867
+func (this *StockManagerApiController) GetNewWarehouseOutInfoList() {
7868
+
7869
+	timeLayout := "2006-01-02"
7870
+	loc, _ := time.LoadLocation("Local")
7871
+	start_time := this.GetString("start_time")
7872
+	end_time := this.GetString("end_time")
7873
+	var startTime int64
7874
+	if len(start_time) > 0 {
7875
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
7876
+		if err != nil {
7877
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7878
+			return
7879
+		}
7880
+		startTime = theTime.Unix()
7881
+
7882
+	}
7883
+	var endTime int64
7884
+	if len(end_time) > 0 {
7885
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
7886
+		if err != nil {
7887
+			utils.ErrorLog(err.Error())
7888
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7889
+			return
7890
+		}
7891
+		endTime = theTime.Unix()
7892
+	}
7893
+	storehouse_id, _ := this.GetInt64("storehouse_id")
7894
+
7895
+	keywords := this.GetString("keyword")
7896
+
7897
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7898
+	var goodids []int64
7899
+	//查询商品名称
7900
+	if len(keywords) > 0 {
7901
+		//查询商品名称
7902
+		list, _ := service.GetGoodInforByGoodName(keywords, orgId)
7903
+		for _, item := range list {
7904
+			goodids = append(goodids, item.ID)
7905
+			//入库详情但里面查询
7906
+		}
7907
+	}
7908
+
7909
+	list, _ := service.GetNewWarehouseOutInfoList(startTime, endTime, orgId, goodids, storehouse_id)
7910
+
7911
+	manufacturerList, _ := service.GetAllManufacturerList(orgId)
7912
+	dealerList, _ := service.GetAllDealerList(orgId)
7913
+	storeHouseList, _ := service.GetAllStoreHouseList(orgId)
7914
+	this.ServeSuccessJSON(map[string]interface{}{
7915
+		"list":             list,
7916
+		"manufacturerList": manufacturerList,
7917
+		"dealerList":       dealerList,
7918
+		"storeHouseList":   storeHouseList,
7919
+	})
7920
+}

+ 53 - 51
models/stock_models.go Целия файл

@@ -279,26 +279,27 @@ func (WarehouseOutInfo) TableName() string {
279 279
 }
280 280
 
281 281
 type WarehouseOutInfoNight struct {
282
-	ID                      int64   `gorm:"column:id" json:"id"`
283
-	Count                   int64   `gorm:"column:count" json:"count"`
284
-	GoodId                  int64   `gorm:"column:good_id" json:"good_id"`
285
-	SysRecordTime           int64   `gorm:"column:sys_record_time" json:"sys_record_time"`
286
-	PatientId               int64   `gorm:"column:patient_id" json:"patient_id"`
287
-	ProjectId               int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
288
-	WarehouseInfotId        int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id"`
289
-	IsSys                   int64   `gorm:"column:is_sys" json:"is_sys"`
290
-	Status                  int64   `gorm:"column:status" json:"status"`
291
-	OrgId                   int64   `gorm:"column:org_id" json:"org_id"`
292
-	WarehouseOutOrderNumber string  `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
293
-	StorehouseId            int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
294
-	Price                   float64 `gorm:"column:price" json:"price" form:"price"`
295
-	Dealer                  int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
296
-	Manufacturer            int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
297
-	GoodTypeId              int64   `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
298
-	ProductDate             int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
299
-	ExpiryDate              int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
300
-	Number                  string  `gorm:"column:number" json:"number" form:"number"`
301
-	LicenseNumber           string  `gorm:"column:license_number" json:"license_number" form:"license_number"`
282
+	ID                      int64                 `gorm:"column:id" json:"id"`
283
+	Count                   int64                 `gorm:"column:count" json:"count"`
284
+	GoodId                  int64                 `gorm:"column:good_id" json:"good_id"`
285
+	SysRecordTime           int64                 `gorm:"column:sys_record_time" json:"sys_record_time"`
286
+	PatientId               int64                 `gorm:"column:patient_id" json:"patient_id"`
287
+	ProjectId               int64                 `gorm:"column:project_id" json:"project_id" form:"project_id"`
288
+	WarehouseInfotId        int64                 `gorm:"column:warehouse_info_id" json:"warehouse_info_id"`
289
+	IsSys                   int64                 `gorm:"column:is_sys" json:"is_sys"`
290
+	Status                  int64                 `gorm:"column:status" json:"status"`
291
+	OrgId                   int64                 `gorm:"column:org_id" json:"org_id"`
292
+	WarehouseOutOrderNumber string                `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
293
+	StorehouseId            int64                 `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
294
+	Price                   float64               `gorm:"column:price" json:"price" form:"price"`
295
+	Dealer                  int64                 `gorm:"column:dealer" json:"dealer" form:"dealer"`
296
+	Manufacturer            int64                 `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
297
+	GoodTypeId              int64                 `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
298
+	ProductDate             int64                 `gorm:"column:product_date" json:"product_date" form:"product_date"`
299
+	ExpiryDate              int64                 `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
300
+	Number                  string                `gorm:"column:number" json:"number" form:"number"`
301
+	LicenseNumber           string                `gorm:"column:license_number" json:"license_number" form:"license_number"`
302
+	GoodInfo                GoodInformationThirty `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
302 303
 }
303 304
 
304 305
 func (WarehouseOutInfoNight) TableName() string {
@@ -1574,37 +1575,38 @@ func (StartDrugWarehouseInfo) TableName() string {
1574 1575
 }
1575 1576
 
1576 1577
 type GoodWarehousingInfo struct {
1577
-	ID                        int64   `gorm:"column:id" json:"id"`
1578
-	WarehousingId             int64   `gorm:"column:warehousing_id" json:"warehousing_id"`
1579
-	GoodId                    int64   `gorm:"column:good_id" json:"good_id"`
1580
-	GoodTypeId                int64   `gorm:"column:good_type_id" json:"good_type_id"`
1581
-	Number                    string  `gorm:"column:number" json:"number"`
1582
-	ProductDate               int64   `gorm:"column:product_date" json:"product_date"`
1583
-	ExpiryDate                int64   `gorm:"column:expiry_date" json:"expiry_date"`
1584
-	WarehousingCount          int64   `gorm:"column:warehousing_count" json:"warehousing_count"`
1585
-	WarehousingUnit           string  `gorm:"column:warehousing_unit" json:"warehousing_unit"`
1586
-	Price                     float64 `gorm:"column:price" json:"price"`
1587
-	TotalPrice                float64 `gorm:"column:total_price" json:"total_price"`
1588
-	Dealer                    int64   `gorm:"column:dealer" json:"dealer"`
1589
-	Manufacturer              int64   `gorm:"column:manufacturer" json:"manufacturer"`
1590
-	Remark                    string  `gorm:"column:remark" json:"remark"`
1591
-	Ctime                     int64   `gorm:"column:ctime" json:"ctime"`
1592
-	Mtime                     int64   `gorm:"column:mtime" json:"mtime"`
1593
-	Status                    int64   `gorm:"column:status" json:"status"`
1594
-	OrgId                     int64   `gorm:"column:org_id" json:"org_id"`
1595
-	IsReturn                  int64   `gorm:"column:is_return" json:"is_return"`
1596
-	StockCount                int64   `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
1597
-	WarehousingOrder          string  `gorm:"column:warehousing_order" json:"warehousing_order"`
1598
-	Type                      int64   `gorm:"column:type" json:"type"`
1599
-	LicenseNumber             string  `gorm:"column:license_number" json:"license_number" form:"license_number"`
1600
-	WarehouseInfoId           int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
1601
-	PackingPrice              float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
1602
-	SupplyWarehouseId         int64   `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
1603
-	SupplyWarehouseDetailInfo int64   `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`
1604
-	StorehouseId              int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
1605
-	SecondWarehouseInfoId     int64   `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
1606
-	IsCheck                   int64   `gorm:"column:is_check" json:"is_check" form:"is_check"`
1607
-	RegisterNumber            string  `gorm:"column:register_number" json:"register_number" form:"register_number"`
1578
+	ID                        int64                 `gorm:"column:id" json:"id"`
1579
+	WarehousingId             int64                 `gorm:"column:warehousing_id" json:"warehousing_id"`
1580
+	GoodId                    int64                 `gorm:"column:good_id" json:"good_id"`
1581
+	GoodTypeId                int64                 `gorm:"column:good_type_id" json:"good_type_id"`
1582
+	Number                    string                `gorm:"column:number" json:"number"`
1583
+	ProductDate               int64                 `gorm:"column:product_date" json:"product_date"`
1584
+	ExpiryDate                int64                 `gorm:"column:expiry_date" json:"expiry_date"`
1585
+	WarehousingCount          int64                 `gorm:"column:warehousing_count" json:"warehousing_count"`
1586
+	WarehousingUnit           string                `gorm:"column:warehousing_unit" json:"warehousing_unit"`
1587
+	Price                     float64               `gorm:"column:price" json:"price"`
1588
+	TotalPrice                float64               `gorm:"column:total_price" json:"total_price"`
1589
+	Dealer                    int64                 `gorm:"column:dealer" json:"dealer"`
1590
+	Manufacturer              int64                 `gorm:"column:manufacturer" json:"manufacturer"`
1591
+	Remark                    string                `gorm:"column:remark" json:"remark"`
1592
+	Ctime                     int64                 `gorm:"column:ctime" json:"ctime"`
1593
+	Mtime                     int64                 `gorm:"column:mtime" json:"mtime"`
1594
+	Status                    int64                 `gorm:"column:status" json:"status"`
1595
+	OrgId                     int64                 `gorm:"column:org_id" json:"org_id"`
1596
+	IsReturn                  int64                 `gorm:"column:is_return" json:"is_return"`
1597
+	StockCount                int64                 `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
1598
+	WarehousingOrder          string                `gorm:"column:warehousing_order" json:"warehousing_order"`
1599
+	Type                      int64                 `gorm:"column:type" json:"type"`
1600
+	LicenseNumber             string                `gorm:"column:license_number" json:"license_number" form:"license_number"`
1601
+	WarehouseInfoId           int64                 `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
1602
+	PackingPrice              float64               `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
1603
+	SupplyWarehouseId         int64                 `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
1604
+	SupplyWarehouseDetailInfo int64                 `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`
1605
+	StorehouseId              int64                 `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
1606
+	SecondWarehouseInfoId     int64                 `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
1607
+	IsCheck                   int64                 `gorm:"column:is_check" json:"is_check" form:"is_check"`
1608
+	RegisterNumber            string                `gorm:"column:register_number" json:"register_number" form:"register_number"`
1609
+	GoodInfo                  GoodInformationThirty `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
1608 1610
 }
1609 1611
 
1610 1612
 func (GoodWarehousingInfo) TableName() string {

+ 36 - 0
service/doctor_schedule_service.go Целия файл

@@ -588,6 +588,42 @@ func GetAllMobileZone(orgid int64) (zone []*models.DeviceZone, err error) {
588 588
 	return zone, err
589 589
 }
590 590
 
591
+func GetAllMobileZonePb(orgid int64) (zone []*models.DeviceZonePb, err error) {
592
+
593
+	err = XTReadDB().Model(&zone).Preload("DeviceNumber", "status =1").Where("org_id = ? and status = 1", orgid).Find(&zone).Error
594
+	return zone, err
595
+}
596
+
597
+func GetPatientScheduleByPd(schedule_date int64, zoneid int64, orgid int64, class_type int64) (list []*models.DeviceZonePb, err error) {
598
+
599
+	db := XTReadDB().Table("xt_device_zone as x").Where("x.status = 1")
600
+	if zoneid > 0 {
601
+		db = db.Where("x.id = ?", zoneid)
602
+	}
603
+	if orgid > 0 {
604
+		db = db.Where("x.org_id = ?", orgid)
605
+	}
606
+	if class_type > 0 {
607
+		err = db.Select("x.id,x.org_id,x.name,x.type,x.sort").Preload("DeviceNumber", func(db *gorm.DB) *gorm.DB {
608
+			return XTReadDB().Model(&models.DeviceNumber{}).Where("status = 1").Preload("Schedule", func(db *gorm.DB) *gorm.DB {
609
+				return XTReadDB().Model(&models.BlodSchedule{}).Where("status = 1 AND user_org_id = ? and schedule_date = ? and schedule_type = ?", orgid, schedule_date, class_type).Preload("VmBloodPatients", "status = 1 and user_org_id = ?", orgid).Preload("BloodDialysisOrder", "status = 1 and dialysis_date = ?", schedule_date).Preload("BloodDialysisPrescription", "status = 1 and record_date = ?", schedule_date).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
610
+					return db.Where("user_org_id = ? and status = 1", orgid).Group("patient_id,mode_id").Order("created_time asc")
611
+				})
612
+			})
613
+		}).Find(&list).Error
614
+	} else {
615
+		err = db.Select("x.id,x.org_id,x.name,x.type,x.sort").Preload("DeviceNumber", func(db *gorm.DB) *gorm.DB {
616
+			return XTReadDB().Model(&models.DeviceNumber{}).Where("status = 1").Preload("Schedule", func(db *gorm.DB) *gorm.DB {
617
+				return XTReadDB().Model(&models.BlodSchedule{}).Where("status = 1 AND user_org_id = ? and schedule_date = ?", orgid, schedule_date).Preload("VmBloodPatients", "status = 1 and user_org_id = ?", orgid).Preload("BloodDialysisOrder", "status = 1 and dialysis_date = ?", schedule_date).Preload("BloodDialysisPrescription", "status = 1 and record_date = ?", schedule_date).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
618
+					return db.Where("user_org_id = ? and status = 1", orgid).Group("patient_id,mode_id").Order("created_time asc")
619
+				})
620
+			})
621
+		}).Find(&list).Error
622
+	}
623
+
624
+	return list, err
625
+}
626
+
591 627
 func GetPatientSchedule(startime int64, zoneid int64, classtype int64, orgid int64) (schedule []*models.ScheduleTwenty, err error) {
592 628
 
593 629
 	db := XTReadDB().Table("xt_schedule as s")

+ 11 - 6
service/manage_center_service.go Целия файл

@@ -461,9 +461,15 @@ func DrugAutoAddCancelInfo(advice *models.HisDoctorAdviceInfo, creater int64) er
461 461
 			var sum_count int64  //该批次总库存
462 462
 			var over_count int64 //剩余数量
463 463
 
464
-			over_count = druginfo.StockMaxNumber*drug.MinNumber + druginfo.StockMinNumber
464
+			if druginfo.MaxUnit != druginfo.MinUnit {
465
+				over_count = druginfo.StockMaxNumber*drug.MinNumber + druginfo.StockMinNumber
466
+			}
467
+			if druginfo.MaxUnit == druginfo.MinUnit {
468
+				over_count = druginfo.StockMaxNumber + druginfo.StockMinNumber
469
+			}
470
+
465 471
 			if infos.CountUnit == drug.MaxUnit && drug.MaxUnit != drug.MinUnit {
466
-				out_count = info.Count * drug.MinNumber
472
+				out_count = infos.Count * drug.MinNumber
467 473
 
468 474
 			}
469 475
 			if infos.CountUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
@@ -491,7 +497,7 @@ func DrugAutoAddCancelInfo(advice *models.HisDoctorAdviceInfo, creater int64) er
491 497
 			fmt.Println("g该批次总库存wowowoowow", sum_count)
492 498
 			if (over_count + out_count) <= sum_count {
493 499
 				if its.CountUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
494
-
500
+					fmt.Print("itscoutn233232223999wi", its.Count)
495 501
 					//退库
496 502
 					warehouseInfo := models.DrugWarehouseInfo{
497 503
 						StockMinNumber: its.Count,
@@ -505,7 +511,7 @@ func DrugAutoAddCancelInfo(advice *models.HisDoctorAdviceInfo, creater int64) er
505 511
 
506 512
 				}
507 513
 				if its.CountUnit == drug.MaxUnit && drug.MaxUnit != drug.MinUnit {
508
-
514
+					fmt.Print("itscoutn999888", its.Count)
509 515
 					warehouseInfo := models.DrugWarehouseInfo{
510 516
 						StockMaxNumber: its.Count,
511 517
 					}
@@ -518,7 +524,7 @@ func DrugAutoAddCancelInfo(advice *models.HisDoctorAdviceInfo, creater int64) er
518 524
 				}
519 525
 
520 526
 				if its.CountUnit == drug.MaxUnit && drug.MaxUnit == drug.MinUnit {
521
-
527
+					fmt.Print("itscoutnwohhhhwhw", its.Count)
522 528
 					warehouseInfo := models.DrugWarehouseInfo{
523 529
 						StockMaxNumber: its.Count,
524 530
 					}
@@ -906,7 +912,6 @@ func DrugAutoAddCancelInfo(advice *models.HisDoctorAdviceInfo, creater int64) er
906 912
 
907 913
 func GoodAutoAddCancelInfo(good *models.NewDialysisBeforePrepareGoods, creater int64) error {
908 914
 
909
-	fmt.Print("order_id223233232323223323223wo", good.OrderId)
910 915
 	//查询已经出库数量
911 916
 	info, _ := GetWareOutInfo(good.GoodId, good.RecordDate, good.UserOrgId, good.PatientId, good.OrderId)
912 917
 	if len(info) > 0 {

+ 111 - 39
service/new_warehouse_service.go Целия файл

@@ -1848,6 +1848,9 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1848 1848
 			AddDrugCount(advice.DrugId, orgID, storeConfig.DrugStorehouseOut, drugflow.Count)
1849 1849
 		}
1850 1850
 
1851
+		fmt.Println("libai", out_count)
1852
+		fmt.Println("cancel", cancel_count)
1853
+		fmt.Println("deliver_number", deliver_number)
1851 1854
 		if deliver_number < (out_count - cancel_count) {
1852 1855
 			operation_time := time.Now().Unix()
1853 1856
 
@@ -2002,7 +2005,7 @@ func GetSigleDrugWarehouseOutInfoOne(patient_id int64, advice_date int64, orgid
2002 2005
 
2003 2006
 func UpdateSingleDrugWarehouseOutInfoSix(patient_id int64, advice_date int64, orgid int64, info *models.DrugWarehouseOutInfo, advice_id int64) error {
2004 2007
 
2005
-	err := XTWriteDB().Model(&models.XtDrugWarehouseOutInfo{}).Where("patient_id = ? and sys_record_time = ? and org_id = ? and advice_id = ?", patient_id, advice_date, orgid, advice_id).Update(map[string]interface{}{"count": info.Count, "price": info.Price, "total_price": info.TotalPrice, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "remark": info.Remark, "dealer": info.Dealer, "manufacturer": info.Manufacturer, "retail_price": info.RetailPrice, "number": info.Number, "batch_number": info.BatchNumber, "count_unit": info.CountUnit, "warehouse_info_id": info.WarehouseInfoId, "storehouse_id": info.StorehouseId}).Error
2008
+	err := XTWriteDB().Model(&models.XtDrugWarehouseOutInfo{}).Where("patient_id = ? and sys_record_time = ? and org_id = ? and advice_id = ? and status= 1", patient_id, advice_date, orgid, advice_id).Update(map[string]interface{}{"count": info.Count, "price": info.Price, "total_price": info.TotalPrice, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "remark": info.Remark, "dealer": info.Dealer, "manufacturer": info.Manufacturer, "retail_price": info.RetailPrice, "number": info.Number, "batch_number": info.BatchNumber, "count_unit": info.CountUnit, "warehouse_info_id": info.WarehouseInfoId, "storehouse_id": info.StorehouseId}).Error
2006 2009
 	return err
2007 2010
 }
2008 2011
 
@@ -2083,7 +2086,7 @@ func FindDrugCancelStock(return_date int64, org_id int64) (*models.DrugCancelSto
2083 2086
 
2084 2087
 	stock := models.DrugCancelStock{}
2085 2088
 	var err error
2086
-	err = XTReadDB().Where("return_date = ? and org_id = ? and status = 1", return_date, org_id).Find(&stock).Error
2089
+	err = XTReadDB().Where("return_time = ? and org_id = ? and status = 1", return_date, org_id).Find(&stock).Error
2087 2090
 	if err == gorm.ErrRecordNotFound {
2088 2091
 		return nil, err
2089 2092
 	}
@@ -2096,7 +2099,7 @@ func FindDrugCancelStock(return_date int64, org_id int64) (*models.DrugCancelSto
2096 2099
 func FindLastDrugCancelStock(advice_date int64, org_id int64) (models.DrugCancelStock, error) {
2097 2100
 
2098 2101
 	cancelStock := models.DrugCancelStock{}
2099
-	err := XTReadDB().Where("return_date = ? and org_id = ? and status = 1", advice_date, org_id).Find(&cancelStock).Error
2102
+	err := XTReadDB().Where("return_time = ? and org_id = ? and status = 1", advice_date, org_id).Find(&cancelStock).Error
2100 2103
 	return cancelStock, err
2101 2104
 }
2102 2105
 
@@ -2127,15 +2130,19 @@ func UpdateHisPrescriptionProjectStatus(project_id int64, record_time int64, use
2127 2130
 }
2128 2131
 
2129 2132
 // 药品自动出库 递归方式
2130
-func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.HisDoctorAdviceInfo) (err error) {
2133
+func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.HisDoctorAdviceInfo, prescribingCount float64) (err error) {
2131 2134
 
2132 2135
 	// 判断处方里药品单位是拆零单位还是包装单位,	如果是包装单位,则根据规格,将包装数量转为拆零数量
2133 2136
 	var deliver_number int64 = 0
2137
+	var deliver_number_one int64 = 0
2134 2138
 	var stock_number int64 = 0
2135 2139
 
2136 2140
 	prescribingNumber_temp := strconv.FormatFloat(math.Abs(prescribingNumber), 'f', 0, 64)
2137 2141
 	count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
2138 2142
 
2143
+	prescribingCount_temp := strconv.FormatFloat(math.Abs(prescribingCount), 'f', 0, 64)
2144
+	prescribe_count, _ := strconv.ParseInt(prescribingCount_temp, 10, 64)
2145
+
2139 2146
 	var drug_price float64
2140 2147
 	if advice.PrescribingNumberUnit == drup.MaxUnit {
2141 2148
 		deliver_number = count * drup.MinNumber
@@ -2145,6 +2152,14 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2145 2152
 
2146 2153
 	}
2147 2154
 
2155
+	if advice.PrescribingNumberUnit == drup.MaxUnit {
2156
+		deliver_number_one = prescribe_count * drup.MinNumber
2157
+
2158
+	} else {
2159
+		deliver_number_one = prescribe_count
2160
+
2161
+	}
2162
+
2148 2163
 	if advice.PrescribingNumberUnit == drup.MaxUnit {
2149 2164
 		drug_price = drup.RetailPrice
2150 2165
 	}
@@ -2162,7 +2177,8 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2162 2177
 	// 如果没有对应的库存,则报错
2163 2178
 	storeConfig, _ := GetAllStoreHouseConfig(advice.UserOrgId)
2164 2179
 	lastWarehouse, _ := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
2165
-	if lastWarehouse.StockMinNumber >= drup.MinNumber {
2180
+
2181
+	if lastWarehouse.StockMinNumber >= drup.MinNumber && lastWarehouse.MaxUnit != lastWarehouse.MinUnit {
2166 2182
 		var stockMax int64
2167 2183
 		var stockMin int64
2168 2184
 		stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
@@ -2174,7 +2190,6 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2174 2190
 	warehouse, err := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
2175 2191
 
2176 2192
 	if err != nil {
2177
-
2178 2193
 		return err
2179 2194
 	}
2180 2195
 	// 将该批次的剩余库存数量转换为拆零数量
@@ -2196,8 +2211,8 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2196 2211
 	}
2197 2212
 
2198 2213
 	// 当库存数量大于或等于出库数量的话,则正常出库该批次
2199
-	fmt.Println("stock_nbumber3223323232", stock_number)
2200
-	fmt.Println("deliver_number", deliver_number)
2214
+	fmt.Println("剩余库存2332233223232323", stock_number)
2215
+	fmt.Println("出库数量233232332323232", deliver_number)
2201 2216
 	if stock_number >= deliver_number {
2202 2217
 
2203 2218
 		var maxNumber int64 = 0
@@ -2235,41 +2250,83 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2235 2250
 
2236 2251
 		warehouse.Mtime = time.Now().Unix()
2237 2252
 
2238
-		fmt.Println("minnU目标而332322323323233223323223我", minNumber)
2239
-		fmt.Println("max_number232232332232322wo", maxNumber)
2240
-		fmt.Println(" warehouse.StockMinNumber", warehouse.StockMinNumber)
2253
+		//fmt.Println("minnU目标而332322323323233223323223我", minNumber)
2254
+		//fmt.Println("max_number232232332232322wo", maxNumber)
2255
+		//fmt.Println(" warehouse.StockMinNumber", warehouse.StockMinNumber)
2241 2256
 
2242
-		if warehouse.StockMinNumber < minNumber {
2257
+		if warehouse.MaxUnit != warehouse.MinUnit {
2258
+			if warehouse.StockMinNumber < minNumber {
2243 2259
 
2244
-			warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
2245
-			if warehouse.MaxUnit != warehouse.MinUnit {
2246
-				warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
2247
-			}
2248
-		} else {
2249
-			if minNumber > 0 {
2250
-				if (warehouse.StockMinNumber - minNumber) >= 0 {
2251
-					warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
2260
+				warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
2261
+				if warehouse.MaxUnit != warehouse.MinUnit {
2262
+					warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
2252 2263
 				}
2264
+			} else {
2265
+				if minNumber > 0 {
2266
+					if (warehouse.StockMinNumber - minNumber) >= 0 {
2267
+						warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
2268
+					}
2253 2269
 
2254
-			}
2270
+				}
2255 2271
 
2256
-			if minNumber == 0 && maxNumber != 1 && warehouse.StockMaxNumber <= 0 {
2257
-				if warehouse.StockMinNumber > 0 {
2258
-					if warehouse.StockMinNumber-deliver_number >= 0 {
2272
+				if minNumber == 0 && maxNumber != 1 && warehouse.StockMaxNumber <= 0 {
2273
+					if warehouse.StockMinNumber > 0 {
2274
+						if warehouse.StockMinNumber-deliver_number >= 0 {
2275
+							warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
2276
+						}
2277
+
2278
+					}
2279
+
2280
+				}
2281
+
2282
+				if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
2283
+					if (warehouse.StockMinNumber - deliver_number) >= 0 {
2259 2284
 						warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
2260 2285
 					}
2261 2286
 
2262 2287
 				}
2263 2288
 
2264 2289
 			}
2265
-
2266 2290
 		}
2267 2291
 
2268
-		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
2269
-			if (warehouse.StockMinNumber - deliver_number) >= 0 {
2270
-				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
2292
+		if warehouse.MinUnit == warehouse.MaxUnit {
2293
+			//fmt.Println("minNUMBER233223233223322323",minNumber)
2294
+			//fmt.Println("warehouse.StockMinNumber",warehouse.StockMinNumber)
2295
+			//fmt.Println("warehouse.StockMaxNumber",warehouse.StockMaxNumber)
2296
+			if warehouse.StockMaxNumber > 0 && warehouse.StockMinNumber == 0 && warehouse.StockMaxNumber >= minNumber {
2297
+				warehouse.StockMaxNumber = warehouse.StockMaxNumber - minNumber
2298
+
2271 2299
 			}
2272 2300
 
2301
+			if warehouse.StockMaxNumber == 0 && warehouse.StockMinNumber > 0 && warehouse.StockMinNumber >= minNumber {
2302
+				warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
2303
+			}
2304
+
2305
+			if warehouse.StockMaxNumber > 0 && warehouse.StockMinNumber > 0 && (warehouse.StockMaxNumber+warehouse.StockMinNumber) > minNumber {
2306
+
2307
+				var out_false int64 = 0
2308
+				if warehouse.StockMinNumber >= minNumber {
2309
+					warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
2310
+					out_false = 1
2311
+				}
2312
+				fmt.Println("out_false233223233223wo", out_false)
2313
+				if warehouse.StockMinNumber < minNumber && out_false == 0 {
2314
+
2315
+					var over_total int64
2316
+					over_total = warehouse.StockMinNumber
2317
+					warehouse.StockMinNumber = 0
2318
+					warehouse.StockMaxNumber = warehouse.StockMaxNumber - (minNumber - over_total)
2319
+				}
2320
+			}
2321
+
2322
+			//if warehouse.StockMaxNumber < minNumber && warehouse.StockMaxNumber < minNumber && (warehouse.StockMaxNumber + warehouse.StockMinNumber) > minNumber {
2323
+			//  var over_count int64
2324
+			//  over_count = warehouse.StockMinNumber
2325
+			//  warehouse.StockMinNumber = 0
2326
+			//  warehouse.StockMaxNumber = warehouse.StockMaxNumber - (minNumber -over_count)
2327
+			//
2328
+			//}
2329
+
2273 2330
 		}
2274 2331
 
2275 2332
 		if drup.MaxUnit != drup.MinUnit {
@@ -2330,7 +2387,7 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2330 2387
 
2331 2388
 		//查询今日该药品该患者是否有出库数据
2332 2389
 		lastDrugOutInfo, _ := GetNewDrugWarehouseOutInfoSix(advice.DrugId, advice.PatientId, advice.RecordDate, advice.UserOrgId, advice.ID, warehouse.ID)
2333
-
2390
+		fmt.Println("lastDrugOutInfo0000000293293292392392393293239239", lastDrugOutInfo)
2334 2391
 		if lastDrugOutInfo.ID == 0 {
2335 2392
 			errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
2336 2393
 			if errOne != nil {
@@ -2345,7 +2402,10 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2345 2402
 			if lastDrugOutInfo.CountUnit == drup.MinUnit {
2346 2403
 				his_count = lastDrugOutInfo.Count
2347 2404
 			}
2405
+			fmt.Println("deliver_numberwode8888888823832832832832832832823823-------------------------", deliver_number)
2406
+			fmt.Println("his_countnide-------------------------------------------------------", his_count)
2348 2407
 			if deliver_number != his_count {
2408
+				//warehouseOutInfo.Count = deliver_number_one
2349 2409
 				errThree := UpdateSigleDrugWarehouseOutInfo(lastDrugOutInfo.ID, warehouseOutInfo)
2350 2410
 				if errThree != nil {
2351 2411
 					return errThree
@@ -2367,11 +2427,11 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2367 2427
 			cancel_count += item.Count
2368 2428
 		}
2369 2429
 
2370
-		fmt.Println("deliver_number", deliver_number)
2430
+		fmt.Println("deliver_number_one", deliver_number)
2371 2431
 		fmt.Println("out_count", out_count)
2372 2432
 		fmt.Println("cancel_count", cancel_count)
2373 2433
 		//如果本次出库数据大于历史出库数据 新增1条流水
2374
-		if deliver_number > (out_count - cancel_count) {
2434
+		if deliver_number_one > (out_count - cancel_count) {
2375 2435
 			drugflow := models.DrugFlow{
2376 2436
 				WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
2377 2437
 				WarehouseOutId:          warehouseout.ID,
@@ -2379,7 +2439,7 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2379 2439
 				Number:                  warehouse.Number,
2380 2440
 				ProductDate:             warehouse.ProductDate,
2381 2441
 				ExpireDate:              warehouse.ExpiryDate,
2382
-				Count:                   deliver_number - (out_count - cancel_count), //按最小单位计算,
2442
+				Count:                   deliver_number_one - (out_count - cancel_count), //按最小单位计算,
2383 2443
 				Price:                   warehouse.RetailPrice,
2384 2444
 				Status:                  1,
2385 2445
 				Ctime:                   time.Now().Unix(),
@@ -2450,7 +2510,7 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2450 2510
 		}
2451 2511
 
2452 2512
 		//如果本次出库数据小于历史出库数据 新增1条退库流水
2453
-		if deliver_number < (out_count - cancel_count) {
2513
+		if deliver_number_one < (out_count - cancel_count) {
2454 2514
 
2455 2515
 			operation_time := time.Now().Unix()
2456 2516
 
@@ -2484,9 +2544,9 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2484 2544
 
2485 2545
 			manufactureName, _ := GetManufactureById(warehouse.Manufacturer)
2486 2546
 			dealer, _ := GetDealerById(warehouse.Dealer)
2487
-			cancelInfo, _ := GetLastDrugCancelStockById(advice.UserOrgId)
2547
+			//cancelInfo, _ := GetLastDrugCancelStockById(advice.UserOrgId)
2488 2548
 			cancelStockInfo := models.DrugCancelStockInfo{
2489
-				OrderNumber:      cancelInfo.OrderNumber,
2549
+				OrderNumber:      lastDrugCancelStock.OrderNumber,
2490 2550
 				CancelStockId:    lastDrugCancelStock.ID,
2491 2551
 				DrugId:           advice.DrugId,
2492 2552
 				Count:            (out_count - cancel_count) - deliver_number,
@@ -2658,17 +2718,21 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2658 2718
 			OrderId:                 warehouseout.OrderId,
2659 2719
 		}
2660 2720
 		//查询是否存在出库数据
2661
-		_, errCode := GetSigleDrugWarehouseOutInfo(advice.PatientId, advice.AdviceDate, orgID)
2662
-		if errCode == gorm.ErrRecordNotFound {
2721
+
2722
+		lastDrugOutInfoTwo, _ := GetNewDrugWarehouseOutInfoSix(advice.DrugId, advice.PatientId, advice.RecordDate, advice.UserOrgId, advice.ID, warehouse.ID)
2723
+		//_, errCode := GetSigleDrugWarehouseOutInfo(advice.PatientId, advice.AdviceDate, orgID)
2724
+		//fmt.Println("errcoedee232233223233232323232323233223232323322323232323232323",errCode)
2725
+		if lastDrugOutInfoTwo.ID == 0 {
2663 2726
 
2664 2727
 			errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
2665 2728
 			if errOne != nil {
2666 2729
 				return errOne
2667 2730
 			}
2668 2731
 		}
2669
-		if errCode == nil {
2732
+		if lastDrugOutInfoTwo.ID > 0 {
2670 2733
 
2671 2734
 			lastDrugOutInfo, _ := GetSigleDrugWarehouseOutInfoOne(advice.PatientId, advice.AdviceDate, orgID)
2735
+			fmt.Println("中国人民肌肤32323223332332232322323喔", lastDrugOutInfo)
2672 2736
 			var his_count int64
2673 2737
 			if lastDrugOutInfo.CountUnit == drup.MaxUnit {
2674 2738
 				his_count = lastDrugOutInfo.Count * drup.MinNumber
@@ -2676,7 +2740,10 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2676 2740
 			if lastDrugOutInfo.CountUnit == drup.MinUnit {
2677 2741
 				his_count = lastDrugOutInfo.Count
2678 2742
 			}
2743
+			fmt.Println("deliver_number3232323232wowooww", deliver_number)
2744
+			fmt.Println("his_count99999992i2222wo", his_count)
2679 2745
 			if deliver_number != his_count {
2746
+
2680 2747
 				errThree := UpdateSingleDrugWarehouseOutInfoSix(advice.PatientId, advice.AdviceDate, orgID, warehouseOutInfo, advice.ID)
2681 2748
 				if errThree != nil {
2682 2749
 					return errThree
@@ -2727,6 +2794,9 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2727 2794
 			cancel_count += item.Count
2728 2795
 		}
2729 2796
 
2797
+		fmt.Println("出库数量", deliver_number)
2798
+		fmt.Println("out_coutn233232322323wo", cancel_count)
2799
+		fmt.Println("out_count99988233232", out_count)
2730 2800
 		//如果本次出库数据大于历史出库数据 新增1条流水
2731 2801
 		if deliver_number > (out_count - cancel_count) {
2732 2802
 
@@ -2768,6 +2838,7 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2768 2838
 		}
2769 2839
 
2770 2840
 		if deliver_number < (out_count - cancel_count) {
2841
+			fmt.Println("即那里3232232323")
2771 2842
 			operation_time := time.Now().Unix()
2772 2843
 
2773 2844
 			ctime := time.Now().Unix()
@@ -2880,8 +2951,9 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
2880 2951
 
2881 2952
 		advice.PrescribingNumber = float64(prescribingNumber_two_temp)
2882 2953
 		advice.PrescribingNumberUnit = drup.MinUnit
2954
+		fmt.Println("剩余库存9999999233232", overPlusNumber)
2883 2955
 
2884
-		HisSettleDrugDeliverInfo(orgID, overPlusNumber, warehouseout, drup, advice)
2956
+		HisSettleDrugDeliverInfo(orgID, overPlusNumber, warehouseout, drup, advice, prescribingCount)
2885 2957
 	}
2886 2958
 
2887 2959
 	return

+ 9 - 1
service/patient_service.go Целия файл

@@ -66,9 +66,17 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
66 66
 	}
67 67
 
68 68
 	offset := (page - 1) * limit
69
+	if lapseto == 2 || lapseto == 3 {
70
+		err = db.Order("p.death_time desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
71
+
72
+	}
73
+	if lapseto != 2 && lapseto != 3 {
74
+		err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
75
+
76
+	}
69 77
 
70
-	err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
71 78
 	return
79
+
72 80
 }
73 81
 
74 82
 //GetAllPatientList 返回全部患者的列表

+ 33 - 0
service/patientmanage_service.go Целия файл

@@ -1879,3 +1879,36 @@ func DeleteHospitalSummary(id []string) error {
1879 1879
 	err := XTWriteDB().Model(models.XtHospitalSummary{}).Where("id in (?) and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
1880 1880
 	return err
1881 1881
 }
1882
+
1883
+func GetAllPatientScheduleList(org_id int64) (patient []*models.PatientsThirty, err error) {
1884
+
1885
+	err = XTReadDB().Where("user_org_id = ? and status = 1", org_id).Find(&patient).Error
1886
+
1887
+	return patient, err
1888
+}
1889
+
1890
+func GetAllDialysiOrderList(patient_id int64, org_id int64) (order []*models.DialysisOrder, err error) {
1891
+
1892
+	err = XTReadDB().Where("patient_id = ? and user_org_id = ? and status= 1 and dialysis_date<=1672416000", patient_id, org_id).Find(&order).Error
1893
+
1894
+	return order, err
1895
+}
1896
+
1897
+func GetDialysisTotalCountThree(org_id int64, patient_id int64, dialysis_date int64) (models.BloodDialysisOrderCount, error) {
1898
+
1899
+	order := models.BloodDialysisOrderCount{}
1900
+	db := XTReadDB().Table("xt_dialysis_order as o")
1901
+
1902
+	err = db.Raw("select count(o.id) as count,o.patient_id from xt_dialysis_order as o left join xt_schedule as x on x.patient_id = o.patient_id where o.status =1 and o.user_org_id = ? and o.patient_id = ? and o.dialysis_date<=? and  x.schedule_date = o.dialysis_date and x.status = 1 ", org_id, patient_id, dialysis_date).Scan(&order).Error
1903
+
1904
+	return order, err
1905
+}
1906
+
1907
+func UpdateDialysisOrderSix(patient_id int64, dialysis_date int64, user_org_id int64, dialysis_total int64) (models.DialysisOrder, error) {
1908
+
1909
+	order := models.DialysisOrder{}
1910
+
1911
+	err := XTWriteDB().Model(&order).Where("patient_id = ? and dialysis_date = ? and user_org_id = ? and status = 1", patient_id, dialysis_date, user_org_id).Updates(map[string]interface{}{"dialysis_total": dialysis_total}).Error
1912
+
1913
+	return order, err
1914
+}

+ 22 - 1
service/schedule_service.go Целия файл

@@ -114,7 +114,6 @@ func GetWeekScheduleOne(orgID int64, start, end int64, partionid int64, schedule
114 114
 func GetWeekScheduleTwo(orgID int64, start, end int64, schIds []string, scheduletype int64) (schedules []*models.Schedule, err error) {
115 115
 
116 116
 	db := readDb.Table("xt_schedule as s")
117
-	fmt.Println("schIds2222222")
118 117
 	if len(schIds) > 0 {
119 118
 		db = db.Where("s.partition_id in (?)", schIds)
120 119
 	}
@@ -130,6 +129,28 @@ func GetWeekScheduleTwo(orgID int64, start, end int64, schIds []string, schedule
130 129
 	return
131 130
 }
132 131
 
132
+func GetWeekScheduleThree(orgID int64, start, end int64, schIds []string, scheduletype int64, WeekDayIds []string) (schedules []*models.Schedule, err error) {
133
+
134
+	db := readDb.Table("xt_schedule as s")
135
+
136
+	if len(schIds) > 0 {
137
+		db = db.Where("s.partition_id in (?)", schIds)
138
+	}
139
+	if scheduletype > 0 {
140
+		db = db.Where("s.schedule_type = ?", scheduletype)
141
+	}
142
+	if len(WeekDayIds) > 0 {
143
+		db = db.Where("s.schedule_week in(?)", WeekDayIds)
144
+	}
145
+	err = db.Preload("PatientInfectiousDiseases", "status = 1 ").
146
+		Joins("JOIN xt_patients as p ON p.id = s.patient_id").
147
+		Where("s.user_org_id=? and s.schedule_date>=? and s.schedule_date<=? and s.status=1", orgID, start, end).
148
+		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time,s.dialysis_machine_name, p.name as patient").
149
+		Order("updated_time asc").
150
+		Find(&schedules).Error
151
+	return
152
+}
153
+
133 154
 func GetDaySchedule(orgID, start, end, patientID int64) (schedule models.Schedule, err error) {
134 155
 	err = readDb.Model(&models.Schedule{}).Where("user_org_id=? and patient_id=? and schedule_date>=? and schedule_date<=? and status=1", orgID, patientID, start, end).First(&schedule).Error
135 156
 	return

+ 47 - 0
service/stock_service.go Целия файл

@@ -8380,3 +8380,50 @@ func GetWarehouseOutInfoIsExistSix(good_id int64, patient_id int64, record_time
8380 8380
 	}
8381 8381
 	return &info, nil
8382 8382
 }
8383
+
8384
+func GetNewGoodWarehouseInfo(startime int64, endtime int64, orgid int64, good_id []int64, storehouse_id int64) (info []*models.GoodWarehousingInfo, err error) {
8385
+
8386
+	db := XTReadDB().Model(&info).Where("status = 1")
8387
+
8388
+	if startime > 0 {
8389
+		db = db.Where("ctime>=?", startime)
8390
+	}
8391
+	if endtime > 0 {
8392
+		db = db.Where("ctime<=?", endtime)
8393
+	}
8394
+	if orgid > 0 {
8395
+		db = db.Where("org_id = ?", orgid)
8396
+	}
8397
+	if len(good_id) > 0 {
8398
+		db = db.Where("good_id in(?)", good_id)
8399
+	}
8400
+	if storehouse_id > 0 {
8401
+		db = db.Where("storehouse_id = ?", storehouse_id)
8402
+	}
8403
+	err = db.Preload("GoodInfo", "org_id = ? and status= 1", orgid).Find(&info).Error
8404
+	return info, err
8405
+}
8406
+
8407
+func GetNewWarehouseOutInfoList(start_time int64, end_time int64, orgid int64, good_id []int64, storehouse_id int64) (info []*models.WarehouseOutInfoNight, err error) {
8408
+
8409
+	db := XTReadDB().Model(&info).Where("status= 1")
8410
+
8411
+	if start_time > 0 {
8412
+		db = db.Where("ctime>=?", start_time)
8413
+	}
8414
+	if end_time > 0 {
8415
+		db = db.Where("ctime <=?", end_time)
8416
+	}
8417
+
8418
+	if orgid > 0 {
8419
+		db = db.Where("org_id = ?", orgid)
8420
+	}
8421
+	if len(good_id) > 0 {
8422
+		db = db.Where("good_id in(?)", good_id)
8423
+	}
8424
+	if storehouse_id > 0 {
8425
+		db = db.Where("storehouse_id = ?", storehouse_id)
8426
+	}
8427
+	err = db.Preload("GoodInfo", "org_id = ? and status = 1", orgid).Find(&info).Error
8428
+	return info, err
8429
+}

+ 1 - 1
service/warhouse_service.go Целия файл

@@ -12219,7 +12219,7 @@ func HisSettleDrugsDelivery(orgID int64, creater int64, advice *models.HisDoctor
12219 12219
 		if drup.ID > 0 {
12220 12220
 			prescribingNumber := advice.PrescribingNumber
12221 12221
 
12222
-			HisSettleDrugDeliverInfo(orgID, prescribingNumber, &out, &drup, advice)
12222
+			HisSettleDrugDeliverInfo(orgID, prescribingNumber, &out, &drup, advice, prescribingNumber)
12223 12223
 
12224 12224
 		} else {
12225 12225
 			return errors.New("药品信息不存在")