Sfoglia il codice sorgente

接诊结束改为24小时之后

wangjun 4 anni fa
parent
commit
727b9bc26c

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

@ -34,6 +34,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
@ -186,12 +187,31 @@ public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pr
     *
     */
    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn, String patient, String realOrder, String admNo, boolean demoFlag)throws Exception{
        String patNo =patientMappingService.findHisPatNoByPatient(patient,null);
        if(StringUtils.isBlank(patNo)){
            return null;
        String patNo = "";
        if (!StringUtil.isEmpty(patient)){
            PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
            if (patientMappingDO!=null){
                patNo = patientMappingDO.getMappingCode();
            }else {
                BasePatientDO basePatientDO = basePatientDao.findById(patient);
                if (basePatientDO!=null){
                    JSONArray res = tnyyEntranceService.selectPatientMappingCode(basePatientDO.getIdcard());
                    if (res!=null&&res.size()!=0){
                        JSONObject object = res.getJSONObject(0);
                        patNo = object.getString("BRID");
                        patientMappingDO= new PatientMappingDO();
                        patientMappingDO.setPatientName(basePatientDO.getName());
                        patientMappingDO.setPatient(patient);
                        patientMappingDO.setMappingCode(patNo);
                        patientMappingDO.setSource("1");
                        patientMappingDO.setIdcard(basePatientDO.getIdcard());
                        patientMappingDao.save(patientMappingDO);
                    }
                }
            }
        }
        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" realOrder:"+realOrder+" admNo:"+admNo);
        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" realOrder:"+realOrder+" admNo:"+admNo);
        return tnyyEntranceService.findMS_CF01And02(admNo,demoFlag);
    }

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java

@ -89,7 +89,7 @@ public class HibenateUtils {
        setSqlQueryByMap(query, params);
        if(page!=null&&size!=null){
            query.setFirstResult(page * size);
            query.setFirstResult((page-1) * size);
            query.setMaxResults(size);
        }
        List<Map<String, Object>> list = query.list();

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

@ -306,12 +306,22 @@ public class PrescriptionStatusUpdateService {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        int i = calendar.get(Calendar.HOUR_OF_DAY);
        if(i==0){
            //将所有的已接诊的处方记录
            List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus();
            if(outpatientDOs!=null&&outpatientDOs.size()>0){
                System.out.println(outpatientDOs.get(0).getId()+"id______-");
                for(WlyyOutpatientDO outpatientDO:outpatientDOs){
        //将所有的已接诊的处方记录
        List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus();
        if(outpatientDOs!=null&&outpatientDOs.size()>0){
            System.out.println(outpatientDOs.get(0).getId()+"id______-");
            for(WlyyOutpatientDO outpatientDO:outpatientDOs){
                long currentTime = new Date().getTime();
                Date temp = new Date();
                if (outpatientDO.getConDate()==null){
                    temp = outpatientDO.getCreateTime();
                }else {
                    temp = outpatientDO.getConDate();
                }
                long outpatientTime = outpatientDO.getAdmDate()==null?temp.getTime():outpatientDO.getAdmDate().getTime();
                if(currentTime-outpatientTime>24*60*60*1000){
                    logger.info("结束接诊时间满足条件");
                    //结束门诊
                    outpatientDO.setStatus("3");
                    outpatientDO.setEndTime(new Date());
@ -328,30 +338,41 @@ public class PrescriptionStatusUpdateService {
                    }
                    logger.info(outpatientDO.getId()+"的处方记录设置为结束");
                }
                outpatientDao.save(outpatientDOs);
                //退费
                for (WlyyOutpatientDO outpatientDO:outpatientDOs){
            }
            outpatientDao.save(outpatientDOs);
            //退费
            for (WlyyOutpatientDO outpatientDO:outpatientDOs){
                long currentTime = new Date().getTime();
                Date temp = new Date();
                if (outpatientDO.getConDate()==null){
                    temp = outpatientDO.getCreateTime();
                }else {
                    temp = outpatientDO.getConDate();
                }
                long outpatientTime = outpatientDO.getAdmDate()==null?temp.getTime():outpatientDO.getAdmDate().getTime();
                if(currentTime-outpatientTime>24*60*60*1000) {
                    logger.info("退费时间满足条件");
                    try {
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                    if (businessOrderDO!=null){
                        if (businessOrderDO.getPayType()==1){
                            businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                        }else if (businessOrderDO.getPayType()==3){
        /*
                            businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
        */
                        }
                    } } catch (Exception e) {
                        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                        if (businessOrderDO!=null){
                            if (businessOrderDO.getPayType()==1){
                                businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                            }else if (businessOrderDO.getPayType()==3){
    /*
                        businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
    */
                            }
                        } } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                logger.info("setOutPatientOver count :"+outpatientDOs.size());
            }else {
                logger.info("setOutPatientOver count :"+0);
            }
            logger.info("setOutPatientOver end ");
            logger.info("setOutPatientOver count :"+outpatientDOs.size());
        }else {
            logger.info("setOutPatientOver count :"+0);
        }
        logger.info("setOutPatientOver end ");
    }

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

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