소스 검색

11月9日库存管理

XMLWAN 1 년 전
부모
커밋
7098c9e6b9
2개의 변경된 파일20개의 추가작업 그리고 4개의 파일을 삭제
  1. 13 3
      controllers/print_data_api_controller.go
  2. 7 1
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go

+ 13 - 3
controllers/print_data_api_controller.go 파일 보기

@@ -85,10 +85,20 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
85 85
 				item.Count = list.Count
86 86
 			}
87 87
 			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 {
88
-				listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
88
+				if item.ScheduleDate <= 1640966400 {
89
+					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
90
+
91
+					item.Patient.TotalDialysis = listOne.Count
92
+					item.Count = listOne.Count
93
+				}
94
+
95
+				if item.ScheduleDate >= 1672502400 {
96
+					listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
97
+
98
+					item.Patient.TotalDialysis = listOne.Count
99
+					item.Count = listOne.Count
100
+				}
89 101
 
90
-				item.Patient.TotalDialysis = listOne.Count
91
-				item.Count = listOne.Count
92 102
 			}
93 103
 		}
94 104
 		if getScheduleErr != nil {

+ 7 - 1
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go 파일 보기

@@ -57,7 +57,7 @@ func GetSchedules(orgID int64, schIDs []string) ([]*ScheduleVM, error) {
57 57
 		return nil, err
58 58
 	}
59 59
 	for _, item := range schedules {
60
-		if orgID != 10101 {
60
+		if orgID != 10101 && orgID != 10445 {
61 61
 			dialysis_count, _ := GetDialysisOrderCount(orgID, item.PatientID, item.ScheduleDate)
62 62
 
63 63
 			item.Patient.TotalDialysis = dialysis_count
@@ -227,6 +227,12 @@ func GetDialysisOrderCountEight(orgID int64, patient_id int64, recordDate int64)
227 227
 	return order, err
228 228
 }
229 229
 
230
+func GetDialysisOrderCountNight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
231
+	order := models.VmDialysisOrder{}
232
+	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1672502400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
233
+	return order, err
234
+}
235
+
230 236
 func GetOutStockTotalCountTwo(startime int64, endtime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
231 237
 
232 238
 	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