|
@ -1,24 +1,30 @@
|
|
package com.yihu.mm.controller.medicine;
|
|
package com.yihu.mm.controller.medicine;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JavaType;
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.yihu.mm.controller.BaseController;
|
|
import com.yihu.mm.controller.BaseController;
|
|
import com.yihu.mm.entity.patient.ExamReport;
|
|
import com.yihu.mm.entity.patient.ExamReport;
|
|
import com.yihu.mm.entity.patient.PatientExam;
|
|
import com.yihu.mm.entity.patient.PatientExam;
|
|
|
|
import com.yihu.mm.entity.patient.Report;
|
|
|
|
import com.yihu.mm.entity.patient.ReportDetail;
|
|
import com.yihu.mm.entity.questionnaire.MedicineAnswerLog;
|
|
import com.yihu.mm.entity.questionnaire.MedicineAnswerLog;
|
|
import com.yihu.mm.service.*;
|
|
import com.yihu.mm.service.*;
|
|
|
|
import com.yihu.mm.util.JSONUtil;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping(value = "/medicine/physicalExamination")
|
|
@RequestMapping(value = "/medicine/physicalExamination")
|
|
@ -98,7 +104,11 @@ public class PhysicalExaminationController extends BaseController {
|
|
|
|
|
|
//查找居民是否已经答过该试题
|
|
//查找居民是否已经答过该试题
|
|
MedicineAnswerLog answer = medicineAnswerLogService.findAnswer(patientCode, examCode, _pb_id,ct_id);
|
|
MedicineAnswerLog answer = medicineAnswerLogService.findAnswer(patientCode, examCode, _pb_id,ct_id);
|
|
jsonQuestion.put("answer",(answer==null?"":answer.getProblems()));
|
|
|
|
|
|
String answerStr="";
|
|
|
|
if(answer!=null){
|
|
|
|
answerStr = answer.getProblems().replace("\"","\\\"");
|
|
|
|
}
|
|
|
|
jsonQuestion.put("answer",answerStr);
|
|
|
|
|
|
return jsonQuestion.toString();
|
|
return jsonQuestion.toString();
|
|
}
|
|
}
|
|
@ -108,10 +118,9 @@ public class PhysicalExaminationController extends BaseController {
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public String handleExam(@ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id,
|
|
public String handleExam(@ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id,
|
|
@ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = true, name = "pb_id") String pb_id,
|
|
@ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = true, name = "pb_id") String pb_id,
|
|
@ApiParam(name = "i_multiselect", value = "试题类型(0单选 ,1多选)", required = true)@RequestParam(required = true, name = "i_multiselect") String i_multiselect,
|
|
|
|
|
|
@ApiParam(name = "type", value = "试题类型(0单选 ,1多选)", required = true)@RequestParam(required = true, name = "type") String type,
|
|
@ApiParam(name = "dc_answer", value = "问题答案", required = true)@RequestParam(required = true, name = "dc_answer") String dc_answer,
|
|
@ApiParam(name = "dc_answer", value = "问题答案", required = true)@RequestParam(required = true, name = "dc_answer") String dc_answer,
|
|
@ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode,
|
|
|
|
@ApiParam(name = "isLast", value = "是否是最后一题(0否 ,1是)", required = true)@RequestParam(required = false, name = "isLast") String isLast){
|
|
|
|
|
|
@ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode){
|
|
PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, examCode,ct_id);
|
|
PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, examCode,ct_id);
|
|
String tpName = patientExam.getTpName();
|
|
String tpName = patientExam.getTpName();
|
|
String result = physicalExaminationService.handleExam(examCode, pb_id, dc_answer, ct_id);
|
|
String result = physicalExaminationService.handleExam(examCode, pb_id, dc_answer, ct_id);
|
|
@ -127,34 +136,60 @@ public class PhysicalExaminationController extends BaseController {
|
|
answer.setTpName(tpName);
|
|
answer.setTpName(tpName);
|
|
answer.setCtId(ct_id);
|
|
answer.setCtId(ct_id);
|
|
}
|
|
}
|
|
answer.setPbType(String.valueOf(i_multiselect));
|
|
|
|
|
|
answer.setPbType(String.valueOf(type));
|
|
answer.setProblems(dc_answer);
|
|
answer.setProblems(dc_answer);
|
|
medicineAnswerLogService.save(answer);
|
|
medicineAnswerLogService.save(answer);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "四诊资料采集")
|
|
@ApiOperation(value = "四诊资料采集")
|
|
@RequestMapping(value = "/dillphoneimgdata",produces="application/json;charset=UTF-8")
|
|
|
|
|
|
@RequestMapping(value = "/dillphoneimgdata", method = RequestMethod.POST,produces="application/json;charset=UTF-8")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public String dillphoneimgdata(@ApiParam(name = "at_id", value = "文件id", required = true)@RequestParam(required = true, name = "at_id") String at_id,
|
|
|
|
@ApiParam(name = "answer", value = "问题答案,文件名称", required = true)@RequestParam(required = true, name = "answer") String answer,
|
|
|
|
|
|
public String dillphoneimgdata(@RequestParam MultipartFile file,
|
|
@ApiParam(name = "type", value = "1.脸型 2.舌像 3.声音", required = true)@RequestParam(required = true, name = "type") String type,
|
|
@ApiParam(name = "type", value = "1.脸型 2.舌像 3.声音", required = true)@RequestParam(required = true, name = "type") String type,
|
|
@ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id){
|
|
@ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id){
|
|
String result = physicalExaminationService.dillphoneimgdata(at_id, answer, type, ct_id);
|
|
|
|
|
|
String uploadAttachment = physicalExaminationService.uploadAttachment(file);
|
|
|
|
String at_id = null;
|
|
|
|
String at_realname=null;
|
|
|
|
JSONObject uploadResult = new JSONObject(uploadAttachment);
|
|
|
|
String status = uploadResult.get("status").toString();
|
|
|
|
if("200".equals(status)){
|
|
|
|
JSONObject recordset = uploadResult.getJSONObject("recordset");
|
|
|
|
at_id = recordset.get("at_id").toString();
|
|
|
|
at_realname = (String) recordset.get("at_realname");
|
|
|
|
}else{
|
|
|
|
return write(500,"提交失败","exception",uploadResult.get("status").toString());
|
|
|
|
}
|
|
|
|
String result = physicalExaminationService.dillphoneimgdata(at_id, at_realname, type, ct_id);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查看报告单")
|
|
@ApiOperation(value = "查看报告单")
|
|
@RequestMapping(value = "/findconconhealth",produces="application/json;charset=UTF-8")
|
|
|
|
|
|
@RequestMapping(value = "/showDetail",produces="application/json;charset=UTF-8")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public String showDetail(@ApiParam(name = "patientCode", value = "居民code", required = false)@RequestParam(required = true, name = "patientCode") String patientCode,
|
|
public String showDetail(@ApiParam(name = "patientCode", value = "居民code", required = false)@RequestParam(required = true, name = "patientCode") String patientCode,
|
|
@ApiParam(name = "ct_id", value = "咨询编号", required = false)@RequestParam(required = false, name = "ct_id") String ct_id){
|
|
@ApiParam(name = "ct_id", value = "咨询编号", required = false)@RequestParam(required = false, name = "ct_id") String ct_id){
|
|
ExamReport examReport = examReportService.showDetail(patientCode, ct_id);
|
|
ExamReport examReport = examReportService.showDetail(patientCode, ct_id);
|
|
|
|
|
|
|
|
Map<String,Object> respon = new HashMap<String,Object>();
|
|
if(null!=examReport){
|
|
if(null!=examReport){
|
|
|
|
|
|
|
|
String report = examReport.getReport();
|
|
|
|
String reportDetail = examReport.getReportDetail();
|
|
|
|
|
|
|
|
List<Report> reports = null;
|
|
|
|
ReportDetail reportDetail1 = null;
|
|
|
|
ObjectMapper objm = new ObjectMapper();
|
|
|
|
JavaType javaType = objm.getTypeFactory().constructParametricType(List.class, Report.class);
|
|
|
|
try {
|
|
|
|
reports=(List<Report>)objm.readValue(report,javaType);
|
|
|
|
reportDetail1 = (ReportDetail) JSONUtil.JSONToObj(reportDetail, ReportDetail.class);
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
respon.put("report",reports);
|
|
|
|
respon.put("reportDetail",reportDetail1);
|
|
|
|
return write(200,"查询成功","recordset",respon);
|
|
}
|
|
}
|
|
return write(200,"查询成功","recordset",examReport);
|
|
|
|
|
|
return write(-200,"未查询到数据");
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|