28169 преди 1 ден
родител
ревизия
734e996dc2
променени са 1 файла, в които са добавени 59 реда и са изтрити 0 реда
  1. 59 0
      controllers/inspection_api_controller.go

+ 59 - 0
controllers/inspection_api_controller.go Целия файл

@@ -42,6 +42,10 @@ func InspectionApiRegistRouters() {
42 42
 
43 43
 	beego.Router("/api/editpatientnewinspection", &InspectionApiController{}, "Post:EditPatientNewInspection")
44 44
 
45
+	beego.Router("/api/getinspecitonbypatientgroup", &InspectionApiController{}, "Get:GetInpsectionByPatientGroup")
46
+
47
+	beego.Router("/api/getinspectionchildlist", &InspectionApiController{}, "Get:GetInspectionChildList")
48
+
45 49
 }
46 50
 func (c *InspectionApiController) SetInspectionRemind() {
47 51
 	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
@@ -1140,3 +1144,58 @@ func (c *InspectionApiController) EditPatientNewInspection() {
1140 1144
 
1141 1145
 	fmt.Println("id------------------------------", id)
1142 1146
 }
1147
+
1148
+func (c *InspectionApiController) GetInpsectionByPatientGroup() {
1149
+
1150
+	patient_id, _ := c.GetInt64("patient_id")
1151
+
1152
+	org_id := c.GetAdminUserInfo().CurrentOrgId
1153
+
1154
+	patient, _ := service.GetPatientDetailTwo(patient_id)
1155
+	inspection, _ := service.GetInspectionGroup(patient.BloodId, org_id)
1156
+
1157
+	if len(inspection) > 0 {
1158
+		for _, item := range inspection {
1159
+			lastInspection, _ := service.GetLastInspectionProject(item.PatientId, org_id, item.ProjectId)
1160
+			item.InspectDate = lastInspection.InspectDate
1161
+			inspecList, _ := service.GetInspectionByProjectId(item.PatientId, org_id, item.ProjectId)
1162
+			item.Count = int64(len(inspecList))
1163
+		}
1164
+	}
1165
+
1166
+	c.ServeSuccessJSON(map[string]interface{}{
1167
+		"inspection": inspection,
1168
+	})
1169
+}
1170
+
1171
+func (c *InspectionApiController) GetInspectionChildList() {
1172
+
1173
+	patient_id, _ := c.GetInt64("patient_id")
1174
+
1175
+	project_id, _ := c.GetInt64("project_id")
1176
+
1177
+	org_id := c.GetAdminUserInfo().CurrentOrgId
1178
+
1179
+	patient, _ := service.GetPatientDetailTwo(patient_id)
1180
+
1181
+	referenceList, _ := service.GetInSpctionRerefce(project_id, org_id)
1182
+
1183
+	inspection, _ := service.GetInspectionGroupByRecordDate(patient.BloodId, project_id, org_id)
1184
+
1185
+	if len(inspection) > 0 {
1186
+		for _, item := range inspection {
1187
+			inspeclist, _ := service.GetInspectionByProject(patient.BloodId, project_id, org_id, item.InspectDate)
1188
+			for _, it := range inspeclist {
1189
+				item.Child = append(item.Child, it)
1190
+			}
1191
+		}
1192
+	}
1193
+
1194
+	patients, _ := service.GetPatientByIDOne(org_id, patient.BloodId)
1195
+
1196
+	c.ServeSuccessJSON(map[string]interface{}{
1197
+		"inspection":    inspection,
1198
+		"patients":      patients,
1199
+		"referenceList": referenceList,
1200
+	})
1201
+}