Browse Source

提交代码

陈少旭 1 year ago
parent
commit
7c60c50dc1
2 changed files with 77 additions and 18 deletions
  1. 54 18
      controllers/his_api_controller.go
  2. 23 0
      service/his_service.go

+ 54 - 18
controllers/his_api_controller.go View File

@@ -205,16 +205,35 @@ func (c *HisApiController) GetMonthHisPatient() {
205 205
 	var patients []service.NewTempPatients
206 206
 	var patients_two []service.NewTempPatients
207 207
 
208
-	for _, item := range tempPatients {
209
-		//过滤掉没挂号的和没开处方的
210
-		if len(item.HisPatient) > 0 && len(item.HisPrescription) > 0 {
211
-			patients = append(patients, item)
208
+	if c.GetAdminUserInfo().CurrentOrgId == 10206 {
209
+
210
+		for _, item := range tempPatients {
211
+			//过滤掉没挂号的和没开处方的
212
+			if len(item.HisPrescription) > 0 {
213
+				patients = append(patients, item)
214
+				patients_two = append(patients_two, item)
215
+
216
+			}
217
+			////过滤掉没挂号的
218
+			//if len(item.HisPatient) > 0 {
219
+			//}
220
+		}
221
+
222
+	} else {
223
+
224
+		for _, item := range tempPatients {
225
+			//过滤掉没挂号的和没开处方的
226
+			if len(item.HisPatient) > 0 && len(item.HisPrescription) > 0 {
227
+				patients = append(patients, item)
228
+			}
229
+			////过滤掉没挂号的
230
+			//if len(item.HisPatient) > 0 {
231
+			//	patients_two = append(patients_two, item)
232
+			//}
212 233
 		}
213
-		////过滤掉没挂号的
214
-		//if len(item.HisPatient) > 0 {
215
-		//	patients_two = append(patients_two, item)
216
-		//}
234
+
217 235
 	}
236
+
218 237
 	c.ServeSuccessJSON(map[string]interface{}{
219 238
 		"list":           patients,
220 239
 		"list_two":       patients_two,
@@ -7863,24 +7882,41 @@ func (c *HisApiController) GetHisChargePatientList() {
7863 7882
 	adminInfo := c.GetAdminUserInfo()
7864 7883
 	var tempPatients []*service.NewTempPatients
7865 7884
 	//tempPatients, _ := service.GetAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
7866
-	if order_status != 2 {
7867
-		tempPatients, _ = service.GetNewAllUnChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime, sch_type)
7885
+	if c.GetAdminUserInfo().CurrentOrgId == 10206 { //针对用了坐标系统的机构
7886
+		if order_status != 2 {
7887
+			tempPatients, _ = service.GetNewAllUnChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime, sch_type)
7888
+		} else {
7889
+			tempPatients, _ = service.GetNewAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime, sch_type)
7890
+		}
7891
+
7868 7892
 	} else {
7869
-		tempPatients, _ = service.GetNewAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime, sch_type)
7893
+
7894
+		if order_status != 2 {
7895
+			tempPatients, _ = service.GetNewAllUnChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime, sch_type)
7896
+		} else {
7897
+			tempPatients, _ = service.GetNewAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime, sch_type)
7898
+		}
7899
+
7870 7900
 	}
7871 7901
 
7872 7902
 	var patients []*service.NewTempPatients
7873 7903
 	var patients_two []*service.NewTempPatients
7874 7904
 
7875 7905
 	for _, item := range tempPatients {
7876
-		//过滤掉没挂号的和没开处方的
7877
-		if len(item.HisPatient) > 0 || len(item.HisPrescription) > 0 {
7878
-			patients = append(patients, item)
7879
-		}
7906
+		if c.GetAdminUserInfo().CurrentOrgId != 10206 {
7907
+			//过滤掉没挂号的和没开处方的
7908
+			if len(item.HisPatient) > 0 || len(item.HisPrescription) > 0 {
7909
+				patients = append(patients, item)
7910
+			}
7911
+			//过滤掉没挂号的
7912
+			if len(item.HisPatient) > 0 {
7913
+				patients_two = append(patients_two, item)
7914
+			}
7880 7915
 
7881
-		//过滤掉没挂号的
7882
-		if len(item.HisPatient) > 0 {
7883
-			patients_two = append(patients_two, item)
7916
+		} else {
7917
+			if len(item.HisPrescription) > 0 {
7918
+				patients = append(patients, item)
7919
+			}
7884 7920
 		}
7885 7921
 	}
7886 7922
 	c.ServeSuccessJSON(map[string]interface{}{

+ 23 - 0
service/his_service.go View File

@@ -2868,3 +2868,26 @@ func GetLastHisOrderTwo(org_id int64) (his models.HisOrder, err error) {
2868 2868
 	err = readDb.Model(&models.HisOrder{}).Select("max(convert(fa_piao_number,signed)) as fa_piao_number").Where("user_org_id = ? AND status = 1 AND order_status = 2 ", org_id).Find(&his).Error
2869 2869
 	return
2870 2870
 }
2871
+
2872
+//func GetZuoBiaoNewAllUnChargeHisPatientList(org_id int64, record_date int64) (patients []*NewTempPatients, err error) {
2873
+//	db := readDb.Model(&NewTempPatients{})
2874
+//
2875
+//	db = db.Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
2876
+//	db = db.Preload("Schedule", "status = 1")
2877
+//	db = db.Preload("HisPatient", func(db *gorm.DB) *gorm.DB {
2878
+//		return db.Where("status = 1 AND user_org_id = ? AND record_date = ?", org_id, record_date).Preload("VMHisOrders", "user_org_id = ? AND status = 1 AND settle_accounts_date = ?", org_id, record_date)
2879
+//	})
2880
+//	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND order_status <> 2 AND order_status <> 3", org_id, record_date)
2881
+//	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND prescription_status <> 3", org_id, record_date).Find(&patients).Error
2882
+//
2883
+//	for _, item := range patients {
2884
+//		for _, sumItem := range item.HisPatient {
2885
+//			if len(sumItem.VMHisOrders) > 0 {
2886
+//				sumItem.VMHisOrder.OrderStatus = sumItem.VMHisOrders[len(sumItem.VMHisOrders)-1].OrderStatus
2887
+//			}
2888
+//		}
2889
+//
2890
+//	}
2891
+//
2892
+//	return
2893
+//}