浏览代码

医生部门修改

wangjun 4 年之前
父节点
当前提交
f4737fb64d

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java

@ -43,4 +43,7 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    @Query("from WlyyOutpatientDO a where a.status = 0 and a.payStatus = 1")
    List<WlyyOutpatientDO> findWaitingOutpatient();
    /*@Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType = 1")
    List<WlyyOutpatientDO> findOutpatientByPatientAndStatus(String patient);*/
}

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

@ -119,6 +119,8 @@ import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Base64;
@ -826,24 +828,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        businessOrderService.recharge(outpatient.getId(), "复诊-诊查费", "2", "复诊-诊查费", patientDO.getId(), patientDO.getName(), outpatient.getDoctor(), price);
        BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "复诊-诊查费", "2", "复诊-诊查费", patientDO.getId(), patientDO.getName(), outpatient.getDoctor(), price);
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        WlyyPatientRegisterTimeDO wlyyPatientRegisterTimeDO =new WlyyPatientRegisterTimeDO();
        try {
            //如果是视频预约咨询
            if (StringUtils.isNotBlank(registerJson)) {
                registerTimeDO = objectMapper.readValue(registerJson, WlyyPatientRegisterTimeDO.class);
                registerTimeDO.setOutpatientId(outpatient.getId());
                registerTimeDO.setCreateTime(new Date());
                patientRegisterTimeDao.save(registerTimeDO);
                wlyyPatientRegisterTimeDO = patientRegisterTimeDao.save(registerTimeDO);
            }
        } catch (Exception e) {
            throw new RuntimeException("号源已经被预约,请选择其他号源");
        }
        WlyyPrescriptionExpressageDO previous = checkOutPatientPre(outpatientDO.getPatient());
        //2.物流信息
        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class);
        if (null!=previous&&previous.getOneselfPickupFlg()!=expressageDO.getOneselfPickupFlg()){
            outpatientDao.delete(outpatient.getId());
            businessOrderDao.delete(businessOrderDO.getId());
            patientRegisterTimeDao.delete(wlyyPatientRegisterTimeDO.getId());
            throw new Exception("您今日发起过复诊,不允许更改取药方式");
        }
        if (0==expressageDO.getOneselfPickupFlg()){
            /*if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                String drugCode= expressageDO.getHospitalCode()==null?"5550":expressageDO.getHospitalCode();
@ -881,7 +889,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return outpatient;
    }
    public WlyyPrescriptionExpressageDO checkOutPatientPre(String patientId) throws ParseException {
        String sql = "select t.id as \"id\",t.adm_no as \"admNo\",t.create_time as \"createTime\" from wlyy_outpatient t where 1=1";
        String startDate = DateUtil.getStringDateShort()+" 00:00:00";
        String endDate = DateUtil.getStringDateShort()+" 23:59:59";
        if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
            sql+=" and t.create_time >= '" +startDate+"' "+
                    " and t.create_time <= '" +endDate+"' ";
        }else if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            sql+=" and  t.create_time >= to_char('"+startDate+"','yyyy-mm-dd hh:mm:ss')\n" +
                    "and t.create_time < to_char('"+endDate+"','yyyy-mm-dd hh:mm:ss')";
        }else {
            sql+=" and  t.create_time >= to_char('"+startDate+"','yyyy-mm-dd hh:mm:ss')\n" +
                    "and t.create_time < to_char('"+endDate+"','yyyy-mm-dd hh:mm:ss')";
        }
        if (StringUtils.isNoneBlank(patientId)){
            sql+=" and t.patient = '"+patientId+"'";
        }
        sql +=" and t.outpatient_type = 1  order by t.create_time desc";
        System.out.println(sql);
        List<Map<String,Object>> listPrescript = hibenateUtils.createSQLQuery(sql);
        String outPatientId="";
        if (listPrescript.size()>1){
            Map<String,Object> mapPrescript = listPrescript.get(0);
            outPatientId = mapPrescript.get("id").toString();
        }
        List<WlyyPrescriptionExpressageDO> list =  prescriptionExpressageDao.findByOutpatientId(outPatientId);
        WlyyPrescriptionExpressageDO wlyyPrescriptionExpressageDO = new WlyyPrescriptionExpressageDO();
        if(list.size()>0){
             wlyyPrescriptionExpressageDO = list.get(0);
        }
        return wlyyPrescriptionExpressageDO;
    }
    /**
     * 创建候诊室
@ -4019,7 +4058,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    e.printStackTrace();
                    logger.info("发送失败,error="+e.getMessage());
                }
                //保存发送模板记录,
                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                wxPushLogDO.setCreateTime(new Date());
@ -5657,7 +5695,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     *
     * @param admNo     门诊唯一号
     * @param realOrder 处方号
     * @return
     * @
     */
    public Object getSFExpressInfo(String admNo, String realOrder, String wxId) throws Exception {
@ -8257,7 +8295,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     * 电子病历签名
     * @param prescriptionDO
     * @param prescriptionEmrDO
     * @throws Exception
     */
    public void SOF_SignDataWithExtraInfoEmr(WlyyPrescriptionEmrDO prescriptionEmrDO) throws Exception {