wangjun 3 gadi atpakaļ
vecāks
revīzija
5c14b67733

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

@ -13,10 +13,14 @@ public interface BaseNatAppointmentDao extends PagingAndSortingRepository<BaseNa
    @Query("from BaseNatAppointmentDO t where t.payStatus = 0 ")
    List<BaseNatAppointmentDO> findByPayStatus();
    @Query("from BaseNatAppointmentDO t where t.payStatus = 0 and t.isSuccess=1 and t.patientId=?1")
    @Query("from BaseNatAppointmentDO t where  t.payStatus = 0 and t.isSuccess=1 and t.patientId=?1")
    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("select a from BaseNatAppointmentDO a where  a.realOrder =?1 ")
    List<BaseNatAppointmentDO> findByRealOrderList(String realOrder);
}

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

@ -803,7 +803,7 @@ public class TasyNatService {
    }
    public void savePayStatusByHis(String patientId) throws Exception {
        List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientId(patientId);
        List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientIdTASY(patientId);
        for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
                String res = QueryApplyInfo(baseNatAppointmentDO.getRealOrder());
                JSONObject jsonObject = JSON.parseObject(res);
@ -818,6 +818,20 @@ public class TasyNatService {
                                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);
                            }
                            //取消号源
                            cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                        }
                        baseNatAppointmentDao.save(baseNatAppointmentDO);
                    }