Browse Source

医保对接

csx 4 years ago
parent
commit
0b109038fb
2 changed files with 26 additions and 1 deletions
  1. 25 0
      controllers/his_api_controller.go
  2. 1 1
      service/his_service.go

+ 25 - 0
controllers/his_api_controller.go View File

142
 	patients, _ := service.GetScheduleHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
142
 	patients, _ := service.GetScheduleHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
143
 	patients_two, _ := service.GetHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
143
 	patients_two, _ := service.GetHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
144
 	patients = append(patients, patients_two...)
144
 	patients = append(patients, patients_two...)
145
+	patients = RemoveRepeatedPatient(patients)
145
 
146
 
146
 	var total_one int64
147
 	var total_one int64
147
 	var total_two int64
148
 	var total_two int64
244
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
245
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
245
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
246
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
246
 	order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
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
 	c.ServeSuccessJSON(map[string]interface{}{
253
 	c.ServeSuccessJSON(map[string]interface{}{
248
 		"his_info":            his_patient_info,
254
 		"his_info":            his_patient_info,
249
 		"xt_info":             xt_patient_info,
255
 		"xt_info":             xt_patient_info,
252
 		"info":                patientPrescriptionInfo,
258
 		"info":                patientPrescriptionInfo,
253
 		"month_prescriptions": monthPrescriptions,
259
 		"month_prescriptions": monthPrescriptions,
254
 		"order":               order,
260
 		"order":               order,
261
+		"doctors":             doctors,
262
+		"department":          department,
255
 	})
263
 	})
256
 	return
264
 	return
257
 
265
 
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 View File

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)
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
 	db = db.Preload("HisPatient", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
141
 	db = db.Preload("HisPatient", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
142
 	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
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
 	return
144
 	return
145
 }
145
 }
146
 
146