Browse Source

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

wangzhinan 4 years ago
parent
commit
b897660292

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

@ -533,6 +533,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            prescriptionDOs = prescriptionDao.findByOutpatientId(outpatientId);
        }
        List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>();
        List<BusinessOrderDO> businessOrders = new ArrayList<>();
        BusinessOrderDO businessOrder = new BusinessOrderDO();
        if (prescriptionDOs != null && prescriptionDOs.size() > 0) {
            convertToModels(prescriptionDOs, prescriptionVOs, WlyyPrescriptionVO.class);
            for (WlyyPrescriptionVO vo : prescriptionVOs) {
@ -560,10 +562,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO);
                    }
                }
                //支付信息
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(vo.getId());
                if (null!=businessOrderDO){
                    businessOrders.add(businessOrderDO);
                }
            }
        }
        rs.put("prescriptions", prescriptionVOs);
        rs.put("businessOrder", businessOrders);
        //物流信息
        List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByOutpatientId(outpatientId);
@ -584,7 +592,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        }
        //预约记录
        List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId);
        if (timeDOs != null && timeDOs.size() > 0) {

+ 8 - 2
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -734,7 +734,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                                WlyyPrescriptionExpressageDO wlyyPrescriptionExpressageDO = expressList.get(0);
                                if (null!=wlyyPrescriptionExpressageDO&&wlyyPrescriptionExpressageDO.getOneselfPickupFlg()==1){
                                    //同步his写入自取信息
                                    String updatesql = "update v_ms_dd01 t set t.PSFS = 0 ,t.FKZT=1 where t.JZXH = '"+wlyyPrescriptionDO.getAdmNo()+"' and t.CFSB ='"+wlyyPrescriptionDO.getRealOrder()+"'";
                                    String updatesql = "update v_ms_dd01 t set t.PSFS = 0 ,t.FKZT=1 ,t.SJR= '"+wlyyPrescriptionExpressageDO.getName()+"' ," +
                                            " t.SJRDH = '"+wlyyPrescriptionExpressageDO.getMobile()+"' ,"+
                                            " t.SJRDZ = '"+wlyyPrescriptionExpressageDO.getAddress()+"'"+
                                            " where t.JZXH = '"+wlyyPrescriptionDO.getAdmNo()+"' and t.CFSB ='"+wlyyPrescriptionDO.getRealOrder()+"'";
                                    ykyyEntranceService.updateHisStatus(updatesql);
                                    logger.info("自取写入更新his");
                                }else {
@ -752,7 +755,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                                        JSONObject json = JSONObject.parseObject(sfResult.toString());
                                        String sfOrder =  json.getString("mailNo");
                                        logger.info("---获取订单号为:"+sfOrder);
                                        String updatesql = "update v_ms_dd01 t set t.PSFS = 1 ,t.FKZT=1 ,t.KDDH ='"+sfOrder+"' where t.JZXH = '"+admNo+"' and t.CFSB ='"+realOrder+"'";
                                        String updatesql = "update v_ms_dd01 t set t.PSFS = 1 ,t.FKZT=1 ,t.KDDH ='"+sfOrder+"',t.SJR = '"+wlyyPrescriptionExpressageDO.getName()+"' ," +
                                                " t.SJRDH = '"+wlyyPrescriptionExpressageDO.getMobile()+"' ,"+
                                                " t.SJRDZ = '"+wlyyPrescriptionExpressageDO.getAddress()+"'"+
                                                " where t.JZXH = '"+admNo+"' and t.CFSB ='"+realOrder+"'";
                                        ykyyEntranceService.updateHisStatus(updatesql);
                                        logger.info("更新his成功");
                                    }

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

@ -3077,7 +3077,7 @@ public class ImService {
					"wlyy_consult_team b," +
					"base_patient d  " +
					" WHERE a.id=b.consult " +
					" AND b.patient=d.id AND b.doctor='" + doctorCode + "' AND b.type in (1,15,17) and b.status = 0 and a.pay_status=1 " +
					" AND b.patient=d.id AND b.doctor='" + doctorCode + "' AND b.type in (1,15,17) and b.status = 0 " +
					" ORDER BY a.czrq desc ";
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
		Long consultCount = 0l;

+ 115 - 2
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java

@ -507,9 +507,13 @@ public class PrescriptionStatusUpdateService {
        }
        return msgReturn;
    }
    public String  cancelAll(){
    public String  cancelAll(String day){
        logger.info("进入结束超时未接诊的门诊");
        List<WlyyOutpatientDO> timeout = outpatientDao.findAllWaitingOutpatient();
        long days = 1;
        if (StringUtils.isNotBlank(day)){
            days = Integer.parseInt(day);
        }
        String msgReurn = "";
        if (null!=timeout&&timeout.size()>0){
            logger.info("开始结束超时未接诊的门诊");
@ -519,7 +523,7 @@ public class PrescriptionStatusUpdateService {
                try {
                    long currentTime = new Date().getTime();
                    long outpatientTime = wlyyOutpatientDO.getCreateTime().getTime();
                    if (currentTime-outpatientTime>24*60*60*1000){
                    if (currentTime-outpatientTime>24*60*60*1000*days){
                        logger.info("时间满足条件");
                        String outPatientId = wlyyOutpatientDO.getId();
                        //判断医生是否接诊
@ -696,4 +700,113 @@ public class PrescriptionStatusUpdateService {
        }
        logger.info("setOutPatientOver end ");
    }
    public String  cancelAllandSendMessage(String day){
        logger.info("进入结束超时未接诊的门诊");
        List<WlyyOutpatientDO> timeout = outpatientDao.findAllWaitingOutpatient();
        long days = 1;
        if (StringUtils.isNotBlank(day)){
            days = Integer.parseInt(day);
        }
        String msgReurn = "";
        if (null!=timeout&&timeout.size()>0){
            logger.info("开始结束超时未接诊的门诊");
            String cancelValue = "超时订单系统自动取消";
            String cancelRemark = "当天未接诊的门诊订单自动取消";
            for(WlyyOutpatientDO wlyyOutpatientDO:timeout){
                try {
                    long currentTime = new Date().getTime();
                    long outpatientTime = wlyyOutpatientDO.getCreateTime().getTime();
                    if (currentTime-outpatientTime>24*60*60*1000*days){
                        logger.info("时间满足条件");
                        String outPatientId = wlyyOutpatientDO.getId();
                        //判断医生是否接诊
                        List<WlyyHospitalWaitingRoomDO> roomDOs = hospitalWaitingRoomDao.findByOutpatientId(outPatientId);
                        if (roomDOs != null && roomDOs.size() > 0) {
                            for (WlyyHospitalWaitingRoomDO roomDO : roomDOs) {
                                if (roomDO.getVisitStatus() == 2) {
                                    logger.info("id为:"+outPatientId+"的门诊已被医生接诊");
                                } else {
                                    roomDO.setVisitStatus(-1);
                                    logger.info("修改候诊室状态,将候诊病人移除候诊室");
                                    hospitalWaitingRoomDao.save(roomDO);
                                }
                            }
                        }
                        //更改门诊状态
                        wlyyOutpatientDO.setStatus("-1");
                        String description = null;
                        wlyyOutpatientDO.setDoctorCancelRemark(cancelRemark);
                        wlyyOutpatientDO.setDoctorCancelType("6");
                        wlyyOutpatientDO.setDoctorCancelValue(cancelValue);
                        wlyyOutpatientDO.setEndTime(new Date());
                        wlyyOutpatientDO.setOperator("system");
                        description = cancelValue;
                        //系统消息
                        SystemMessageDO messageDO = new SystemMessageDO();
                        messageDO.setTitle("超时订单系统自动取消");
                        messageDO.setType("13");
                        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();
                        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 + "。";
                            //prescriptionService.sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "systemCancelRemind", cancelRemark);
                        }
                        if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                            data.put("type", "16");
                            msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频复诊已被系统取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                            // prescriptionService.sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "systemCancelRemind", cancelRemark);
                        }
                        data.put("msg", msg);
                        messageDO.setData(data.toString());
                        systemMessageService.saveMessage(messageDO);
                        //推送消息到眼科通
                        BasePatientDO patient = basePatientDao.findById(wlyyOutpatientDO.getPatient());
                        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                            logger.info("推送消息到眼科通");
                            ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString());
                        }
                        logger.info("修改保存的门诊记录:"+wlyyOutpatientDO.getId());
                        //删除门诊号源
                        List<WlyyPatientRegisterTimeDO> list = patientRegisterTimeDao.findByOutpatientId(wlyyOutpatientDO.getId());
                        if (list != null && list.size() > 0) {
                            patientRegisterTimeDao.delete(list);
                        }
                        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
                        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
                            businessOrderService.orderRefund(wechatId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                            //眼科接诊时更新眼科通状态
                            if (businessOrderDO!=null){
                                ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"2");
                            }
                        } else if (wechatId.equalsIgnoreCase("xm_zsyy_wx")) {
        /*
                            businessOrderService.ylzOrderRefund(wechatId, wlyyOutpatientDO.getPatient(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
        */
                        }
                        outpatientDao.save(wlyyOutpatientDO);
                        logger.info(wlyyOutpatientDO.getId()+"的门诊记录设置为取消");
                        msgReurn="success";
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    logger.info(wlyyOutpatientDO.getId()+"的门诊记录取消失败");
                    msgReurn="faild";
                }
            }
        }
        return msgReurn;
    }
}

+ 2 - 2
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/TimeoutOverDueJob.java

@ -22,9 +22,9 @@ import java.util.Date;
@EnableScheduling
public class TimeoutOverDueJob implements SchedulingConfigurer {
    private static final Logger logger = LoggerFactory.getLogger(TimeoutOverDueJob.class);
    private static String cron = "0 */5 * * * ?";
    private static String cron = "0 */10 * * * ?";//0 0 0 * * ?
    public TimeoutOverDueJob(){
        cron="0 */5 * * * ?";
        cron="0 */10 * * * ?";
        System.out.println("TimeoutOverDueJob初始化时的corn"+cron);
    }
    @Autowired

+ 8 - 2
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -645,12 +645,12 @@ public class JobController extends BaseController {
    }
    @RequestMapping(value = "cancelSinglePre", method = RequestMethod.GET)
    @ApiOperation("取消未接诊")
    public String cancelSinglePre(String outpatientId){
    public String cancelSinglePre(String outpatientId,String day){
        if (StringUtils.isNotBlank(outpatientId)){
            System.out.println(outpatientId);
            return prescriptionStatusUpdateService.singelCancel(outpatientId);
        }else {
            return prescriptionStatusUpdateService.cancelAll();
            return prescriptionStatusUpdateService.cancelAll(day);
        }
    }
    @RequestMapping(value = "overRecivePre", method = RequestMethod.GET)
@ -663,5 +663,11 @@ public class JobController extends BaseController {
            prescriptionStatusUpdateService.cancelRecieve();
        }
    }
    @RequestMapping(value = "cancelSinglePreByday", method = RequestMethod.GET)
    @ApiOperation("按天取消未接诊")
    public String cancelSinglePreSendMessage(String day){
        return prescriptionStatusUpdateService.cancelAllandSendMessage(day);
    }
}

+ 4 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -989,7 +989,10 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                    JSONObject json = JSONObject.parseObject(sfResult.toString());
                    String sfOrder =  json.getString("mailNo");
                    logger.info("---获取订单号为:"+sfOrder);
                    String updatesql = "update v_ms_dd01 t set t.FKZT=1,t.PSFS = 1 ,t.KDDH ='"+sfOrder+"' where t.JZXH = '"+admNo+"' and t.CFSB ='"+realOrder+"'";
                    String updatesql = "update v_ms_dd01 t set t.PSFS = 1 ,t.FKZT=1 ,t.KDDH ='"+sfOrder+"',t.SJR = '"+wlyyPrescriptionExpressageDO.getName()+"' ," +
                            " t.SJRDH = '"+wlyyPrescriptionExpressageDO.getMobile()+"' ,"+
                            " t.SJRDZ = '"+wlyyPrescriptionExpressageDO.getAddress()+"'"+
                            " where t.JZXH = '"+admNo+"' and t.CFSB ='"+realOrder+"'";
                    ykyyEntranceService.updateHisStatus(updatesql);
                    logger.info("更新his成功");
                }