Преглед на файлове

修复长处方续方,快递配送的 BUG

huangwenjie преди 7 години
родител
ревизия
a1c2c4ca00

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

@ -404,12 +404,12 @@ public class Prescription extends IdEntity {
         wait_pay("开方完成/待支付", 20),
         pay_error("支付失败", 21),
         pay_success("支付成功/待配药", 30),
         wait_expressage("配药成功/待配送", 40),
         expressageing_error("配送失败", 41),
         expressageJGS("分配健管师", 42),
         expressageing("配送中", 45),
         pay_success("支付成功/待配药", 50),
         expressage2hospital("配送到服务站", 49),
         finish("配送到患者手中/已完成", 100);
         */

+ 48 - 35
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -341,7 +341,13 @@ public class PrescriptionService extends ZysoftBaseService{
                Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(orderNo,recipeNo);
                if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue())){
                    prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                    
                    if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
                    } else{
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                    }
                    
                    prescription.setDrugDeliveryTime(new Date());
                    prescriptionDao.save(prescription);
@ -356,44 +362,51 @@ public class PrescriptionService extends ZysoftBaseService{
                    log.setHospitalName(prescription.getHospitalName());
                    log.setUserName(prescription.getDoctorName());
                    log.setFlag(1);
                    log.setRemark("配药成功");
                    log.setUserCode(prescription.getDoctor());
                    log.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                    prescriptionLogDao.save(log);
                    //健管师配送
                    PrescriptionExpressage expressage = prescriptionExpressageDao.findByPrescriptionCode(prescription.getCode());
                    if(StringUtils.isNotBlank(expressage.getExpressageCode())){
                        Message message = new Message();
                        message.setCzrq(new Date());
                        message.setCreateTime(new Date());
                        message.setRead(1);//设置未读
                        message.setOver("1");
                        message.setReceiver(expressage.getExpressageCode());
                        message.setSender("system");
                        message.setCode(getCode());
                        message.setSenderName("系统");
                        message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
                        message.setContent("您有一条新的续方订单待取药!");
                        message.setType(7);//续方订单待取药
                        message.setReadonly(1);//是否只读消息
                        message.setDel("1");
                        message.setRelationCode(prescription.getCode());
                        message.setPrescriptionStatus("0");//待取药
                        message.setData(prescription.getAdminTeamId()+"");
                        messageDao.save(message);
                    }
                    //判断提示健管师有续方代配送,居民待取药
                    JSONObject message = new JSONObject();
                    message.put("title","dispensingComplete");
                    message.put("state",1);
                    message.put("prescription",prescription.getCode());
                    message.put("mes","success");
                    if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
                        log.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
                        log.setRemark("快递配送:配药成功,配送中");
                        prescriptionLogDao.save(log);
                    } else{
                        log.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                        log.setRemark("配药成功");
                        prescriptionLogDao.save(log);
    
                        //健管师配送
                        PrescriptionExpressage expressage = prescriptionExpressageDao.findByPrescriptionCode(prescription.getCode());
                        if(StringUtils.isNotBlank(expressage.getExpressageCode())){
                            Message message = new Message();
                            message.setCzrq(new Date());
                            message.setCreateTime(new Date());
                            message.setRead(1);//设置未读
                            message.setOver("1");
                            message.setReceiver(expressage.getExpressageCode());
                            message.setSender("system");
                            message.setCode(getCode());
                            message.setSenderName("系统");
                            message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
                            message.setContent("您有一条新的续方订单待取药!");
                            message.setType(7);//续方订单待取药
                            message.setReadonly(1);//是否只读消息
                            message.setDel("1");
                            message.setRelationCode(prescription.getCode());
                            message.setPrescriptionStatus("0");//待取药
                            message.setData(prescription.getAdminTeamId()+"");
                            messageDao.save(message);
                        }
    
                        //判断提示健管师有续方代配送,居民待取药
                        JSONObject message = new JSONObject();
                        message.put("title","dispensingComplete");
                        message.put("state",1);
                        message.put("prescription",prescription.getCode());
                        message.put("mes","success");
//                redisTemplate.convertAndSend(channelTopic,message.toString());
//                redisTemplate.watch(channelTopic);
                    redisTemplate.opsForList().leftPush(channelTopic,message.toString());
                        redisTemplate.opsForList().leftPush(channelTopic,message.toString());
//                redisTemplate.unwatch();
                    }
                }else {
                    error = "code:"+prescription.getCode()+",status:"+prescription.getStatus();
                }

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionExpressageDao.java

@ -16,7 +16,7 @@ public interface PrescriptionExpressageDao extends PagingAndSortingRepository<Pr
    @Query("from PrescriptionExpressage p where p.prescriptionCode=?1")
    PrescriptionExpressage findByPrescriptionPay(String prescriptionCode);
    @Query(value = "select p.* FROM wlyy_prescription_expressage p LEFT JOIN wlyy_prescription a on a.code = p.prescription_code where a.status = 30 and p.mobile is null",nativeQuery = true)
    @Query(value = "select p.* FROM wlyy_prescription_expressage p LEFT JOIN wlyy_prescription a on a.code = p.prescription_code where a.status >= 50 and p.mobile is null",nativeQuery = true)
    List<PrescriptionExpressage> findByPrescriptionPaidExpressOrderFail();
    @Query("from PrescriptionExpressage p where p.mailno=?1")

+ 9 - 11
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -42,26 +42,24 @@ public class PrescriptionExpressageService {
    /**
     * 1,保存快递单号增
     * 2,加处方物流记录为配送
     * 3,修改处方状态为配送配送中
     *
     * @param prescriptionExpressage
     * @throws Exception
     */
    public void updatePrescriptionExpressage(PrescriptionExpressage prescriptionExpressage) throws Exception {
        //修改处方状态为配送配送中
        prescriptionDao.updateStatus(prescriptionExpressage.getPrescriptionCode(),65);
//        prescriptionDao.updateStatus(prescriptionExpressage.getPrescriptionCode(),65);
        //保存处方物流记录
        prescriptionExpressageDao.save(prescriptionExpressage);
        //保存配送日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        prescriptionLog.setPrescriptionCode(prescriptionExpressage.getPrescriptionCode());
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.sf.getValue());
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setFlag(1);
        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        prescriptionLogDao.save(prescriptionLog);
//        PrescriptionLog prescriptionLog = new PrescriptionLog();
//        prescriptionLog.setPrescriptionCode(prescriptionExpressage.getPrescriptionCode());
//        prescriptionLog.setCode(UUID.randomUUID().toString());
//        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.sf.getValue());
//        prescriptionLog.setCreateTime(new Date());
//        prescriptionLog.setFlag(1);
//        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
//        prescriptionLogDao.save(prescriptionLog);
    }
}