Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan 3 năm trước cách đây
mục cha
commit
de23f348e8

+ 101 - 45
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -3312,42 +3312,97 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else {
            sql = sql + "date_format(p.pay_time,'%Y-%m-%d %H:%i:%S' )  AS \"payTime\",";
        }
        sql = sql + "IFNULL(p.create_time,' ') as time,\n" +
                "IFNULL(e.name,' ') as \"name\", \n" +
                "IFNULL(p.pay_time,' ') AS \"pay_time\" ,\n" +
                "IFNULL(p.real_order,' ') AS \"realOrder\" ,\n" +
                "IFNULL(o.patient_name,' ') as \"patientName\",\n" +
                "IFNULL(i.drug_name,' ') as \"infoName\",\n" +
                "IF(p.create_time = NULL,'否','是') as \"create_time\" ,\n" +
                "case e.oneself_pickup_flg\n" +
                "when 1 then '自取'\n" +
                "when 2 then '快递配送'\n" +
                "else ' ' end oneself_pickup_flg,\n" +
                "CASE p.status\n" +
                "when -4 then '已作废'\n" +
                "when -3 then '支付过期取消'\n" +
                "when -2 then '患者自己取消'\n" +
                "when -1 then '医生取消'\n" +
                "when 0 then '候诊中'\n" +
                "when 10 then '诊断中'\n" +
                "when 11 then '药师审核失败 / 调整中'\n" +
                "when 12 then '药师审核完成'\n" +
                "when 13 then '开方失败/调整中'\n" +
                "when 20 then '诊断完成/开方成功/待支付'\n" +
                "when 21 then '支付失败/待支付中'\n" +
                "when 30 then '支付成功/等待配药'\n" +
                "when 31 then '配药成功/等待取药'\n" +
                "when 32 then '配送中'\n" +
                "when 100 then '已完成/未评价'\n" +
                "when 101 then '已完成/已经评价'\n" +
                "else ' ' END status\n" +
                "FROM \n" +
                "wlyy_outpatient o\n" +
                "left JOIN wlyy_prescription p ON p.outpatient_id = o.id\n" +
                "left JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id \n" +
                "left JOIN wlyy_prescription_info i on i.prescription_id = p.id\n" +
        sql = sql + "CASE p.create_time\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tp.create_time\n" +
                "END time,\n" +
                " CASE e. NAME\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\te. NAME\n" +
                "END NAME,\n" +
                " CASE p.pay_time\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tp.pay_time\n" +
                "END pay_time,\n" +
                " CASE p.real_order\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tp.real_order\n" +
                "END realOrder,\n" +
                " CASE o.patient_name\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\to.patient_name\n" +
                "END patientName,\n" +
                " CASE i.drug_name\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\ti.drug_name\n" +
                "END infoName,\n" +
                " CASE p.create_time\n" +
                "WHEN NULL THEN\n" +
                "\t'否'\n" +
                "ELSE\n" +
                "\t'是'\n" +
                "END create_time,\n" +
                " CASE e.oneself_pickup_flg\n" +
                "WHEN 1 THEN\n" +
                "\t'自取'\n" +
                "WHEN 2 THEN\n" +
                "\t'快递配送'\n" +
                "ELSE\n" +
                "\t' '\n" +
                "END oneself_pickup_flg,\n" +
                " CASE p. STATUS\n" +
                "WHEN - 4 THEN\n" +
                "\t'已作废'\n" +
                "WHEN - 3 THEN\n" +
                "\t'支付过期取消'\n" +
                "WHEN - 2 THEN\n" +
                "\t'患者自己取消'\n" +
                "WHEN - 1 THEN\n" +
                "\t'医生取消'\n" +
                "WHEN 0 THEN\n" +
                "\t'候诊中'\n" +
                "WHEN 10 THEN\n" +
                "\t'诊断中'\n" +
                "WHEN 11 THEN\n" +
                "\t'药师审核失败 / 调整中'\n" +
                "WHEN 12 THEN\n" +
                "\t'药师审核完成'\n" +
                "WHEN 13 THEN\n" +
                "\t'开方失败/调整中'\n" +
                "WHEN 20 THEN\n" +
                "\t'诊断完成/开方成功/待支付'\n" +
                "WHEN 30 THEN\n" +
                "\t'支付成功/等待配药'\n" +
                "WHEN 31 THEN\n" +
                "\t'配药成功/等待取药'\n" +
                "WHEN 32 THEN\n" +
                "\t'配送中'\n" +
                "WHEN 100 THEN\n" +
                "\t'已完成/未评价'\n" +
                "WHEN 101 THEN\n" +
                "\t'已完成/已经评价'\n" +
                "ELSE\n" +
                "\t' '\n" +
                "END STATUS\n" +
                "FROM\n" +
                "\twlyy_outpatient o\n" +
                "LEFT JOIN wlyy_prescription p ON p.outpatient_id = o.id\n" +
                "LEFT JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id\n" +
                "LEFT JOIN wlyy_prescription_info i ON i.prescription_id = p.id\n" +
                "WHERE\n" +
                "1=1 ";
                "\t1 = 1";
        if (StringUtils.isNotBlank(status)) {
            sql += " AND p.status in(" + status + ") ";
        }
@ -3420,16 +3475,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            int i = 1;
            String n = " ";
            for (Map<String, Object> m : ls) {
                addCell(ws, i, 0, m.get("time").toString());
                addCell(ws, i, 1, m.get("realOrder").toString());
                addCell(ws, i, 2, m.get("patientName").toString());
                addCell(ws, i, 3, m.get("name").toString());
                addCell(ws, i, 4, m.get("infoName").toString());
                addCell(ws, i, 5, (String) m.get("oneself_pickup_flg"));
                addCell(ws, i, 6, m.get("pay_time").toString());
                addCell(ws, i, 7, m.get("create_time").toString());
                addCell(ws, i, 8, (String) m.get("status"));
                addCell(ws, i, 0, m.get("time")!=null?m.get("time").toString():n);
                addCell(ws, i, 1, m.get("realOrder")!=null?m.get("realOrder").toString():n);
                addCell(ws, i, 2, m.get("patientName")!=null?m.get("patientName").toString():n);
                addCell(ws, i, 3, m.get("NAME")!=null?m.get("NAME").toString():n);
                addCell(ws, i, 4, m.get("infoName")!=null?m.get("infoName").toString():n);
                addCell(ws, i, 5, m.get("oneself_pickup_flg")!=null?m.get("oneself_pickup_flg").toString():n);
                addCell(ws, i, 6, m.get("pay_time")!=null?m.get("pay_time").toString():n);
                addCell(ws, i, 7, m.get("create_time")!=null?m.get("create_time").toString():n);
                addCell(ws, i, 8, m.get("STATUS")!=null?m.get("STATUS").toString():n);
                /*addCell(ws, i, 0, m.get("createTime").toString());
                addCell(ws, i, 1, (String) m.get("name"), "");
                addCell(ws, i, 2, (String) m.get("icd10Name"), "");
@ -3470,7 +3526,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                addCell(ws, i, 6, (String) m.get("etime"));
                addCell(ws, i, 7, (String) m.get("des"));
                addCell(ws, i, 8, (String) m.get("pay"));
                addCell(ws, i, 9, (String) m.get("status"));
                addCell(ws, i, 9, (String) m.get("STATUS"));
                i++;
            }
            wwb.write();

+ 117 - 22
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -2043,26 +2043,121 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    public MixEnvelop pushYktCardCharge(String startTime, String endTime, String orderNo, String yktOrderNo, String patientName
            , String idCard, String medicard,Integer status, Integer page, Integer pageSize,String orderType,String orderCategory){
        String sql = " SELECT\n" +
                "\tIFNULL(t.id, ' ') AS \"id\",\n" +
                "\tIFNULL(t.patient, ' ') AS \"patient\",\n" +
                "\tIFNULL(t.patient_name, ' ') AS \"patientName\",\n" +
                "\tIFNULL(t.order_no, ' ') AS \"orderNo\",\n" +
                "\tIFNULL(t.order_type, ' ') AS \"orderType\",\n" +
                "\tIFNULL(t.relation_code, ' ') AS \"relationCode\",\n" +
                "\tIFNULL(t.relation_name, ' ') AS \"relationName\",\n" +
                "\tIFNULL(t.description, ' ') AS \"description\",\n" +
                "\tIFNULL(t.pay_type, ' ') AS \"payType\",\n" +
                "\tIFNULL(t.pay_price, ' ') AS \"payPrice\",\n" +
                "\tIFNULL(t.pay_time, ' ') AS \"payTime\",\n" +
                "\tIFNULL(t.upload_status, ' ') AS \"uploadStatus\",\n" +
                "\tIFNULL(t.create_time, ' ') AS \"createTime\",\n" +
                "\tIFNULL(t.remark, ' ') AS \"remark\",\n" +
                "\tIFNULL(t.relation_code, ' ') AS \"medicard\",\n" +
                "\tIFNULL(t.yk_order_no, ' ') AS \"ykOrderNo\",\n" +
                "\tIFNULL(t.yk_order_id, ' ') AS \"ykOrderId\",\n" +
                "\tIFNULL(b.idcard, ' ') AS \"idcard\",\n" +
                "\tIFNULL(b.mobile, ' ') AS \"mobile\",\n" +
                "\tCASE t. STATUS\n" +
                "\tCASE t.id\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.id\n" +
                "END id,\n" +
                " CASE t.patient\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.patient\n" +
                "END patient,\n" +
                " CASE t.patient_name\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.patient_name\n" +
                "END patientName,\n" +
                " CASE t.order_no\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.order_no\n" +
                "END orderNo,\n" +
                /*" CASE t.order_type\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.order_type\n" +
                "END orderType,\n" +*/
                " CASE t.relation_code\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.relation_code\n" +
                "END relationCode,\n" +
                " CASE t.relation_name\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.relation_name\n" +
                "END relationName,\n" +
                " CASE t.description\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.description\n" +
                "END description,\n" +
                " CASE t.pay_type\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.pay_type\n" +
                "END payType,\n" +
                " CASE t.pay_price\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.pay_price\n" +
                "END payPrice,\n" +
                " CASE t.pay_time\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.pay_time\n" +
                "END payTime,\n" +
                " CASE t.upload_status\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.upload_status\n" +
                "END uploadStatus,\n" +
                " CASE t.create_time\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.create_time\n" +
                "END createTime,\n" +
                " CASE t.remark\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.remark\n" +
                "END remark,\n" +
                " CASE t.relation_code\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.relation_code\n" +
                "END medicard,\n" +
                " CASE t.yk_order_no\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.yk_order_no\n" +
                "END ykOrderNo,\n" +
                " CASE t.yk_order_id\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.yk_order_id\n" +
                "END ykOrderId,\n" +
                " CASE b.idcard\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tb.idcard\n" +
                "END idcard,\n" +
                " CASE b.mobile\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tb.mobile\n" +
                "END mobile,\n" +
                " CASE t. STATUS\n" +
                "WHEN 0 THEN\n" +
                "\t'未支付'\n" +
                "WHEN 1 THEN\n" +
@ -2084,7 +2179,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                "ELSE\n" +
                "\tt. STATUS\n" +
                "END AS \"status\",\n" +
                "\tCASE t.order_category\n" +
                " CASE t.order_category\n" +
                "WHEN '2' THEN\n" +
                "\t'2'\n" +
                "WHEN '3' THEN\n" +
@ -2093,7 +2188,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                "\t' '\n" +
                "ELSE\n" +
                "\tt.order_category\n" +
                "END AS \"orderCategory\"\n" +
                "END orderCategory\n" +
                "FROM\n" +
                "\tbase_business_order_pay t\n" +
                "LEFT JOIN base_patient b ON t.patient = b.id\n" +

+ 76 - 26
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -4505,32 +4505,82 @@ public class ImService {
        }
        String pushSql = "";
        pushSql = "select \n" +
                "IFNULL(a.patient_name,' ') AS pname,\n" +
                "IFNULL(a.doctor_name,' ') as dname,\n" +
                "IFNULL(a.dept_name,' ') as dept,\n" +
                "CASE a.outpatient_type\n" +
                "when 1 then '在线复诊'\n" +
                "when 2 then '协同门诊'\n" +
                "when 3 then '专家咨询'\n" +
                "else ' ' end type,\n" +
                "IFNULL(a.create_time,' ') as ctime,\n" +
                "IFNULL(a.con_date,' ') as rtime,\n" +
                "IFNULL(a.end_time,' ') as etime,\n" +
                "IFNULL(a.description,' ') as des,\n" +
                "IF(b.status >= 20 ,\"是\",\"否\") AS pay,\n" +
                "CASE a.status \n" +
                "WHEN '0' THEN '全部'\n" +
                "WHEN '1' THEN '候诊中'\n" +
                "WHEN '2' THEN '就诊中'\n" +
                "when '3' then '结束'\n" +
                "ELSE '取消' end status\n" +
                "from \n" +
                "wlyy_outpatient a \n" +
                "LEFT JOIN \n" +
                "wlyy_prescription b \n" +
                "on a.patient_name = b.patient_name \n" +
                "where 1=1;";
        pushSql = "SELECT\n" +
                "\tCASE a.patient_name\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\ta.patient_name\n" +
                "END pname,\n" +
                " CASE a.doctor_name\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\ta.doctor_name\n" +
                "END dname,\n" +
                " CASE a.dept_name\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\ta.dept_name\n" +
                "END dept,\n" +
                " CASE a.outpatient_type\n" +
                "WHEN 1 THEN\n" +
                "\t'在线复诊'\n" +
                "WHEN 2 THEN\n" +
                "\t'协同门诊'\n" +
                "WHEN 3 THEN\n" +
                "\t'专家咨询'\n" +
                "ELSE\n" +
                "\t' '\n" +
                "END type,\n" +
                " CASE a.create_time\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\ta.create_time\n" +
                "END ctime,\n" +
                " CASE a.con_date\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\ta.con_date\n" +
                "END rtime,\n" +
                " CASE a.end_time\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\ta.end_time\n" +
                "END etime,\n" +
                " CASE a.description\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\ta.description\n" +
                "END des,\n" +
                " CASE b. STATUS\n" +
                "WHEN b. STATUS >= 20 THEN\n" +
                "\t'是'\n" +
                "ELSE\n" +
                "\t'否'\n" +
                "END pay,\n" +
                " CASE a. STATUS\n" +
                "WHEN '0' THEN\n" +
                "\t'全部'\n" +
                "WHEN '1' THEN\n" +
                "\t'候诊中'\n" +
                "WHEN '2' THEN\n" +
                "\t'就诊中'\n" +
                "WHEN '3' THEN\n" +
                "\t'结束'\n" +
                "ELSE\n" +
                "\t'取消'\n" +
                "END STATUS\n" +
                "FROM\n" +
                "\twlyy_outpatient a\n" +
                "LEFT JOIN wlyy_prescription b ON a.patient_name = b.patient_name\n" +
                "WHERE\n" +
                "\t1 = 1";
        List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(pushSql);

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgUserDao.java

@ -32,6 +32,7 @@ public interface BaseOrgUserDao extends PagingAndSortingRepository<BaseOrgUserDO
    @Query("select orgCode from BaseOrgUserDO where userId = ?1")
    Set<String> findorgCodeListByUserId(String userId);
    @Query("select userId from BaseOrgUserDO where userId = ?1")
    List<BaseOrgUserDO> findAllByUserId(String userId);
    @Query("select orgCode from BaseOrgUserDO where orgCode = ?1 and userId =?2")

+ 132 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java

@ -312,6 +312,138 @@ public class UnSettledHISPrescriptionService {
        }
    }
    /**
     * 查询HIS的01表中的审方状态,如果已审方,且未结算,则推送一条模板消息给患者,让医生进行接诊提醒。
     */
    public void acceptsRemind() throws Exception{
        if("xm_ykyy_wx".equals(wechatId)){
            //获取审核失败5306758
            JSONArray jsonArray = ykyyEntranceService.getNoUnsettledPrescription();
            if(jsonArray!=null&&jsonArray.size()>0) {
                for (int i = 0; i<jsonArray.size(); i++){
                    JSONObject json = jsonArray.getJSONObject(i);
                    String cfsb = json.getString("CFSB");
                    //查找对应的处方
                    String sql = "SELECT w.OUTPATIENT_ID,w.ID,w.DOCTOR,w.DOCTOR_NAME from WLYY_PRESCRIPTION w WHERE REAL_ORDER = '"+cfsb+"' and status <> 11 ORDER BY w.CREATE_TIME desc";
                    List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                    if(pre!=null && pre.size()>0){
                        String prescriptionId = pre.get(0).get("ID").toString();
                        String outpatientId=pre.get(0).get("OUTPATIENT_ID").toString();
                        String doctor = pre.get(0).get("DOCTOR").toString();
                        String doctorName = pre.get(0).get("DOCTOR_NAME").toString();
                        //修改处方状态
                        String updateSql = "update WLYY_PRESCRIPTION set status = 11,check_status=1,check_reason='处方驳回' where id = '"+prescriptionId+"'";
                        hibenateUtils.updateBySql(updateSql);
                        com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
                        msgObj.put("outpatientid",outpatientId);
                        msgObj.put("prescriptionId",prescriptionId);
                        msgObj.put("reason","处方驳回");
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
                        System.out.println("发送诊断消息开始+"+wlyyOutpatientDO.getId());
                        String immsg = imService.pushPrescriptionBackMsg(msgObj,doctor,doctorName,outpatientId,wlyyOutpatientDO.getPatient(),wlyyOutpatientDO.getOutpatientType(),wlyyOutpatientDO.getType());
                        System.out.println("发送诊断消息成功:"+immsg);
                        //发送短信提醒
                        String content = "";
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findByRealOrder(cfsb);
                        BaseDoctorDO baseDoctorDO = doctorDao.findById(doctor);
                        ykyySMSService.sendSmsByTempcode("check_failed",wlyyOutpatientDO,prescriptionDO,baseDoctorDO.getMobile());
                        logger.info("极光推送处方驳回消息");
                        prescriptionService.wxTempalteJPush("prescription_refuse",wlyyOutpatientDO,null,"","","",prescriptionDO.getId());
                    }
                }
            }
            //获取已审核未结算的处方
            JSONArray array = ykyyEntranceService.getUnsettledPrescription();
            //发送模板
            if(array!=null&&array.size()>0) {
                for (int i = 0; i<array.size(); i++){
                    JSONObject json = array.getJSONObject(i);
                    String brid = json.getString("BRID");
                    String cfsb = json.getString("CFSB");
                    //查找居民信息
                    BasePatientDO patientDO = ykyyEntranceService.findPatientByMapingCode(brid);
                    if(patientDO!=null){
                        //查找对应的处方
                        String sql = "SELECT w.OUTPATIENT_ID,w.ID,w.DOCTOR_NAME from WLYY_PRESCRIPTION w WHERE REAL_ORDER = '"+cfsb+"' ORDER BY w.CREATE_TIME desc";
                        List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                        if(pre!=null && pre.size()>0){
                            String outpatientId = pre.get(0).get("OUTPATIENT_ID").toString();
                            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
                            String prescriptionId = pre.get(0).get("ID").toString();
                            String doctorName = pre.get(0).get("DOCTOR_NAME").toString();
                            //判断是否发送过
                            String countSql = "SELECT id from WX_PUSH_LOG w WHERE w.RECEIVER = '"+patientDO.getId()
                                    +"' and w.OPENID = '"+prescriptionId+"' and w.scene = 'djsxxtz' and w.WECHAT_ID='"+wechatId+"'";
                            List<Map<String, Object>> count = hibenateUtils.createSQLQuery(countSql);
                            if(count==null || count.size() == 0){
                                List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,patientDO.getId());
                                //修改处方状态
                                String updateSql = "update WLYY_PRESCRIPTION set status = 20 where id = '"+prescriptionId+"' and status = 10";
                                hibenateUtils.updateBySql(updateSql);
                                prescriptionLogService.addPrescriptionLog(prescriptionId,20,2,"system","system","",new Date());
                                if(ps.isEmpty()){
                                    logger.info("该用户"+patientDO.getName()+"没有openid,无法推送模版消息,用户ID:"+patientDO.getId()+"wechatId:"+wechatId);
                                }else{
                                    ps.stream().forEach(one->{
                                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_unsettled_notice","djsxxtz",1);
                                        WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                                        BeanUtils.copyProperties(config,newConfig);
                                        newConfig.setFirst(config.getFirst().replace("key1",patientDO.getName()));
                                        newConfig.setUrl(config.getUrl()+""+outpatientId);
                                        newConfig.setKeyword3(doctorName);
                                        WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
                                        logger.info("=======setUrl========"+newConfig.getUrl());
                                        weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(),one.getOpenid(),newConfig);
                                    });
                                }
                                //保存发送模板记录,
                                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                                wxPushLogDO.setCreateTime(new Date());
                                wxPushLogDO.setOpenid(prescriptionId);
                                wxPushLogDO.setReceiver(patientDO.getId());
                                wxPushLogDO.setWechatId(wechatId);
                                wxPushLogDO.setReceiverName(patientDO.getName());
                                wxPushLogDO.setScene("djsxxtz");
                                wxPushLogDao.save(wxPushLogDO);
                                WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
                                wlyyPrescriptionDO.setPrescribeTime(new Date());
                                wlyyPrescriptionDO.setCheckStatus(0);
                                wlyyPrescriptionDO.setCheckReason("审核通过");
                                prescriptionDao.save(wlyyPrescriptionDO);
                                JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
                                logger.info("wlyyPrescriptionDO参数入参"+object.toJSONString());
                                WlyyPrescriptionVO prescriptionVO = JSONObject.toJavaObject(object,WlyyPrescriptionVO.class);
                                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
                                for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                                    JSONObject jsonObject = (JSONObject) JSONObject.toJSON(wlyyPrescriptionInfoDO);
                                    logger.info("wlyyPrescriptionInfoDO参数入参"+jsonObject.toJSONString());
                                    WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(jsonObject,WlyyPrescriptionInfoVO.class);
                                    wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
                                }
                                prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
                                List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                                List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = new ArrayList<>();
                                for (WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO:wlyyPrescriptionDiagnosisDOS){
                                    JSONObject jsonObject = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDiagnosisDO);
                                    logger.info("wlyyPrescriptionDiagnosisDO参数入参"+jsonObject.toJSONString());
                                    WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = JSONObject.toJavaObject(jsonObject,WlyyPrescriptionDiagnosisVO.class);
                                    wlyyPrescriptionDiagnosisVOS.add(prescriptionDiagnosisVO);
                                }
                                prescriptionVO.setDiagnosisVOs(wlyyPrescriptionDiagnosisVOS);
                                imService.pushPrescriptionImMessage(prescriptionVO);
                                ykyySMSService.sendSmsByTempcode("check_success_patient",wlyyOutpatientDO,wlyyPrescriptionDO,"");
                            }
                        }
                    }
                }
            }
        }
    }
    public void updateStatusByPayTime() throws Exception{
        if("xm_ykyy_wx".equals(wechatId)){