瀏覽代碼

11月8日库存管理

XMLWAN 3 年之前
父節點
當前提交
8475a97ed9

+ 4 - 4
controllers/print_data_api_controller.go 查看文件

43
 			item.Count = list.Count
43
 			item.Count = list.Count
44
 		}
44
 		}
45
 		if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 {
45
 		if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 {
46
-			dialysis_count, _ := service.GetDialysisOrderCountOne(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
47
-			fmt.Println("dialysis_count322333223322323", dialysis_count)
48
-			item.Patient.TotalDialysis = dialysis_count
49
-			item.Count = dialysis_count
46
+			listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
47
+			fmt.Println("lisntONE2323223323232", listOne.Count)
48
+			item.Patient.TotalDialysis = listOne.Count
49
+			item.Count = listOne.Count
50
 		}
50
 		}
51
 	}
51
 	}
52
 	if getScheduleErr != nil {
52
 	if getScheduleErr != nil {

+ 10 - 3
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go 查看文件

216
 //	return
216
 //	return
217
 //}
217
 //}
218
 
218
 
219
-func GetDialysisOrderCountOne(orgID int64, patient_id int64, recordDate int64) (count int64, err error) {
220
-	err = p_service.XTReadDB().Model(&models.DialysisOrder{}).Where("dialysis_date >=1640966400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND user_org_id = ? AND patient_id = ?", recordDate, orgID, patient_id).Count(&count).Error
221
-	return
219
+//func GetDialysisOrderCountOne(orgID int64, patient_id int64, recordDate int64) (count int64, err error) {
220
+//	err = p_service.XTReadDB().Model(&models.DialysisOrder{}).Where("dialysis_date >=1640966400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND user_org_id = ? AND patient_id = ?", recordDate, orgID, patient_id).Count(&count).Error
221
+//	return
222
+//}
223
+
224
+func GetDialysisOrderCountEight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
225
+	order := models.VmDialysisOrder{}
226
+	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1640966400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
227
+	return order, err
222
 }
228
 }
229
+
223
 func GetOutStockTotalCountTwo(startime int64, endtime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
230
 func GetOutStockTotalCountTwo(startime int64, endtime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
224
 
231
 
225
 	err = p_service.XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.record_time,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >= ? and x.record_time<=? and `status` = 1)  as b GROUP BY good_id", orgid, startime, endtime).Scan(&autoMatic).Error
232
 	err = p_service.XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.record_time,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >= ? and x.record_time<=? and `status` = 1)  as b GROUP BY good_id", orgid, startime, endtime).Scan(&autoMatic).Error