Browse Source

Merge branch 'dev' of trick9191/patient-co-management into dev

trick9191 7 năm trước cách đây
mục cha
commit
b9bac4ee8d

+ 33 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -211,9 +211,9 @@ public class PrescriptionInfoService extends BaseService {
                    String code = (String) map.get("code");
                    map.put("patient", p.getCode());
                    map.put("patientName", p.getName());
                    StringBuffer isAdjustSql = new StringBuffer("SELECT a.id FROM wlyy_prescription_adjust a WHERE a.prescription_code = ? ");
                    List<Map<String,Object>> adjusts = jdbcTemplate.queryForList(isAdjustSql.toString(),new Object[]{code});
                    if(adjusts!=null&&adjusts.size()>0){
                    //判断是否已经审核
                    if(isAdjustPres(code)){
                        map.put("isAdjust", "1");
                    }else{
                        map.put("isAdjust", "0");
@ -227,6 +227,20 @@ public class PrescriptionInfoService extends BaseService {
        return new com.alibaba.fastjson.JSONArray();
    }
    /**
     *
     * @param code
     * @return
     */
    public boolean isAdjustPres(String code){
        StringBuffer isAdjustSql = new StringBuffer("SELECT a.id FROM wlyy_prescription_adjust a WHERE a.prescription_code = ? ");
        List<Map<String,Object>> adjusts = jdbcTemplate.queryForList(isAdjustSql.toString(),new Object[]{code});
        if(adjusts!=null&&adjusts.size()>0){
            return true ;
        }
        return false;
    }
    /**
     * 获取续方信息
     *
@ -393,7 +407,13 @@ public class PrescriptionInfoService extends BaseService {
                prescriptionDao.save(p);
                //审核通过模板消息
                sendRMess(p.getCode(), 1);
                if(isAdjustPres(p.getCode())){
                    sendRMess(p.getCode(), 1);
                }else{
                    //发送调整后处方模板并审核通过消息
                    sendRMess(p.getCode(), 2);
                }
                //修改系统的续方消息的审核状态
                messageDao.updatePreScriptionMessage(p.getConsult(), "1", 6);
@ -817,14 +837,22 @@ public class PrescriptionInfoService extends BaseService {
        return 0;
    }
    /**
     * 发送审核模板消息
     * @param code
     * @param state 1.审核通过,0,审核不通过,2.处方调整并审核通过
     * @return
     */
    public int sendRMess(String code, Integer state) {
        try {
            Prescription prescription = prescriptionDao.findByCode(code);
            Patient p = patientDao.findByCode(prescription.getPatient());
            if (state != null && state == 1) {
                prescriptionNoticesService.sendMessages(prescription.getPatient(), prescription.getDoctorName(), null, 1, 1, "prescription/html/re-prescription_info.html?openid=" + p.getOpenid() + "&toUser=" + p.getCode() + "&toName=" + p.getName() + "&code=" + prescription.getCode());
            } else {
            } else if(state != null && state == 0){
                prescriptionNoticesService.sendMessages(prescription.getPatient(), prescription.getDoctorName(), null, 1, 0, "prescription/html/re-prescription_info.html?openid=" + p.getOpenid() + "&toUser=" + p.getCode() + "&toName=" + p.getName() + "&code=" + prescription.getCode());
            }else{
                prescriptionNoticesService.sendMessages(prescription.getPatient(), prescription.getDoctorName(), null, 1, 2, "prescription/html/re-prescription_info.html?openid=" + p.getOpenid() + "&toUser=" + p.getCode() + "&toName=" + p.getName() + "&code=" + prescription.getCode());
            }
            return 1;
        } catch (Exception e) {