package com.yihu.wlyy.web.patient.intervene; import java.util.List; import io.swagger.annotations.Api; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.yihu.wlyy.entity.patient.PatientInspectionSuggest; import com.yihu.wlyy.entity.patient.PatientSelfInspection; import com.yihu.wlyy.entity.patient.PatientSelfInspectionItem; import com.yihu.wlyy.service.app.intervene.PatientInspectionService; import com.yihu.wlyy.util.DateUtil; import com.yihu.wlyy.web.BaseController; /** * 患者端:干预控制类 * @author George * */ @Controller @RequestMapping(value = "/patient/intervene", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = RequestMethod.GET) @Api(description = "患者端-干预控制") public class PatientInterveneController extends BaseController { @Autowired private PatientInspectionService patientInspectionService; /** * 患者检查建议查询接口 * @param patient * @param id * @param pagesize * @return */ @RequestMapping(value = "inspection_list") @ResponseBody public String inspection(long id, int pagesize) { try { Page list = patientInspectionService.findSuggestByPatient(getUID(), id, pagesize); JSONArray array = new JSONArray(); if (list != null) { for (PatientInspectionSuggest suggest : list) { if (suggest == null) { continue; } JSONObject json = new JSONObject(); json.put("id", suggest.getId()); json.put("content", suggest.getContent()); json.put("czrq", DateUtil.dateToStrLong(suggest.getCzrq())); array.put(json); } } return write(200, "查询成功!", "list", array); } catch (Exception e) { error(e); return error(-1, "查询失败!"); } } /** * 查询指定患者的体测提醒 * @param patient * @param id * @param pagesize * @return */ @RequestMapping(value = "self_exam_list") @ResponseBody public String selfExamList(long id, int pagesize) { try { Page list = patientInspectionService.findSelfExamByPatient(getUID(), id, pagesize); JSONArray array = new JSONArray(); if (list != null) { for (PatientSelfInspection psi : list) { if (psi == null) { continue; } JSONObject json = new JSONObject(); json.put("id", psi.getId()); json.put("code", psi.getCode()); json.put("type", psi.getType()); json.put("czrq", DateUtil.dateToStrLong(psi.getCzrq())); array.put(json); } } return write(200, "查询成功!", "list", array); } catch (Exception e) { error(e); return error(-1, "查询失败!"); } } /** * 查询体检提醒信息 * @param inspection 提醒标识 * @return */ @RequestMapping(value = "self_exam_info") @ResponseBody public String selfExamInfo(String inspection) { try { List list = patientInspectionService.findSelfExamInfo(inspection); JSONArray array = new JSONArray(); if (list != null) { for (PatientSelfInspectionItem psii : list) { if (psii == null) { continue; } JSONObject json = new JSONObject(); // 设备名称 json.put("deviceName", psii.getDeviceName()); // 提醒说明 json.put("content", psii.getContent()); array.put(json); } } return write(200, "查询成功!", "list", array); } catch (Exception e) { error(e); return error(-1, "查询失败!"); } } }