Explorar el Código

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageLogDO.java
wangzhinan hace 4 años
padre
commit
cac357e4d5

+ 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);*/
}

+ 50 - 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 {
@ -8256,10 +8294,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     * 电子病历签名
     * @param prescriptionEmrDO
     * @throws Exception
     */
    public void SOF_SignDataWithExtraInfoEmr(WlyyPrescriptionEmrDO prescriptionEmrDO) throws Exception {
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionEmrDO.getPrescriptionId());
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionEmrDO.getId());
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
        BaseDoctorDO doctorDO = baseDoctorDao.findById(prescriptionDO.getDoctor());
        BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode());
@ -8267,6 +8306,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        PKIService_ServiceLocator locator = new PKIService_ServiceLocator();
        URL portAddress = new URL("http://192.0.33.91:8080/pkis/services/v1?wsdl");
        PKIService_PortType service = locator.getPKIServiceImplPort(portAddress);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
        List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(), 1);
        List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionDO.getId(), 1);
        //电子病历签名
        com.alibaba.fastjson.JSONObject jsonData = new com.alibaba.fastjson.JSONObject();

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

@ -1760,7 +1760,6 @@ public class EntranceService {
            resp = MqSdkUtil.xml2jsonArrayRootRowMS02003(resp);
        }
        net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(resp);
        logger.info("获取医生数据"+jsonObject.toString());
        if (null != jsonObject && "1".equals(jsonObject.get("code").toString())) {
            JSONArray jsonObjectMgsInfo = (JSONArray) jsonObject.get("MsgInfo");
            if (null != jsonObjectMgsInfo) {
@ -1811,23 +1810,23 @@ public class EntranceService {
                                    baseDoctorDO.setIsFamous(0);
                                    baseDoctorDO.setCreateTime(new Date());
                                    baseDoctorDO.setUpdateTime(new Date());
                                    if (StringUtils.isNotBlank(idCard)) {
                                        baseDoctorDO.setSalt(PwdUtil.randomString(5));
                                        try {
                                            baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex(baseDoctorDO.getIdcard().substring(baseDoctorDO.getIdcard().length() - 6) + "{" + baseDoctorDO.getSalt() + "}"));
                                        } catch (Exception e) {
                                            logger.error(e.getMessage() + "docotr=" + doctorCode + ";idcard=" + baseDoctorDO.getIdcard());
                                        }
                                    } else {
                                        baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex("123456" + "{" + baseDoctorDO.getSalt() + "}"));
                                    }
                                }
                                //号别
                                baseDoctorDO.setChargeType(chareType);
                                //拼音码
                                baseDoctorDO.setSpell(null == jsonObjectBody.get("PinYin_Code") ? "" : jsonObjectBody.get("PinYin_Code").toString());
                                //姓名
                                doctorName = null == jsonObjectBody.get("Emp_Name") ? "" : jsonObjectBody.get("Emp_Name").toString();
                                //号别
                                baseDoctorDO.setChargeType(chareType);
                                if (StringUtils.isNotBlank(idCard)) {
                                    baseDoctorDO.setSalt(PwdUtil.randomString(5));
                                    try {
                                        baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex(baseDoctorDO.getIdcard().substring(baseDoctorDO.getIdcard().length() - 6) + "{" + baseDoctorDO.getSalt() + "}"));
                                    } catch (Exception e) {
                                        logger.error(e.getMessage() + "docotr=" + doctorCode + ";idcard=" + baseDoctorDO.getIdcard());
                                    }
                                } else {
                                    baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex("123456" + "{" + baseDoctorDO.getSalt() + "}"));
                                }
                                baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
                                //根据医生和机构判断数据是否存在,若不存在则在mapping中追加记录
                                List<DoctorMappingDO> doctorMappingDOS = doctorMappingDao.findByDoctorAndOrgCode(baseDoctorDO.getId(), "350211A1002");

+ 2 - 12
business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java

@ -2,9 +2,7 @@ package com.yihu.jw.order.pay.ylz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.order.pay.utils.PayLogService;
import com.yihu.jw.util.common.QrcodeUtil;
@ -35,8 +33,7 @@ public class YlzPayService {
    @Autowired
    private PayLogService logService;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    /**
     private String termNo;
@ -265,13 +262,6 @@ public class YlzPayService {
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        JSONObject jsonObject = new JSONObject();
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("EXAMFREE");
        Double free = 0.0;
        if (hospitalSysDictDO!=null){
            free = Double.parseDouble(fee)+Integer.parseInt(hospitalSysDictDO.getDictValue());
        }else {
            free = Double.parseDouble(fee);
        }
        try {
            jsonObject.put("cardType",cardType);//卡类型01 社保卡 06 临时卡
            jsonObject.put("cardNo",cardNo);//卡号
@ -285,7 +275,7 @@ public class YlzPayService {
            jsonObject.put("applyDepaName",applyDepaName);//申请科室名称
            jsonObject.put("applyDoctorName",applyDoctorName);//申请医生姓名
            jsonObject.put("recipeTime",recipeTime);//处方时间yyyyMMddHHmmss
            jsonObject.put("fee",free);//总费用
            jsonObject.put("fee",Double.parseDouble(fee)+15);//总费用
            jsonObject.put("recipeNum",recipeNum);//处方数
            System.out.println("推送模板消息参数"+jsonObject.toJSONString());
            //jsonObject.put("extra")