wangjun %!s(int64=3) %!d(string=hai) anos
pai
achega
16784437c5

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

@ -17,8 +17,8 @@ public interface BaseNatAppointmentDao extends PagingAndSortingRepository<BaseNa
    List<BaseNatAppointmentDO> findPayStatusByPatientId(String patientId);
    @Query("from BaseNatAppointmentDO t where t.payStatus = 1 or t.payStatus = 0 and t.isSuccess=1 and t.patientId=?1")
    List<BaseNatAppointmentDO> findPayStatusByPatientIdTASY(String patientId);
    @Query("from BaseNatAppointmentDO t where t.patientId=?1 and t.payStatus in (0,1) and t.isSuccess=1 ")
    List<BaseNatAppointmentDO> findByTasy(String patientId);
    @Query("select a from BaseNatAppointmentDO a where  a.realOrder =?1 ")

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

@ -11777,7 +11777,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                baseNatAppointmentDO.setCardNo(cardNo);
                baseNatAppointmentDO.setCardType(cardType);
                baseNatAppointmentDO.setAddress(address);
                baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                //baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                //baseNatAppointmentDO.setOderNum(orderNum);
                baseNatAppointmentDO.setCityName(cityName);
                baseNatAppointmentDO.setFirstJobCode(firstJobCode);
@ -11805,6 +11805,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                baseNatAppointmentDO.setDoctorId(staffNo);
                baseNatAppointmentDO.setConsumer(consumer);
                baseNatAppointmentDO.setDoctorName(staffName);
                baseNatAppointmentDO.setAppointmentTime(new Date());
                baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
                logger.info("BaseNatAppointmentDO保存结束"+baseNatAppointmentDO.getId());
                //添加订单
@ -12065,9 +12066,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "t.id as \"id\"," +
                "t.card_no_type as \"cardNoType\"," +
                "t.HOSPITAL_FLAG as \"hospitalFlag\"," +
                "t.charge_amount as \"chargeAmount\"," +
                "t.appointment_time as \"appointmentTime\" " +
                " from base_nat_appointment t where 1=1 ";
                "t.charge_amount as \"chargeAmount\"," ;
        if ("xm_tasy_wx".equalsIgnoreCase(wechatId)){
            sql+=" date_format(t.appointment_time ,'%Y-%m-%d' ) as \"appointmentTime\" ";
        }else {
            sql+=" t.appointment_time as \"appointmentTime\"";
        }
        sql+=  " from base_nat_appointment t where 1=1 ";
        if (StringUtils.isNoneBlank(patientId)){
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                sql+=" and t.consumer ='"+patientId+"'";

+ 96 - 25
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/TasyNatService.java

@ -618,7 +618,7 @@ public class TasyNatService {
            key1.put("color",wxTemplateConfigDO1.getKeyword6());
            key2.put("value",baseNatAppointmentD0.getInspectionName());
            key2.put("color",wxTemplateConfigDO1.getKeyword6());
            key3.put("value",DateUtil.formatDate(baseNatAppointmentD0.getAppointmentTime(),"yyyy-MM-dd HH:mm:ss"));
            key3.put("value",wxTemplateConfigDO1.getKeyword3());//DateUtil.formatDate(baseNatAppointmentD0.getAppointmentTime(),"yyyy-MM-dd")
            key3.put("color",wxTemplateConfigDO1.getKeyword6());
            key4.put("value",wxTemplateConfigDO1.getKeyword4());
            key4.put("color",wxTemplateConfigDO1.getKeyword6());
@ -804,37 +804,108 @@ public class TasyNatService {
    }
    public void savePayStatusByHis(String patientId) throws Exception {
        List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientIdTASY(patientId);
        List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findByTasy(patientId);
        for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
            System.out.println("baseNatAppointmentDO==="+baseNatAppointmentDO.getName());
                String res = QueryApplyInfo(baseNatAppointmentDO.getRealOrder());
                JSONObject jsonObject = JSON.parseObject(res);
                if (jsonObject!=null){
                    if (jsonObject.getString("ReturnCode").equalsIgnoreCase("1")){
                        String voucherNo = jsonObject.getString("ApplyNo");
                        baseNatAppointmentDO.setVoucherNo(voucherNo);
                        if ("已扣费".equalsIgnoreCase(jsonObject.getString("Status"))){
                            baseNatAppointmentDO.setPayStatus("1");
                            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                            if (businessOrderDO!=null){
                                businessOrderDO.setStatus(1);
                                businessOrderDao.save(businessOrderDO);
                            }
                        }else if ("已退费".equalsIgnoreCase(jsonObject.getString("Status"))){
                            logger.info("进入退费订单同步");
                            baseNatAppointmentDO.setPayStatus("-1");
                            baseNatAppointmentDO.setIsSuccess("-1");
                            baseNatAppointmentDO.setCancelReson("患者本人线下取消");
                            baseNatAppointmentDO.setCancelTime(new Date());
                            baseNatAppointmentDO.setCancelBy(patientId);
                            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                            if (businessOrderDO!=null){
                                businessOrderDO.setStatus(-1);
                                businessOrderDao.save(businessOrderDO);
                        String applyinfo = jsonObject.getString("applyinfo");
                        if (StringUtils.isNoneBlank(applyinfo)){
                            if (applyinfo.contains("[")){
                                JSONArray jsonArray = JSON.parseArray(applyinfo);
                                if (jsonArray!=null&&jsonArray.size()>0) {
                                    if (StringUtils.isNoneBlank(baseNatAppointmentDO.getVoucherNo())) {
                                        for (int i = 0; i < jsonArray.size(); i++) {
                                            JSONObject child = jsonArray.getJSONObject(i);
                                            System.out.println("数组" + child.getString("ApplyNo"));
                                            if (child.getString("ApplyNo").equalsIgnoreCase(baseNatAppointmentDO.getVoucherNo())) {
                                                if ("已扣费".equalsIgnoreCase(child.getString("Status"))) {
                                                    baseNatAppointmentDO.setPayStatus("1");
                                                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                                                    if (businessOrderDO != null) {
                                                        businessOrderDO.setStatus(1);
                                                        businessOrderDao.save(businessOrderDO);
                                                    }
                                                } else if ("已退费".equalsIgnoreCase(child.getString("Status"))) {
                                                    logger.info("进入退费订单同步");
                                                    baseNatAppointmentDO.setPayStatus("-1");
                                                    baseNatAppointmentDO.setIsSuccess("-1");
                                                    baseNatAppointmentDO.setCancelReson("患者本人线下取消");
                                                    baseNatAppointmentDO.setCancelTime(new Date());
                                                    baseNatAppointmentDO.setCancelBy(patientId);
                                                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                                                    if (businessOrderDO != null) {
                                                        businessOrderDO.setStatus(-1);
                                                        businessOrderDao.save(businessOrderDO);
                                                    }
                                                    //取消号源
                                                    //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                                                }
                                                baseNatAppointmentDao.save(baseNatAppointmentDO);
                                            }
                                        }
                                    }else {
                                        JSONObject child = jsonArray.getJSONObject(jsonArray.size()-1);
                                        System.out.println("数组" + child.getString("ApplyNo"));
                                        if (child.getString("ApplyNo").equalsIgnoreCase(baseNatAppointmentDO.getVoucherNo())) {
                                            if ("已扣费".equalsIgnoreCase(child.getString("Status"))) {
                                                baseNatAppointmentDO.setPayStatus("1");
                                                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                                                if (businessOrderDO != null) {
                                                    businessOrderDO.setStatus(1);
                                                    businessOrderDao.save(businessOrderDO);
                                                }
                                            } else if ("已退费".equalsIgnoreCase(child.getString("Status"))) {
                                                logger.info("进入退费订单同步");
                                                baseNatAppointmentDO.setPayStatus("-1");
                                                baseNatAppointmentDO.setIsSuccess("-1");
                                                baseNatAppointmentDO.setCancelReson("患者本人线下取消");
                                                baseNatAppointmentDO.setCancelTime(new Date());
                                                baseNatAppointmentDO.setCancelBy(patientId);
                                                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                                                if (businessOrderDO != null) {
                                                    businessOrderDO.setStatus(-1);
                                                    businessOrderDao.save(businessOrderDO);
                                                }
                                                //取消号源
                                                //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                                            }
                                            baseNatAppointmentDO.setVoucherNo(child.getString("ApplyNo"));
                                            baseNatAppointmentDao.save(baseNatAppointmentDO);
                                        }
                                    }
                                }
                            }else {
                                JSONObject jsonObject1 = JSONObject.parseObject(applyinfo);
                                System.out.println("单条"+jsonObject1.getString("ApplyNo"));
                                if ("已扣费".equalsIgnoreCase(jsonObject1.getString("Status"))){
                                    baseNatAppointmentDO.setPayStatus("1");
                                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                                    if (businessOrderDO!=null){
                                        businessOrderDO.setStatus(1);
                                        businessOrderDao.save(businessOrderDO);
                                    }
                                }else if ("已退费".equalsIgnoreCase(jsonObject1.getString("Status"))){
                                    logger.info("进入退费订单同步");
                                    baseNatAppointmentDO.setPayStatus("-1");
                                    baseNatAppointmentDO.setIsSuccess("-1");
                                    baseNatAppointmentDO.setCancelReson("患者本人线下取消");
                                    baseNatAppointmentDO.setCancelTime(new Date());
                                    baseNatAppointmentDO.setCancelBy(patientId);
                                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                                    if (businessOrderDO!=null){
                                        businessOrderDO.setStatus(-1);
                                        businessOrderDao.save(businessOrderDO);
                                    }
                                    //取消号源
                                    //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                                }
                                baseNatAppointmentDO.setVoucherNo(jsonObject1.getString("ApplyNo"));
                                baseNatAppointmentDao.save(baseNatAppointmentDO);
                            }
                            //取消号源
                            //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                        }
                        baseNatAppointmentDao.save(baseNatAppointmentDO);
                    }
                }
            }