Jelajahi Sumber

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

chenweida 7 tahun lalu
induk
melakukan
1013db3677

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDao.java

@ -24,4 +24,8 @@ public interface PrescriptionDao extends PagingAndSortingRepository<Prescription
    @Query(value = "select p.prescription_code from wlyy_prescription_pay p LEFT JOIN  wlyy_prescription a on a.code = p.prescription_code where p.trade_status = 1 and a.jw_pay_status = 0",nativeQuery = true)
    List<String> findCodesByPayStautsAndExecuteSickStatus();
    @Modifying
    @Query("update Prescription p set p.jwPayStatus=1 where p.code=?1")
    void updatejwPayStatus(String prescriptionCode);
}

+ 2 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -131,9 +131,9 @@ public class PrescriptionService extends BaseService {
                    message.setRead(1);//设置未读
                    message.setOver("1");
                    message.setReceiver(expressage.getExpressageCode());
                    message.setSender(prescription.getPatient());
                    message.setSender("system");
                    message.setCode(getCode());
                    message.setSenderName(prescription.getPatientName());
                    message.setSenderName("系统");
                    message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
                    message.setContent("您有一条新的续方订单待取药!");
                    message.setType(7);//续方订单待取药

+ 13 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -156,6 +156,7 @@ public class JwPrescriptionService {
        return response;
    }
    /**
     * 院内结算确认接口
     * @param prescriptionCode 处方CODE
@ -167,6 +168,18 @@ public class JwPrescriptionService {
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
        String response = httpClientUtil.post(url, params, "UTF-8");
        if(StringUtils.isNotBlank(response)){
            JSONObject reobj =  JSON.parseObject(response);
            Integer status = reobj.getInteger("status");
            String errmsg = reobj.getString("msg");
            if(-1 == status){
                throw new Exception("基卫接口(院内结算确认接口)请求失败,"+errmsg);
            }else{
                prescriptionDao.updatejwPayStatus(prescriptionCode);
            }
        }else{
            throw new Exception("基卫接口(院内结算确认接口)请求失败,无数据返回!");
        }
        return response;
    }

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDao.java

@ -30,4 +30,8 @@ public interface PrescriptionDao extends PagingAndSortingRepository<Prescription
    @Query("from Prescription p where p.visitNo=?1 and p.recipeNo=?2 ")
    Prescription findByVisitNoAndRecipeNo(String visitNo,String recipeNo);
    @Modifying
    @Query("update Prescription p set p.jwPayStatus=1 where p.code=?1")
    void updatejwPayStatus(String prescriptionCode);
}

+ 5 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -541,9 +541,11 @@ public class PatientPrescriptionPayService extends BaseService {
                            messageDao.save(message);
                        }
                        //支付成功发起结算
                        LOGGER.debug("=================> start exexuteSickSettle");
                        jwPrescriptionService.executeSickSettle(prescriptionCode);
                        LOGGER.debug("=================> end exexuteSickSettle");
                        try {
                            jwPrescriptionService.executeSickSettle(prescriptionCode);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else if ("1".equals(tradeStatus) || "FAIL".equals(tradeStatus)) {
                        prescriptionPay.setTradeStatus("0");//交易状态 成功1 失败0
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_error.getValue());////续费状态 30支付成功 21支付失败

+ 5 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -259,11 +259,12 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            throw new Exception("编码已使用!");
        } else if (status == -3) {
            throw new Exception("编码类型错误!");
        } else if (status == -4) {
            throw new Exception("未到达服务站!");
        } else if (status == -5) {
            throw new Exception("不可配送!");
        }
//        else if (status == -4) {
//            throw new Exception("未到达服务站!");
//        } else if (status == -5) {
//            throw new Exception("不可配送!");
//        }
        return prescriptionDispensaryCode;
    }

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

@ -171,20 +171,20 @@ public class PrescriptionExpressageService {
        //修改处方状态为完成
        Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        if(prescription.getStatus()<=65){
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            prescriptionLog.setCreateTime(new Date());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
            prescriptionLog.setRemark("该状态不可取药");
            prescriptionLogDao.save(prescriptionLog);
            return -4;
        }
//        if(prescription.getStatus()<=65){
//            PrescriptionLog prescriptionLog = new PrescriptionLog();
//            prescriptionLog.setCode(UUID.randomUUID().toString());
//            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
//            prescriptionLog.setCreateTime(new Date());
//            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
//            prescriptionLog.setFlag(1);
//            prescriptionLog.setUserCode(userCode);
//            prescriptionLog.setUserType(2);
//            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
//            prescriptionLog.setRemark("该状态不可取药");
//            prescriptionLogDao.save(prescriptionLog);
//            return -4;
//        }
        Date finshTime = new Date();
        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        prescription.setFinishTime(finshTime);
@ -226,20 +226,20 @@ public class PrescriptionExpressageService {
        Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        if(prescription.getStatus()<=50){
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            prescriptionLog.setCreateTime(new Date());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
            prescriptionLog.setRemark("该状态不可配送");
            prescriptionLogDao.save(prescriptionLog);
            return -5;
        }
//        if(prescription.getStatus()<=50){
//            PrescriptionLog prescriptionLog = new PrescriptionLog();
//            prescriptionLog.setCode(UUID.randomUUID().toString());
//            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
//            prescriptionLog.setCreateTime(new Date());
//            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
//            prescriptionLog.setFlag(1);
//            prescriptionLog.setUserCode(userCode);
//            prescriptionLog.setUserType(2);
//            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
//            prescriptionLog.setRemark("该状态不可配送");
//            prescriptionLogDao.save(prescriptionLog);
//            return -5;
//        }
        //修改处方状态为配送中
        Date expressageing = new Date();
        prescription.setExpressageTime(expressageing);
@ -273,7 +273,7 @@ public class PrescriptionExpressageService {
                "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName();
        prescriptionNoticesService.sendMessages(userCode, doctor.getName(), DateUtil.dateToStrLong(expressageing), 3, 0, url);
        prescriptionNoticesService.sendMessages(patient.getCode(), doctor.getName(), DateUtil.dateToStrLong(expressageing), 3, 0, url);
        return prescriptionDispensaryCode.getType();
    }

+ 13 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -167,6 +167,19 @@ public class JwPrescriptionService {
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
        String response = httpClientUtil.post(url, params, "UTF-8");
        if(StringUtils.isNotBlank(response)){
            JSONObject reobj =  JSON.parseObject(response);
            Integer status = reobj.getInteger("status");
            String errmsg = reobj.getString("msg");
            if(-1 == status){
                throw new Exception("基卫接口(院内结算确认接口)请求失败,"+errmsg);
            }else{
                prescriptionDao.updatejwPayStatus(prescriptionCode);
            }
        }else{
            throw new Exception("基卫接口(院内结算确认接口)请求失败,无数据返回!");
        }
        return response;
    }