Jelajahi Sumber

Merge branch 'dev' of suhaiwen/wlyy2.0 into dev

wangzhinan 4 tahun lalu
induk
melakukan
3d29cbd190

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

@ -3233,6 +3233,45 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyOutpatientDO.setDoctorCancelType(cancelType);
            wlyyOutpatientDO.setDoctorCancelValue(cancelValue);
            description = "医生拒绝接诊";
            //系统消息 医生取消复诊
            SystemMessageDO messageDO = new SystemMessageDO();
            messageDO.setTitle("医生取消复诊");
            messageDO.setType("12");
            messageDO.setSender(wlyyOutpatientDO.getDoctor());
            messageDO.setSenderName(wlyyOutpatientDO.getDoctorName());
            messageDO.setRelationCode(wlyyOutpatientDO.getId());
            messageDO.setReceiver(wlyyOutpatientDO.getPatient());
            messageDO.setReceiverName(wlyyOutpatientDO.getPatientName());
            net.sf.json.JSONObject data = new net.sf.json.JSONObject();
            try {
                data.put("name",wlyyOutpatientDO.getPatientName());
                data.put("age",IdCardUtil.getAgeForIdcard(wlyyOutpatientDO.getIdcard()));
                data.put("gender",IdCardUtil.getSexForIdcard(wlyyOutpatientDO.getIdcard()));
                data.put("question",wlyyOutpatientDO.getIcd10Name());
                String msg="";
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    data.put("type","9");
                   msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个图文复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
                }
                if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    data.put("type","16");
                    msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个视频复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
                }
                data.put("msg",msg);
                messageDO.setData(data.toString());
                systemMessageService.saveMessage(messageDO);
            } catch (Exception e) {
                e.printStackTrace();
            }
            //推送消息到眼科通
            BasePatientDO patient = basePatientDao.findById(wlyyOutpatientDO.getPatient());
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                ykyyService.pushNotificationToYktPatient(patient.getYktId(),messageDO.getTitle(),data.get("msg").toString());
            }
        }
        outpatientDao.save(wlyyOutpatientDO);
@ -3734,7 +3773,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " d.outpatient_type AS \"outpatientType\"," +
                " a.total AS \"consultTotal\"," +
                " h.org_name AS \"orgName\"," +
                " h.org_code AS \"orgCode\"" +
                " h.org_code AS \"orgCode\"," +
                " follow.id AS followid "+
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id "+
@ -3746,6 +3786,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if ("0".equalsIgnoreCase(isAttention)) {
            sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient !='" + patientid + "' ";
        }
        if (StringUtils.isEmpty(isAttention)){
            sql+=" LEFT  JOIN base_doctor_patient_follow follow ON follow.patient='"+patientid+"' AND follow.doctor = d.id ";
        }
        if(StringUtils.isNotBlank(diseaseKey)){
            sql+=" left join wlyy_doctor_special_disease sp on d.id = sp.doctor_code ";
        }

+ 12 - 9
svr/svr-base/src/main/java/com/yihu/jw/base/service/sync/BaseSyncDataService.java

@ -70,18 +70,13 @@ public class BaseSyncDataService extends BaseJpaService<BaseSyncDataDO, BaseSync
        StringBuffer sql= new StringBuffer("SELECT c.* FROM wlyy_data_sync c WHERE 1=1 ");
        StringBuffer sqlCount= new StringBuffer();
        List<BaseSyncDataDO> list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            sqlCount.append("SELECT COUNT(c.\"id\") AS count FROM wlyy_data_sync c WHERE 1=1  ");
        }else {
            sqlCount.append("SELECT COUNT(c.id) AS count FROM wlyy_data_sync c WHERE 1=1  ");
        }
//            AND  c."complete_time" BETWEEN to_date('2020-05-06 00:00:00','yyyy-mm-dd hh24:mi:ss') AND to_date('2020-08-06 00:00:00','yyyy-mm-dd hh24:mi:ss')
            sql.append("  AND  c.\"complete_time\" BETWEEN to_date('").append(startTime).append("00:00:00','yyyy-mm-dd hh24:mi:ss')  AND to_date('").append(endTime).append("23:59:59','yyyy-mm-dd hh24:mi:ss')");
            sqlCount.append("  AND  c.\"complete_time\" BETWEEN to_date('").append(startTime).append("00:00:00','yyyy-mm-dd hh24:mi:ss')  AND to_date('").append(endTime).append("23:59:59','yyyy-mm-dd hh24:mi:ss')");
        if (StringUtils.isNotBlank(startTime)&&StringUtils.isNotBlank(endTime)){
            sql.append(" and c.complete_time BETWEEN ").append("'").append(startTime).append("'").append(" AND ").append("'").append(endTime).append("'");
            sqlCount.append(" and c.complete_time BETWEEN ").append("'").append(startTime).append("'").append(" AND ").append("'").append(endTime).append("'");
        }
        List<BaseSyncDataDO> list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            String oracleSql="SELECT\n" +
                    "\t*\n" +
                    "FROM\n" +
@ -101,11 +96,19 @@ public class BaseSyncDataService extends BaseJpaService<BaseSyncDataDO, BaseSync
            logger.info("oracleSql="+oracleSql);
            list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper<>(BaseSyncDataDO.class));
        }else {
            sqlCount.append("SELECT COUNT(c.id) AS count FROM wlyy_data_sync c WHERE 1=1  ");
            if (StringUtils.isNotBlank(startTime)&&StringUtils.isNotBlank(endTime)){
                sql.append(" and c.complete_time BETWEEN ").append("'").append(startTime).append("'").append(" AND ").append("'").append(endTime).append("'");
                sqlCount.append(" and c.complete_time BETWEEN ").append("'").append(startTime).append("'").append(" AND ").append("'").append(endTime).append("'");
            }
            sql.append(" ORDER BY c.create_time DESC LIMIT ").append((page-1)*size).append(",").append(size);
            logger.info("sql="+sql);
            list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(BaseSyncDataDO.class));
        }
        logger.info("sqlCount="+sqlCount);
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sqlCount.toString());