Browse Source

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

trick9191 8 years ago
parent
commit
d508fe11fb

+ 1 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java

@ -638,6 +638,7 @@ public class Prescription extends IdEntity {
        this.prescribeReason = prescribeReason;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getPrescribeTime() {
        return prescribeTime;
    }

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

@ -370,6 +370,11 @@ public class PrescriptionInfoService extends BaseService {
                com.alibaba.fastjson.JSONObject returnData = (com.alibaba.fastjson.JSONObject)reData.get(0);
                p.setVisitNo(returnData.getString("VISIT_NO"));
                p.setRecipeNo(returnData.getString("RECIPE_NO"));
                //设置状态为待支付
                p.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue());
                //设置审核通过
                reviewed.setStatus(1);
                reviewed.setReviewedTime(new Date());
                prescriptionDao.save(p);
                return 1;
            }else{
@ -764,16 +769,25 @@ public class PrescriptionInfoService extends BaseService {
            JSONObject json = new JSONObject(mes);
            Integer state = json.getInt("state");
            String code = json.getString("prescription");
            return sendRMess(code ,state);
        }catch (Exception e){
            logger.error("报文解析失败!",e);
        }
        return 0;
    }
    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{
                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());
            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 {
                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){
            logger.error("续方消息发送失败!",e);
        } catch (Exception e) {
            logger.error("续方消息发送失败!", e);
        }
        return 0;
    }