Browse Source

异常处理

wangjun 4 years ago
parent
commit
42990808c8

+ 6 - 0
business/base-service/pom.xml

@ -179,6 +179,12 @@
            <artifactId>lombok</artifactId>
            <version>1.18.8</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.4</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>

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

@ -76,10 +76,12 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.utils.AdminException;
import com.yihu.jw.utils.Pkis.PKIService_PortType;
import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.utils.sfutils.MyErrorCode;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPushLogDao;
@ -281,14 +283,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     * @throws Exception
     */
    public List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag) throws Exception {
    public List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag,String ksdm) throws Exception {
        logger.info("findOutpatientList patient:" + patient);
        String patNo = patientMappingService.findHisPatNoByPatient(patient);
        if (StringUtils.isBlank(patNo)) {
            return null;
        }
        logger.info("findOutpatientList patNo " + patNo);
        return entranceService.BS30025(patNo, null, startTime, endTime, demoFlag);
        return entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,ksdm);
    }
    /**
@ -305,7 +307,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            return null;
        }
        logger.info("findOutpatientList patNo:" + patNo);
        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo, conNo, null, null, demoFlag);
        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo, conNo, null, null, demoFlag,null);
        if (list != null && list.size() > 0) {
            WlyyOutpatientVO outpatientVO = list.get(0);
@ -794,6 +796,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     * @throws Exception
     */
    @Transactional
    public WlyyOutpatientDO appointmentRevisit(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception {
        //1.保存就诊实体
@ -812,7 +815,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (outpatientDO.getRegisterDate() == null) {
            outpatientDO.setRegisterDate(new Date());
        }
        WlyyPrescriptionExpressageDO previous = checkOutPatientPre(outpatientDO.getPatient());
        //2.物流信息
        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class);
        if (null!=previous.getId()&&previous.getOneselfPickupFlg()!=expressageDO.getOneselfPickupFlg()){
            throw new AdminException(MyErrorCode.take_control);
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("WX_MONEY");
        Double price = 0.0;
@ -843,19 +851,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } 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());
            throw new Exception("您今日发起过复诊,不允许更改取药方式");
        }*/
        if (0==expressageDO.getOneselfPickupFlg()){
            /*if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                String drugCode= expressageDO.getHospitalCode()==null?"5550":expressageDO.getHospitalCode();
                expressageDO.setHospitalCode(drugCode);
            }*/
            }
            System.out.println("进入物流信息");
            expressageDO.setDel(1);
            expressageDO.setCreateTime(new Date());
@ -3659,7 +3660,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else if("outPatientTimeOutRemind".equalsIgnoreCase(titelType)) {
            contentMsg = "您邀请的医师暂无应答,您可以选择继续等待或者取消邀请。";
            first = outpatientDO.getPatientName() + ",您好!";
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId=    "+outpatientId;
            logger.info("outPatientTimeOutRemind:outpatientId="+outpatientId+"contentMsg"+contentMsg);
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
        } else if ("payRemind".equalsIgnoreCase(titelType)) {
            if ("9".equals(type)) {
@ -3689,7 +3691,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            first = outpatientDO.getPatientName() + ",您好! 医生已为您开具处方,请及时支付。";
            contentMsg = "医生已为您开具处方,请及时支付。";
            remark = "点击完成支付,如您已支付请忽略本条信息";
            msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId;
            msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId+"&id="+remindMsg;
            logger.info("处方支付微信消息模板推送开始");
        } else if ("msgRemind".equalsIgnoreCase(titelType)) {
            first = outpatientDO.getPatientName() + ",您好!";
@ -3994,6 +3996,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            logger.info("XZZX_Msg_" + titelType + "=" + responseMsg);
        } else if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
            String responseMsg="";
            String prefix="https://hlwyy.xmzsh.com";
            if(StringUtils.isNotEmpty(outpatientId)){
@ -4006,6 +4009,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        contentMsg,
                        remark
                );
                System.out.println("结束发送模板消息");
            }
            if (consultTeam!=null&&consPatientDO!=null){
                responseMsg = entranceService.ehospitalNotice(
@ -7210,7 +7214,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString());
            }
            sendWxTemplateMsg(wxId, outpatientDO.getId(), null,"", "prescriptionPayRemind", "");
            sendWxTemplateMsg(wxId, outpatientDO.getId(), null,"", "prescriptionPayRemind", wlyyPrescriptionDO.getId());
        } else {
            wlyyPrescriptionDO.setId(prescriptionId);
            wlyyPrescriptionDO.setCheckStatus(status);
@ -8224,7 +8228,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @throws Exception
     */
    public void SOF_SignDataWithExtraInfoEmr(WlyyPrescriptionEmrDO prescriptionEmrDO) throws Exception {
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionEmrDO.getId());
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionEmrDO.getPrescriptionId());
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
        BaseDoctorDO doctorDO = baseDoctorDao.findById(prescriptionDO.getDoctor());
        BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode());

+ 4 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -555,7 +555,7 @@ public class EntranceService {
     * @return
     * @throws Exception
     */
    public List<WlyyOutpatientVO> BS30025(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag) throws Exception {
    public List<WlyyOutpatientVO> BS30025(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag ,String ksdm) throws Exception {
        String fid = BS30025;
        logger.info("EntranceService " + fid + " PAT_NO :" + PAT_NO + " conNo:" + conNo + " startTime:" + startTime + " endTime:" + endTime);
@ -584,6 +584,9 @@ public class EntranceService {
            if (StringUtils.isNotBlank(endTime)) {
                sbs.append("<query compy=\"&lt;\" item=\"CON_DATE\" splice=\"and\" value=\"'" + endTime + "'\"/>");
            }
            if (StringUtils.isNotBlank(ksdm)) {
                sbs.append("<query compy=\"=\" item=\"ADM_SPEC\" splice=\"and\" value=\"'" + ksdm + "'\"/>");
            }
            sbs.append("<order item=\"CON_DATE\" sort=\"desc\"/>");
            //查询信息结束
            sbs.append("</MsgInfo></ESBEntry>");

+ 10 - 0
business/base-service/src/main/java/com/yihu/jw/utils/AdminException.java

@ -0,0 +1,10 @@
package com.yihu.jw.utils;
public class AdminException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    public AdminException(Object Obj) {
        super(Obj.toString());
    }
}

+ 33 - 0
business/base-service/src/main/java/com/yihu/jw/utils/sfutils/MyErrorCode.java

@ -0,0 +1,33 @@
package com.yihu.jw.utils.sfutils;
public enum MyErrorCode {
    take_control("wj0001","您今日发起过复诊,不允许更改取药方式");
    private String value;
    private String desc;
    private MyErrorCode(String value, String desc) {
        this.setValue(value);
        this.setDesc(desc);
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    @Override
    public String toString() {
        return "[" + this.value + "]" + this.desc;
    }
}

+ 4 - 2
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/OutPatientRemindJob.java

@ -6,7 +6,6 @@ import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.util.date.DateUtil;
import org.quartz.Job;
@ -33,10 +32,13 @@ public class OutPatientRemindJob implements Job {
    private PrescriptionService prescriptionService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${wechat.id}")
    @Value("${wechat.ids}")
    private String wxId;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("启动发送超时提示消息开始");
        System.out.println(wxId);
        System.out.println("启动发送超时提示消息开始");
        List<WlyyOutpatientDO> wlyyOutpatientDOS= outpatientDao.findWaitingOutpatient();
        String senderId ="";
        String reciverId = "";

+ 1 - 0
svr/svr-internet-hospital-job/src/main/resources/application.yml

@ -250,6 +250,7 @@ wlyy:
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  ids: xm_zsyy_wx
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091

+ 4 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -130,8 +130,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                          @ApiParam(name = "startTime", value = "开始时间")
                                          @RequestParam(value = "startTime",required = false) String startTime,
                                          @ApiParam(name = "endTime", value = "结束时间")
                                          @RequestParam(value = "endTime",required = false) String endTime) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag);
                                          @RequestParam(value = "endTime",required = false) String endTime,
                                          @ApiParam(name = "ksdm", value = "科室代码")
                                              @RequestParam(value = "ksdm",required = false) String ksdm) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm);
        return success(vos);
    }