|
@ -1,7 +1,8 @@
|
|
|
package com.yihu.mm.controller.medicine;
|
|
|
|
|
|
import com.yihu.mm.controller.BaseController;
|
|
|
import com.yihu.mm.entity.Patient;
|
|
|
import com.yihu.mm.entity.PatientExam;
|
|
|
import com.yihu.mm.service.PatientExamService;
|
|
|
import com.yihu.mm.service.PatientService;
|
|
|
import com.yihu.mm.service.PhysicalExaminationService;
|
|
|
import com.yihu.mm.util.HttpClientUtil;
|
|
@ -35,6 +36,9 @@ public class PhysicalExaminationController extends BaseController {
|
|
|
@Autowired
|
|
|
private PhysicalExaminationService physicalExaminationService;
|
|
|
|
|
|
@Autowired
|
|
|
private PatientExamService patientExamService;
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取试卷列表")
|
|
|
@RequestMapping(value = "/findExames",produces="application/json;charset=UTF-8")
|
|
@ -45,7 +49,16 @@ public class PhysicalExaminationController extends BaseController {
|
|
|
HttpSession session = req.getSession();
|
|
|
String key = (String) session.getAttribute("key");
|
|
|
if(StringUtils.isBlank(key)){
|
|
|
key = HttpClientUtil.postBody(yuerenApi + "/phonekey", new JSONObject());
|
|
|
//通过接口查询key
|
|
|
String result = HttpClientUtil.postBody(yuerenApi + "/phonekey", new JSONObject());
|
|
|
JSONObject jsonObject = new JSONObject(result);
|
|
|
String status = jsonObject.get("status").toString();
|
|
|
if ("200".equals(status)) {
|
|
|
JSONObject recordset = jsonObject.getJSONObject("recordset");
|
|
|
key = recordset.getString("key");
|
|
|
}else{
|
|
|
return result;
|
|
|
}
|
|
|
session.setMaxInactiveInterval(60*60*4);
|
|
|
session.setAttribute("key",key);
|
|
|
}
|
|
@ -57,20 +70,44 @@ public class PhysicalExaminationController extends BaseController {
|
|
|
@ResponseBody
|
|
|
public String insertslip(@ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode, HttpServletRequest req){
|
|
|
String key = (String) req.getSession().getAttribute("key");
|
|
|
Patient patient = patientService.findByCode(patientCode);
|
|
|
return physicalExaminationService.insertslip(key,patient);
|
|
|
//Patient patient = patientService.findByCode(patientCode);
|
|
|
//return physicalExaminationService.insertslip(key,patient);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取试题")
|
|
|
@RequestMapping(value = "/findQuestion",produces="application/json;charset=UTF-8")
|
|
|
@ResponseBody
|
|
|
public String findQuestion(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = false, name = "tp_id") String tp_id,
|
|
|
@ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = false, name = "pb_id") String pb_id,
|
|
|
@ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = false, name = "ct_id") String ct_id,
|
|
|
public String findQuestion(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = true, name = "tp_id") String tp_id,
|
|
|
@ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = true, name = "pb_id") String pb_id,
|
|
|
@ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode,
|
|
|
HttpServletRequest req){
|
|
|
String key = (String) req.getSession().getAttribute("key");
|
|
|
return physicalExaminationService.findQuestion(key,tp_id,pb_id,ct_id);
|
|
|
HttpSession session = req.getSession();
|
|
|
String key = (String) session.getAttribute("key");
|
|
|
|
|
|
String ct_id="";
|
|
|
PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, tp_id);
|
|
|
if(patientExam==null){
|
|
|
//Patient patient = patientService.findByCode(patientCode);
|
|
|
//String result = physicalExaminationService.insertslip(key, patient);
|
|
|
//JSONObject jsonObject = new JSONObject(result);
|
|
|
//String status = jsonObject.get("status").toString();
|
|
|
//if ("200".equals(status)) {
|
|
|
// JSONObject recordset = jsonObject.getJSONObject("recordset");
|
|
|
// ct_id = recordset.getString("ct_id");
|
|
|
// patientExam = new PatientExam();
|
|
|
// patientExam.setCtId(ct_id);
|
|
|
// patientExam.setPatient(patientCode);
|
|
|
// patientExam.setIsComplete(0);
|
|
|
// patientExam.setTpId(tp_id);
|
|
|
// patientExamService.save(patientExam);
|
|
|
//}else{
|
|
|
// return result;
|
|
|
//}
|
|
|
}
|
|
|
String question = physicalExaminationService.findQuestion(key, tp_id, pb_id, ct_id);
|
|
|
return question;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "提交试卷答案")
|
|
@ -79,11 +116,15 @@ public class PhysicalExaminationController extends BaseController {
|
|
|
public String handleExam(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = true, name = "tp_id") String tp_id,
|
|
|
@ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = true, name = "pb_id") String pb_id,
|
|
|
@ApiParam(name = "dc_answer", value = "问题答案", required = true)@RequestParam(required = true, name = "dc_answer") String dc_answer,
|
|
|
@ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id,
|
|
|
@ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode,
|
|
|
HttpServletRequest req){
|
|
|
String key = (String) req.getSession().getAttribute("key");
|
|
|
return physicalExaminationService.handleExam(key,tp_id,pb_id,dc_answer,ct_id);
|
|
|
PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, tp_id);
|
|
|
String ct_id = patientExam.getCtId();
|
|
|
String result = physicalExaminationService.handleExam(key, tp_id, pb_id, dc_answer, ct_id);
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "四诊资料采集")
|