Bladeren bron

修改bug

chenyongxing 7 jaren geleden
bovenliggende
commit
fcf20813dc

+ 5 - 5
common/common-entity/src/main/java/com/yihu/mm/entity/patient/PatientExam.java

@ -14,19 +14,19 @@ import java.util.Date;
public class PatientExam extends IdEntity implements Serializable {
    @Column(name="patient")
    private String patient;
    private String patient;//居民code
    @Column(name="tp_id")
    private String tpId;
    private String tpId;//试卷编号
    @Column(name="tp_name")
    private String tpName;
    private String tpName;//试卷名称
    @Column(name="ct_id")
    private String ctId;
    private String ctId;//咨询编号
    @Column(name="is_complete")
    private Integer isComplete;
    private Integer isComplete;//是否完成(0:未完成   1已完成)
    @Column(name="sl_id")
    private String slId;//预约单号

+ 78 - 55
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java

@ -70,17 +70,19 @@ public class PhysicalExaminationController extends BaseController {
        if(isSignJM==3){
            String insertslip = physicalExaminationService.insertslip(patient);
            JSONObject jsonQuestion = new JSONObject(insertslip);
            jsonQuestion.put("isSignJM",isSignJM);
            JSONObject recordset = jsonQuestion.getJSONObject("recordset");
            String ct_id = recordset.get("ct_id").toString();
            PatientExam patientExam = new PatientExam();
            patientExam.setCtId(ct_id);
            patientExam.setPatient(patientCode);
            patientExam.setIsComplete(0);
            patientExam.setTpId(examCode);
            patientExam.setCreateTime(new Date());
            patientExamService.save(patientExam);
            if(physicalExaminationService.getSuccess(jsonQuestion)){
                jsonQuestion.put("isSignJM",isSignJM);
                JSONObject recordset = jsonQuestion.getJSONObject("recordset");
                String ct_id = recordset.get("ct_id").toString();
                PatientExam patientExam = new PatientExam();
                patientExam.setCtId(ct_id);
                patientExam.setPatient(patientCode);
                patientExam.setIsComplete(0);
                patientExam.setTpId(examCode);
                patientExam.setCreateTime(new Date());
                patientExamService.save(patientExam);
            }
            return jsonQuestion.toString();
        }else{
            return write(200,"未签约或者签约不在集美","isSignJM",isSignJM);
@ -99,33 +101,35 @@ public class PhysicalExaminationController extends BaseController {
        String question = physicalExaminationService.findQuestion(examCode, pb_id, ct_id);
        JSONObject jsonQuestion = new JSONObject(question);
        JSONObject recordset = jsonQuestion.getJSONObject("recordset");
        String _pb_id = recordset.get("pb_id").toString();//越人api问题,  我们数据库保存的居民答案的pb_id是这边返回下一题的pb_id
        //查找居民是否已经答过该试题
        MedicineAnswerLog medicineAnswerLog = medicineAnswerLogService.findAnswer(patientCode, examCode, _pb_id,ct_id);
        String answer="";
        if(medicineAnswerLog!=null){
            answer = medicineAnswerLog.getAnswer().replace("\"","\\\"");
        }else{
            medicineAnswerLog = new MedicineAnswerLog();
            medicineAnswerLog.setPatientCode(patientCode);
            medicineAnswerLog.setTpId(examCode);
            medicineAnswerLog.setPbId(_pb_id);
            medicineAnswerLog.setCtId(ct_id);
            medicineAnswerLog.setCreateTime(new Date());
        if(physicalExaminationService.getSuccess(jsonQuestion)){
            JSONObject recordset = jsonQuestion.getJSONObject("recordset");
            if(recordset.has("pb_id")){//返回空对象,则为可判断是最后一题
                String _pb_id = recordset.get("pb_id").toString();//越人api问题,  我们数据库保存的居民答案的pb_id是这边返回下一题的pb_id
                //查找居民是否已经答过该试题
                MedicineAnswerLog medicineAnswerLog = medicineAnswerLogService.findAnswer(patientCode, examCode, _pb_id,ct_id);
                String answer="";
                if(medicineAnswerLog!=null){
                    answer = medicineAnswerLog.getAnswer().replace("\"","\\\"");
                }else{
                    medicineAnswerLog = new MedicineAnswerLog();
                    medicineAnswerLog.setPatientCode(patientCode);
                    medicineAnswerLog.setTpId(examCode);
                    medicineAnswerLog.setPbId(_pb_id);
                    medicineAnswerLog.setCtId(ct_id);
                    medicineAnswerLog.setCreateTime(new Date());
                }
                //获取题目 ,选项, 题目类型 ,并重新保存    --->>防止题目选择不同的答案,下个问题也跟着不一样
                String tb_title =  recordset.getString("pb_title");   //题目
                String option = recordset.getString("pb_alternative");//备选答案
                String type = recordset.get("i_multiselect").toString();//单选多选
                medicineAnswerLog.setType(type);
                medicineAnswerLog.setQuestion(tb_title);
                medicineAnswerLog.setOpti(option);
                medicineAnswerLogService.save(medicineAnswerLog);
                jsonQuestion.put("answer",answer);
            }
        }
        //获取题目 ,选项, 题目类型 ,并重新保存    --->>防止题目选择不同的答案,下个问题也跟着不一样
        String tb_title =  recordset.getString("tb_title");   //题目
        String option = recordset.getString("pb_alternative");//备选答案
        String type = recordset.get("i_multiselect").toString();//单选多选
        medicineAnswerLog.setType(type);
        medicineAnswerLog.setQuestion(tb_title);
        medicineAnswerLog.setOpti(option);
        medicineAnswerLogService.save(medicineAnswerLog);
        jsonQuestion.put("answer",answer);
        return jsonQuestion.toString();
    }
@ -137,15 +141,38 @@ public class PhysicalExaminationController extends BaseController {
                                @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 = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode){
        PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, examCode,ct_id);
        String tpName = patientExam.getTpName();
        //提交答案
        String result = physicalExaminationService.handleExam(examCode, pb_id, dc_answer, ct_id);
        //将答案保存/更新到自己数据库
        MedicineAnswerLog answer = medicineAnswerLogService.findAnswer(patientCode, examCode, pb_id, ct_id);
        answer.setType(String.valueOf(type));
        answer.setAnswer(dc_answer);
        medicineAnswerLogService.save(answer);
        JSONObject resultJson = new JSONObject(result);
        //成功提交答案才做数据的保存等,否则直接返回
        if(physicalExaminationService.getSuccess(resultJson)){
            PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, examCode,ct_id);
            if(patientExam==null){
                patientExam = new PatientExam();
                patientExam.setPatient(patientCode);
                patientExam.setTpId(examCode);
                patientExam.setCtId(ct_id);
                patientExam.setCreateTime(new Date());
            }
            //判断是否下一题...
            String question = physicalExaminationService.findQuestion(examCode, pb_id, ct_id);
            JSONObject jsonQuestion = new JSONObject(question);
            if(physicalExaminationService.getSuccess(jsonQuestion)){
                JSONObject recordset = jsonQuestion.getJSONObject("recordset");
                if(recordset.has("pb_id")) {//返回空对象,则为可判断是最后一题
                    patientExam.setIsComplete(0);
                }else{
                    patientExam.setIsComplete(1);
                }
            }
            patientExamService.save(patientExam);
            //将答案保存/更新到自己数据库
            MedicineAnswerLog answer = medicineAnswerLogService.findAnswer(patientCode, examCode, pb_id, ct_id);
            answer.setType(String.valueOf(type));
            answer.setAnswer(dc_answer);
            medicineAnswerLogService.save(answer);
        }
        return result;
    }
@ -156,19 +183,15 @@ public class PhysicalExaminationController extends BaseController {
                              @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){
        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)){
        if(physicalExaminationService.getSuccess(uploadResult)){
            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 at_id =  recordset.get("at_id").toString();
            String at_realname = (String) recordset.get("at_realname");
            String result = physicalExaminationService.dillphoneimgdata(at_id, at_realname, type, ct_id);
            return result;
        }
        String result = physicalExaminationService.dillphoneimgdata(at_id, at_realname, type, ct_id);
        return result;
        return uploadAttachment;
    }
    @ApiOperation(value = "查看报告单")

+ 8 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java

@ -31,6 +31,14 @@ public class PhysicalExaminationService {
    @Autowired
    private ExamReportService examReportService;
    public boolean getSuccess(JSONObject result ){
        if("200".equals(result.get("status").toString())){
            return true;
        }
        return false;
    }
    //查找试卷
    public String findExames(String type, String examCode) {
        JSONObject params = new JSONObject();

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java

@ -47,7 +47,7 @@ public class CustomerController extends BaseController {
    @Autowired
    private WlyyCustomerLogService wlyyCustomerLogService;
    @RequestMapping(value = "/login",produces="application/json;charset=UTF-8")
    @RequestMapping(value = "/login",method = RequestMethod.POST,produces="application/json;charset=UTF-8")
    @ResponseBody
    public String login(@ApiParam(name = "userName", value = "账号", required = true)@RequestParam(required = true, name = "userName") String userName,
                               @ApiParam(name = "password", value = "密码", required = true)@RequestParam(required = true, name = "password") String password,