csx 4 lat temu
rodzic
commit
0b109038fb
2 zmienionych plików z 26 dodań i 1 usunięć
  1. 25 0
      controllers/his_api_controller.go
  2. 1 1
      service/his_service.go

+ 25 - 0
controllers/his_api_controller.go Wyświetl plik

@@ -142,6 +142,7 @@ func (c *HisApiController) GetHisPatientList() {
142 142
 	patients, _ := service.GetScheduleHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
143 143
 	patients_two, _ := service.GetHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
144 144
 	patients = append(patients, patients_two...)
145
+	patients = RemoveRepeatedPatient(patients)
145 146
 
146 147
 	var total_one int64
147 148
 	var total_two int64
@@ -244,6 +245,11 @@ func (c *HisApiController) GetHisPatientInfo() {
244 245
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
245 246
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
246 247
 	order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
248
+
249
+	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
250
+	//获取所有科室信息
251
+	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
252
+
247 253
 	c.ServeSuccessJSON(map[string]interface{}{
248 254
 		"his_info":            his_patient_info,
249 255
 		"xt_info":             xt_patient_info,
@@ -252,6 +258,8 @@ func (c *HisApiController) GetHisPatientInfo() {
252 258
 		"info":                patientPrescriptionInfo,
253 259
 		"month_prescriptions": monthPrescriptions,
254 260
 		"order":               order,
261
+		"doctors":             doctors,
262
+		"department":          department,
255 263
 	})
256 264
 	return
257 265
 
@@ -2990,3 +2998,20 @@ func (c *HisApiController) GetHisUnRegisterPatientList() {
2990 2998
 	})
2991 2999
 
2992 3000
 }
3001
+
3002
+func RemoveRepeatedPatient(patient []*service.Patients) (newArr []*service.Patients) {
3003
+	newArr = make([]*service.Patients, 0)
3004
+	for i := 0; i < len(patient); i++ {
3005
+		repeat := false
3006
+		for j := i + 1; j < len(patient); j++ {
3007
+			if patient[i].ID == patient[j].ID {
3008
+				repeat = true
3009
+				break
3010
+			}
3011
+		}
3012
+		if !repeat {
3013
+			newArr = append(newArr, patient[i])
3014
+		}
3015
+	}
3016
+	return
3017
+}

+ 1 - 1
service/his_service.go Wyświetl plik

@@ -140,7 +140,7 @@ func GetScheduleHisPatientList(org_id int64, keywords string, record_date int64)
140 140
 		Joins("join xt_schedule as sch ON sch.patient_id = xt_patients.id AND sch.schedule_date = ? AND sch.status = 1 AND sch.user_org_id = ?", record_date, org_id)
141 141
 	db = db.Preload("HisPatient", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
142 142
 	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
143
-	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date).Find(&patients).Error
143
+	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date).Group("xt_patients.id").Find(&patients).Error
144 144
 	return
145 145
 }
146 146