瀏覽代碼

代码修改

LAPTOP-KB9HII50\70708 2 年之前
父節點
當前提交
35bf7d91da

+ 3 - 3
business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java

@ -1997,7 +1997,7 @@ public class HealthCareService {
    public String refundMedicalHistory(String outpatientId,String remark) throws Exception{
        String funid = "N20.17.06.06";
        JSONObject data = new JSONObject();
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        if (wlyyOutpatientDO==null){
            throw new Exception("医保上传户病史病情及医学报告失败!门诊为空");
        }
@ -2050,7 +2050,7 @@ public class HealthCareService {
     */
    public String uploadIcdProcess(String outpatientId) throws Exception{
        String funid = "N20.17.06.02";
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        if (wlyyOutpatientDO==null){
            throw new Exception("获取问诊过程数据失败!门诊为空");
        }
@ -2102,7 +2102,7 @@ public class HealthCareService {
    }
    public Boolean isHospitalFlag(){
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("medicalFlag");
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("medicalFlag").orElse(null);
        if (hospitalSysDictDO!=null){
            if (hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                return true;

+ 9 - 9
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -401,7 +401,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                mixEnvelop.setMessage("您已经添加家人关系,请勿重复添加");
                return mixEnvelop;
            }
            BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.getOne(dictId);
            BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findById(dictId).orElse(null);
            String dictName = "";
            if (null!=basePatientMemberDictDO){
                dictName = basePatientMemberDictDO.getRelationName();
@ -507,7 +507,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
     * @return
     */
    public BaseNatPatientFamilyMemberDO selectByFamilyId(String familyId){
        return  natPatientFamilyMemberDao.getOne(familyId);
        return  natPatientFamilyMemberDao.findById(familyId).orElse(null);
    }
    /**
@ -527,7 +527,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
     * @return
     */
    public BaseNatPatientFamilyMemberDO addSelfResult(String patientId){
        BasePatientDO patientDO = basePatientDao.getOne(patientId);
        BasePatientDO patientDO = basePatientDao.findById(patientId).orElse(null);
        BaseNatPatientFamilyMemberDO result = new BaseNatPatientFamilyMemberDO();
        result.setFamilyRelation("7");
        result.setFamilyRelationName("自己");
@ -554,7 +554,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
    public MixEnvelop addFamilyAppoint(String id,String patientId, String familyName, String dictId, String cardType, String idCard, String phoneNum,boolean demo,String medicareType,String medicare,String clinicId) throws Exception {
        MixEnvelop mixEnvelop = new MixEnvelop();
        try{
            BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.getOne(dictId);
            BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findById(dictId).orElse(null);
            BasePatientDO basePatientDO = null;
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            /*List<BasePatientDO> listpatients=basePatientDao.findByMobileAndDel(phoneNum,"1");
@ -599,7 +599,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
            WlyyPatientFamilyMemberDO result = new WlyyPatientFamilyMemberDO();
            if (StringUtils.isNotBlank(id)){
                result = wlyyPatientFamilyMemberDao.findById(id).orElse(null);
                basePatientDO = basePatientDao.getOne(result.getFamilyMember());
                basePatientDO = basePatientDao.findById(result.getFamilyMember()).orElse(null);
                patientMappingDO = patientMappingDao.findByPatient(result.getFamilyMember());
            }
@ -626,12 +626,12 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                    sex = 3;
                }
                String familyAge = String.valueOf(IdCardUtil.getAgeForIdcard(idCard));
                BasePatientMemberDictDO basePatientMemberDictDO1 = basePatientMemberDictDao.getOne(dictId);
                BasePatientMemberDictDO basePatientMemberDictDO1 = basePatientMemberDictDao.findById(dictId).orElse(null);
                String relationName = "";
                if (null!=basePatientMemberDictDO1){
                    relationName=basePatientMemberDictDO1.getRelationName();
                }
                BasePatientDO basePatientDO1  = basePatientDao.getOne(patientId);
                BasePatientDO basePatientDO1  = basePatientDao.findById(patientId).orElse(null);
                SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
                birth = sf.format(basePatientDO1.getBirthday());
                String res = "";
@ -775,7 +775,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
    public void saveYktFamily(String patientId) throws Exception{
        try {
            String userId="";
            BasePatientDO basePatientDO = basePatientDao.getOne(patientId);
            BasePatientDO basePatientDO = basePatientDao.findById(patientId).orElse(null);
            if (null!=basePatientDO){
                userId = basePatientDO.getUserId();
            }
@ -1080,7 +1080,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                                map.put("address",object.getString("address"));
                                map.put("zydm",object.getString("zydm"));
                                if (StringUtils.isNotBlank(object.getString("zydm"))){
                                    BaseJobCategoryDO jobCategoryDO = baseJobCategoryDao.getOne(Integer.parseInt(object.getString("zydm")));
                                    BaseJobCategoryDO jobCategoryDO = baseJobCategoryDao.findById(Integer.parseInt(object.getString("zydm"))).orElse(null);
                                    if (jobCategoryDO!=null){
                                        map.put("zydmName",jobCategoryDO.getName());
                                    }

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java

@ -358,7 +358,7 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
            BaseEvaluateScoreDO scoreList =null;
            if (baseEvaluateDO.size()>0){
                String findRC=baseEvaluateDO.get(0).getRelationCode();
                scoreList= baseEvaluateScoreDao.getOne(relationCode);
                scoreList= baseEvaluateScoreDao.findById(relationCode).orElse(null);
                if(null!=scoreList){
                    returnMap.put("everangScore",scoreList);
                    returnMap.put("scoreList",baseEvaluateDO);
@ -503,7 +503,7 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
    public boolean checkGiveTimeOut(String sender, String reciver) {
        List<BaseUserMessageDO> baseBannerDoctorDOS = this.baseUserMessageDao.getMessageByPatientAndDoctor(reciver, sender);
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = this.wlyyHospitalSysDictDao.getOne("leave_message_timeout");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = this.wlyyHospitalSysDictDao.findById("leave_message_timeout").orElse(null);
        if (null != baseBannerDoctorDOS&&baseBannerDoctorDOS.size()>=1)
        {
            BaseUserMessageDO lastOne = (BaseUserMessageDO)baseBannerDoctorDOS.get(0);

+ 6 - 6
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/HcyyPrescriptionService.java

@ -721,14 +721,14 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    public String  saveEmrToEntrance(String prescriptionId,String baseSign) throws Exception {
        Map<String,String> params = new HashedMap();
        WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = new WlyyPrescriptionEmrDO();
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.getOne(prescriptionId);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
        JSONObject paramRequest = new JSONObject();
        if (null!=wlyyPrescriptionDO){
            paramRequest.put("patientName",wlyyPrescriptionDO.getPatientName());
            PatientMappingDO patientMappingDO =  patientMappingDao.findByPatient(wlyyPrescriptionDO.getPatientCode());
            BasePatientDO basePatientDO = patientDao.getOne(wlyyPrescriptionDO.getPatientCode());
            BasePatientDO basePatientDO = patientDao.findById(wlyyPrescriptionDO.getPatientCode()).orElse(null);
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(wlyyPrescriptionDO.getDoctor());
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(wlyyPrescriptionDO.getOutpatientId());
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId()).orElse(null);
            if(null!=patientMappingDO){
                paramRequest.put("patientid",patientMappingDO.getMappingCode());
            }
@ -966,7 +966,7 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     */
    public JSONObject refundRegisterNo(String outpatientId) throws Exception {
        JSONObject object = new JSONObject();
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        if(outpatientDO!=null){
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(outpatientDO.getDoctor());
            if (StringUtils.isNoneBlank(outpatientDO.getRegisterNo())){
@ -1011,7 +1011,7 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findByRealOrder(realOrder);
        if (null!=wlyyPrescriptionDO){
            params.put("IoFlag","0");
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(wlyyPrescriptionDO.getOutpatientId());
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId()).orElse(null);
            String PayCardNo = "";
            String ApplyDept = "";
            String NullahNumber = "";
@ -1042,7 +1042,7 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     */
    public JSONObject registerOutPatient(String outPatientId, String doctor){
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outPatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId).orElse(null);
        List<WlyyPrescriptionExpressageDO> expressageDOS =prescriptionExpressageDao.findByOutpatientId(outPatientId);
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        BaseDoctorDO doctorDO = baseDoctorDao.findByIdAndDel(doctor);

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

@ -503,7 +503,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    public WlyyPrescriptionVO findOriginPrescription(String registerSn, String patient, String admNo, String realOrder, boolean demoFlag) throws Exception {
        /*String patNo = patientMappingService.findHisPatNoByPatient(patient);*/
        BasePatientDO patientDO = basePatientDao.getOne(patient);
        BasePatientDO patientDO = basePatientDao.findById(patient).orElse(null);
        if (patientDO==null){
            return null;
        }
@ -684,7 +684,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
        //复诊信息
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        if("2".equalsIgnoreCase(outpatientDO.getOutpatientType())){
            String generalDept="";
            String generalDeptName="";
@ -727,7 +727,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("icd10Name",outpatientDO.getIcd10Name());
        rs.put("createTime",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));
        //居民详情
        BasePatientDO basePatientDO = basePatientDao.getOne(outpatientDO.getPatient());
        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient()).orElse(null);
        rs.put("patientName", basePatientDO.getName());
        rs.put("photo", basePatientDO.getPhoto());
        rs.put("patientId", basePatientDO.getId());
@ -1022,17 +1022,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    public WlyyPrescriptionDO findPrescriptionDo(String prescriptionId) {
        return prescriptionDao.getOne(prescriptionId);
        return prescriptionDao.findById(prescriptionId).orElse(null);
    }
    public Map<String, Object> findPrescriptionInfo(String prescriptionId) {
        //续方信息
        Map<String, Object> rs = new HashedMap();
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.getOne(prescriptionId);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
        rs.put("prescription", convertToModel(wlyyPrescriptionDO, WlyyPrescriptionVO.class));
        //居民详情
        BasePatientDO basePatientDO = basePatientDao.getOne(wlyyPrescriptionDO.getPatientCode());
        BasePatientDO basePatientDO = basePatientDao.findById(wlyyPrescriptionDO.getPatientCode()).orElse(null);
        rs.put("patientName", basePatientDO.getName());
        rs.put("patientId", basePatientDO.getId());
        rs.put("idCard", basePatientDO.getIdcard());
@ -1071,7 +1071,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public WlyyOutpatientDO appointmentRevisit(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception {
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.getOne(outpatientDO.getPatient());
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient()).orElse(null);
        BaseDoctorDO doctorDO = baseDoctorDao.findByIdAndDel(outpatientDO.getDoctor());
        outpatientDO.setIsAgree("1");
        outpatientDO.setMjz("mz");
@ -1098,7 +1098,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("WX_MONEY");
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("WX_MONEY").orElse(null);
        Double price = 0.0;
        String chargeType1 = null;
        if (doctorDO!=null){
@ -1311,7 +1311,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public Boolean cancelPrescription(String prescriptionId) {
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.getOne(prescriptionId);
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
        prescriptionDO.setStatus(-2);
        return true;
    }
@ -1346,7 +1346,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else if ("3".equals(status)) {
            //自取处方结束
            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findByRealOrder(realOrder);
            WlyyOutpatientDO outpatientDO = outpatientDao.getOne(wlyyPrescriptionDO.getOutpatientId());
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId()).orElse(null);
            if (null != wlyyPrescriptionDO && 1 == wlyyPrescriptionDO.getDispensaryType()) {
                //取药类型:1 自取 2快递配送
@ -1448,7 +1448,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @throws Exception
     */
    public JSONArray findPatientCard(String patient) throws Exception {
        BasePatientDO patientDO = basePatientDao.getOne(patient);
        BasePatientDO patientDO = basePatientDao.findById(patient).orElse(null);
        JSONArray res = entranceService.BS15018(patientDO.getIdcard(), null, demoFlag);
        JSONArray rs = new JSONArray();
        if (res != null) {
@ -1467,7 +1467,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public Map<String, Object> checkOutpatient(String patient,String wxId,boolean flag,String outpatientType) throws Exception {
        //-1卡余额不足,,-2 存在未结束的诊断热 1成功
        Map<String, Object> rs = new HashedMap();
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("consultAccount");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("consultAccount").orElse(null);
        String accountControl = "0";
        if (null!=wlyyHospitalSysDictDO){
            accountControl = wlyyHospitalSysDictDO.getDictValue();
@ -1940,7 +1940,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            List<WlyyDoctorWorkTimeVO> timeVOs = new ArrayList<>();
            String isCheckWork = "1";//1需要判断医生在班0不需要
            if (StringUtils.isNoneBlank(ywCode)){
                WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne(ywCode);
                WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById(ywCode).orElse(null);
                if (wlyyHospitalSysDictDO!=null){
                    isCheckWork = wlyyHospitalSysDictDO.getDictValue();
                }
@ -2129,7 +2129,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    public net.sf.json.JSONObject registerOutPatient(String outPatientId, String doctor) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outPatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId).orElse(null);
        DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(doctor, outpatientDO.getHospital());
@ -2137,7 +2137,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            throw new RuntimeException("未找到医生映射信息");
        }
        BasePatientDO basePatientDO = basePatientDao.getOne(outpatientDO.getPatient());
        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient()).orElse(null);
        Integer manageType = 1;//处理类型(1-新增 2-修改 3-删除) 必填
@ -2290,7 +2290,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public net.sf.json.JSONObject refundRegisterNo(String outpatientId) throws Exception {
        net.sf.json.JSONObject res = new net.sf.json.JSONObject();
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        if(outpatientDO!=null){
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(outpatientDO.getDoctor());
            if (StringUtils.isNoneBlank(outpatientDO.getRegisterNo())){
@ -2694,7 +2694,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        Map<String, Object> result = new HashedMap();
        //获取门诊记录
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outPatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId).orElse(null);
        //设置医嘱
        outpatientDO.setAdvice(advice);
@ -2811,7 +2811,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                List<WlyyPrescriptionInfoDO> infoDOs = (List<WlyyPrescriptionInfoDO>) com.alibaba.fastjson.JSONArray.parseArray(infoJsons, WlyyPrescriptionInfoDO.class);
                String name ="";
                Integer j = 0;
                WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("drugInfo");
                WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("drugInfo").orElse(null);
                Boolean flag = false;
                String dictValues = "";
                if (hospitalSysDictDO!=null){
@ -3036,7 +3036,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String condition ="";
        condition = "<IoFlag>"+0+"</IoFlag>";
        StringBuffer inspectionList = new StringBuffer();
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        String applyDoctor = "";
        if (null!=outpatientDO){
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(outpatientDO.getDoctor());
@ -3679,7 +3679,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    public Boolean setMailno(String mailno, String expressageId) {
        WlyyPrescriptionExpressageDO expressageDO = prescriptionExpressageDao.getOne(expressageId);
        WlyyPrescriptionExpressageDO expressageDO = prescriptionExpressageDao.findById(expressageId).orElse(null);
        expressageDO.setMailno(mailno);
        prescriptionExpressageDao.save(expressageDO);
        return true;
@ -4885,7 +4885,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                rs.put("roles", null);
            }
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("pwOverDue");
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("pwOverDue").orElse(null);
            if (wlyyHospitalSysDictDO.getPyCode().equalsIgnoreCase("open")) {
                //密码过期
                rs.put("authPw", baseDoctorService.findDoctorPwlimitDate(doctor));
@ -4924,7 +4924,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        }
        //更改门诊状态
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outPatientId);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outPatientId).orElse(null);
        wlyyOutpatientDO.setStatus("-1");
        //报错拒诊操作人
        wlyyOutpatientDO.setOperator(userAgent.getUID());
@ -5009,7 +5009,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                e.printStackTrace();
            }
            //推送消息到眼科通
            BasePatientDO patient = basePatientDao.getOne(wlyyOutpatientDO.getPatient());
            BasePatientDO patient = basePatientDao.findById(wlyyOutpatientDO.getPatient()).orElse(null);
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString());
            }
@ -5037,7 +5037,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            } else if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.getOne("isCloseRefund");
                WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("isCloseRefund").orElse(null);
                if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
                    try {
                        if (businessOrderDO.getStatus()==1){
@ -5081,7 +5081,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String msgUrl="";
        if (consultTeam!=null){
            consDoctorDO = baseDoctorDao.findByIdAndDel(consultTeam.getDoctor());
            consPatientDO = basePatientDao.getOne(consultTeam.getPatient());
            consPatientDO = basePatientDao.findById(consultTeam.getPatient()).orElse(null);
            List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(consultTeam.getDoctor());
            if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()>=0){
                hospitalDO=doctorHospitalDOS.get(0);
@ -5092,9 +5092,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        BaseDoctorDO doctorDO = new BaseDoctorDO();
        BasePatientDO patientDO = new BasePatientDO();
        if (StringUtils.isNotEmpty(outpatientId)){
            outpatientDO = outpatientDao.getOne(outpatientId);
            outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
            doctorDO = baseDoctorDao.findByIdAndDel(outpatientDO.getDoctor());
            patientDO = basePatientDao.getOne(outpatientDO.getConsumer());
            patientDO = basePatientDao.findById(outpatientDO.getConsumer()).orElse(null);
        }
        logger.info("titelType:"+titelType+"&&remindMsg:"+remindMsg+"&&type"+type);
@ -5177,7 +5177,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            logger.info("doctorRefund:outpatientId="+outpatientId);
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
        } else if("patientCancel".equalsIgnoreCase(titelType)) {
            WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("isCloseRefund");
            WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isCloseRefund").orElse(null);
            if (outpatientDO.getPayStatus()==1){
                if (hospitalSysDictDO!=null){
                    if (hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
@ -5268,7 +5268,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
        }else if("systemCancelRemind".equalsIgnoreCase(titelType)){
            //超过24小时未接诊,系统取消
            WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("isCloseRefund");
            WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isCloseRefund").orElse(null);
            if (outpatientDO.getPayStatus()==1){
                if (hospitalSysDictDO!=null){
                    if (hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
@ -5753,7 +5753,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String patienName = "";
        String mailNo ="";
        String msgUrl ="";
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
        if (wlyyOutpatientDO!=null){
            patientId = wlyyOutpatientDO.getConsumer();
@ -5782,7 +5782,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                remindMsg = "已签收";
                break;
        }
        BasePatientDO basePatientDO = basePatientDao.getOne(patientId);
        BasePatientDO basePatientDO = basePatientDao.findById(patientId).orElse(null);
        if (basePatientDO!=null){
            patienName = basePatientDO.getName();
        }
@ -6126,7 +6126,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                Integer patientAge = 0;
                Integer patientSex = 3;
                if (null!=outpatient.get("outPatient")){
                   BasePatientDO basePatientDO = basePatientDao.getOne(outpatient.get("outPatient").toString());
                   BasePatientDO basePatientDO = basePatientDao.findById(outpatient.get("outPatient").toString()).orElse(null);
                   if (null!=basePatientDO){
                       if (StringUtils.isNotBlank(basePatientDO.getIdcard())){
                           patientAge = DateUtil.getAgeForIdcard(basePatientDO.getIdcard());
@ -7085,7 +7085,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            params.put("consultStatus", consultStatus);
        }
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("isSort");//isSort:1按照后台顺序,0按照系统排序
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isSort").orElse(null);//isSort:1按照后台顺序,0按照系统排序
        if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
            sql +=" and d.del='1' order by d.sort asc  ";
        }else {
@ -7568,7 +7568,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public Map<String, Object> findPatientInfo(String patient) {
        Map<String, Object> rs = new HashedMap();
        BasePatientDO basePatientDO = basePatientDao.getOne(patient);
        BasePatientDO basePatientDO = basePatientDao.findById(patient).orElse(null);
        Boolean flag = healthCareService.isHospitalFlag();
        if (flag){
            try{
@ -7652,7 +7652,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public Map<String, Object> updatePatientInfo(String patient, String name, String idcard, String ssc, Integer sex, String townCode, String townName, String committeeCode, String committeeName, String address, String photo, String mobile, String province, String provinceName, String city, String cityName) {
        Map<String, Object> rs = new HashedMap();
        BasePatientDO basePatientDO = basePatientDao.getOne(patient);
        BasePatientDO basePatientDO = basePatientDao.findById(patient).orElse(null);
        PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01", patient, "1");
        if (StringUtils.isNoneBlank(name)) {
            basePatientDO.setName(name);
@ -8024,7 +8024,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                Integer patientAge = 0;
                Integer patientSex = 3;
                if (null!=outpatient.get("outPatient")){
                    BasePatientDO basePatientDO = basePatientDao.getOne(outpatient.get("outPatient").toString());
                    BasePatientDO basePatientDO = basePatientDao.findById(outpatient.get("outPatient").toString()).orElse(null);
                    if (null!=basePatientDO){
                        if (StringUtils.isNotBlank(basePatientDO.getIdcard())){
                            patientAge = DateUtil.getAgeForIdcard(basePatientDO.getIdcard());
@ -8102,7 +8102,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                hospitalWaitingRoomDao.save(roomDO);
            }
        }
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outpatientCode);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientCode).orElse(null);
        wlyyOutpatientDO.setDoctor(doctor);
        wlyyOutpatientDO.setDoctorName(baseDoctorDO.getName());
        outpatientDao.save(wlyyOutpatientDO);
@ -8336,7 +8336,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        System.out.println("获取顺丰物流面单信息:1");
                        sfexpress_obj = expressageDOList.get(0);
                        System.out.println("获取顺丰物流面单信息:2");
                        BasePatientDO basePatientDO = basePatientDao.getOne(wlyyPrescriptionDOS.getPatientCode());
                        BasePatientDO basePatientDO = basePatientDao.findById(wlyyPrescriptionDOS.getPatientCode()).orElse(null);
                        //如果该处方的快递单号已生成,则说明已经下单成功,不需要重复下单,直接返回面单信息
                        System.out.println("获取顺丰物流面单信息:3");
                        if (org.apache.commons.lang.StringUtils.isNotBlank(sfexpress_obj.getMailno())) {
@ -8574,7 +8574,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.getOne(outpatientDO.getPatient());
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient()).orElse(null);
        outpatientDO.setMjz("mz");
        outpatientDO.setStatus("0");
@ -8661,7 +8661,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                systemMessageDO.setData(data.toString());
                logger.info("添加模板消息4");
                systemMessageService.saveMessage(systemMessageDO);
                BasePatientDO patient = basePatientDao.getOne(outpatient.getPatient());
                BasePatientDO patient = basePatientDao.findById(outpatient.getPatient()).orElse(null);
                if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                    ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
                }
@ -8708,7 +8708,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                systemMessageDO.setData(data.toString());
                logger.info("添加模板消息4");
                systemMessageService.saveMessage(systemMessageDO);
                BasePatientDO patient = basePatientDao.getOne(outpatient.getPatient());
                BasePatientDO patient = basePatientDao.findById(outpatient.getPatient()).orElse(null);
                if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                    ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
                }
@ -8767,7 +8767,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                systemMessageDO.setData(data.toString());
                systemMessageService.saveMessage(systemMessageDO);
            }
            BasePatientDO patient = basePatientDao.getOne(outpatient.getPatient());
            BasePatientDO patient = basePatientDao.findById(outpatient.getPatient()).orElse(null);
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
            }
@ -8829,7 +8829,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                sendWxTemplateMsg(wechatId, outpatient.getId(),null, type, "payRemind", "");
            }
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                BasePatientDO patient = basePatientDao.getOne(outpatient.getPatient());
                BasePatientDO patient = basePatientDao.findById(outpatient.getPatient()).orElse(null);
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
            }
        }
@ -8837,7 +8837,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (consultTeamDo!=null){
            BaseDoctorDO doctorDO = baseDoctorDao.findByIdAndDel(consultTeamDo.getDoctor());
            BasePatientDO patientDO = basePatientDao.getOne(consultTeamDo.getPatient());
            BasePatientDO patientDO = basePatientDao.findById(consultTeamDo.getPatient()).orElse(null);
            if (consultTeamDo.getType()==17){
                type = "17";
                msg = patientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
@ -8889,7 +8889,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        WlyyOutpatientDO one = outpatientDao.getOne(outpatientDO.getId());
        WlyyOutpatientDO one = outpatientDao.findById(outpatientDO.getId()).orElse(null);
        if (StringUtils.isNotBlank(one.getDoctor())&&(one.getStatus().equalsIgnoreCase("1")||one.getStatus().equalsIgnoreCase("2"))) {
            throw new RuntimeException("已有医生接诊");
        }
@ -8996,7 +8996,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public Map<String, Object> checkOauthQRCode(String authorizeNo) {
        Map<String, Object> rsMap = new HashedMap();
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.getOne("ylz_config");
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_config").orElse(null);
        try {
            TransRequest e = new TransRequest();
            e.setMethod("ehc.ehealthcard.auth.query");
@ -9405,7 +9405,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        //更改门诊状态
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outPatientId);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outPatientId).orElse(null);
        wlyyOutpatientDO.setStatus("-1");
        wlyyOutpatientDO.setDoctorCancelRemark(cancelRemark);
        wlyyOutpatientDO.setDoctorCancelType(cancelType);
@ -9575,7 +9575,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String patientId = null;
        if (StringUtils.isNotBlank(patient)) {
            /*patientId = patientMappingService.findHisPatNoByPatient(patient);*/
            BasePatientDO patientDO = basePatientDao.getOne(patient);
            BasePatientDO patientDO = basePatientDao.findById(patient).orElse(null);
            if (patientDO==null){
                return null;
            }
@ -9903,7 +9903,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param status
     */
    public void updateStatus(String prescriptionId, Integer status) {
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.getOne(prescriptionId);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
        prescriptionDao.updateStatus( status, new Date(),prescriptionId);
        prescriptionLogService.addPrescriptionLog(prescriptionId, status, 1, wlyyPrescriptionDO.getPatientCode(), wlyyPrescriptionDO.getPatientName(), null, new Date());
    }
@ -9942,11 +9942,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        prescriptionCheckDO.setStatus(status);
        prescriptionCheckDO.setPrescriptionId(prescriptionId);
        prescriptionCheckDO = prescriptionCheckDao.save(prescriptionCheckDO);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.getOne(prescriptionId);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
        if (status == 2) {
            /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
            logger.info("开始=====" + wlyyPrescriptionDO.getCheckStatus());
            WlyyOutpatientDO outpatientDO = outpatientDao.getOne(wlyyPrescriptionDO.getOutpatientId());
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId()).orElse(null);
            DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
            List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId, 1);
@ -9993,7 +9993,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }
                    if (map.get("code").toString().equalsIgnoreCase("1")) {
                        //  * @param applyDepaName @param applyDoctorName
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.getOne(prescriptionId);
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
                        String patientCode = outpatientDO.getConsumer();
                        String realerOrder = prescriptionDO.getRealOrder();
@ -10005,7 +10005,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        }
                        String voucherNo = map.get("voucherNo") + "";
                        String applyDoctorName = prescriptionDO.getDoctorName();
                        BasePatientDO patientDO = basePatientDao.getOne(patientCode);
                        BasePatientDO patientDO = basePatientDao.findById(patientCode).orElse(null);
                        String userName = null;
                        String idcard = null;
                        if (patientDO != null) {
@ -10035,7 +10035,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        if ("0".equals(rsCode)) {
                            free = res.getString("@total_charge");
                        }
                        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("isSendYlzMes");
                        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isSendYlzMes").orElse(null);
                        if (hospitalSysDictDO==null){
                            ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1","WX_PUB");
                        }else if (hospitalSysDictDO.getDictValue().equalsIgnoreCase("0")){
@ -10118,7 +10118,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                   healthCareService.doctorPrescriptionUploadEntrance(prescriptionId);
                                }
                                //  * @param applyDepaName @param applyDoctorName
                                WlyyPrescriptionDO prescriptionDO = prescriptionDao.getOne(prescriptionId);
                                WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
                                String patientCode = outpatientDO.getConsumer();
                                String realerOrder = prescriptionDO.getRealOrder();
@ -10130,7 +10130,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                }
                                String voucherNo = outpatientDO.getRegisterNo();
                                String applyDoctorName = prescriptionDO.getDoctorName();
                                BasePatientDO patientDO = basePatientDao.getOne(patientCode);
                                BasePatientDO patientDO = basePatientDao.findById(patientCode).orElse(null);
                                String userName = null;
                                String idcard = null;
                                if (patientDO != null) {
@ -10216,7 +10216,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        if (object!=null){
                            if (object.getString("code").equalsIgnoreCase("0")){
                                //  * @param applyDepaName @param applyDoctorName
                                WlyyPrescriptionDO prescriptionDO = prescriptionDao.getOne(prescriptionId);
                                WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
                                String patientCode = outpatientDO.getConsumer();
                                String realerOrder = prescriptionDO.getRealOrder();
@ -10228,7 +10228,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                }
                                String voucherNo = outpatientDO.getRegisterNo();
                                String applyDoctorName = prescriptionDO.getDoctorName();
                                BasePatientDO patientDO = basePatientDao.getOne(patientCode);
                                BasePatientDO patientDO = basePatientDao.findById(patientCode).orElse(null);
                                String userName = null;
                                String idcard = null;
                                if (patientDO != null) {
@ -10294,7 +10294,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            } catch (Exception e) {
                e.printStackTrace();
            }
            BasePatientDO patient = basePatientDao.getOne(outpatientDO.getPatient());
            BasePatientDO patient = basePatientDao.findById(outpatientDO.getPatient()).orElse(null);
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString());
            }
@ -10313,11 +10313,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if(!demoFlag) {
                    //同步his
                    try {
                        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(wlyyPrescriptionDO.getOutpatientId());
                        WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId()).orElse(null);
                        ykyyEntranceService.findByRealOrder(prescriptionId, demoFlag);
                        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                        logger.info("cfsb", wlyyPrescriptionDO.getRealOrder());
                        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("YKTCONTROL");
                        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("YKTCONTROL").orElse(null);
                        if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
                        } else {
@ -10389,7 +10389,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        prescriptionCheckDO.setJobName(jobName);
        prescriptionCheckDO.setPrescriptionId(prescriptionId);
        prescriptionCheckDO = prescriptionCheckDao.save(prescriptionCheckDO);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.getOne(prescriptionId);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
        if (status == 3) {
            wlyyPrescriptionDO.setStatus(10);
            wlyyPrescriptionDO.setCheckStatus(0);
@ -10446,12 +10446,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            JSONObject data = new JSONObject();
            Integer age = 0;
            String gender = "";
            BasePatientDO patientDO = basePatientDao.getOne(prescriptionDO.getPatientCode());
            BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode()).orElse(null);
            if (null!=patientDO&&StringUtils.isNotBlank(patientDO.getIdcard())) {
                age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard());
                gender = IdCardUtil.getSexForIdcard(patientDO.getIdcard());
            }
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(prescriptionDO.getOutpatientId());
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).orElse(null);
            String conditiaon="";
            if (wlyyOutpatientDO!=null){
                data.put("consumerName",wlyyOutpatientDO.getConsumerName());
@ -10514,7 +10514,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @throws Exception
     */
    public WlyyPrescriptionVO selectByPrescriptionId(String prescriptionId) throws Exception {
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.getOne(prescriptionId);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
        if (wlyyPrescriptionDO != null) {
            List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(wlyyPrescriptionDO.getDoctor());
            String deptName = null;
@ -10527,12 +10527,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                deptName = doctorHospitalDO.getDeptName();
                hospitalName = doctorHospitalDO.getOrgName();
            }
            BasePatientDO patientDO = basePatientDao.getOne(wlyyPrescriptionDO.getPatientCode());
            BasePatientDO patientDO = basePatientDao.findById(wlyyPrescriptionDO.getPatientCode()).orElse(null);
            if (patientDO!=null){
                sex = patientDO.getSex()+"";
                age = DateUtil.getAgeForIdcard(patientDO.getIdcard())+"";
            }
            WlyyOutpatientDO outpatientDO = outpatientDao.getOne(wlyyPrescriptionDO.getOutpatientId());
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId()).orElse(null);
            if (outpatientDO!=null){
                cardNo = outpatientDO.getCardNo();
            }
@ -10593,10 +10593,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public void zsSynHis(String prescriptionId) {
        try {
            WlyyPrescriptionDO prescriptionDO = prescriptionDao.getOne(prescriptionId);
            WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
            List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId, 1);
            WlyyOutpatientDO outpatientDO = outpatientDao.getOne(prescriptionDO.getOutpatientId());
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).orElse(null);
            DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
            //his处方拼接开方条件
@ -10657,7 +10657,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            List<Map<String,Object>> map = hibenateUtils.createSQLQuery(sql);
            if(map!=null&&map.size()>0){
                String outpatientId= map.get(0).get("relationCode").toString();
               WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outpatientId);
               WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
               if (wlyyOutpatientDO!=null){
                   StringBuffer content = new StringBuffer();
                   StringBuffer icd10Code = new StringBuffer();
@ -10702,7 +10702,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    public String readOutPatient(String registerSn) throws Exception {
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.getOne("HAI_TAI_URL");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL").orElse(null);
        if (wlyyHospitalSysDictDO != null) {
            url = wlyyHospitalSysDictDO.getDictCode();
        }
@ -10740,7 +10740,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public WlyyPrescriptionEmrDO readOutPatientXml(String registerSn) throws Exception {
        WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = new WlyyPrescriptionEmrDO();
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.getOne("HAI_TAI_URL");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL").orElse(null);
        if (wlyyHospitalSysDictDO != null) {
            url = wlyyHospitalSysDictDO.getDictCode();
        }
@ -10789,7 +10789,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        PatientMappingDO mappingDO = patientMappingDao.findByPatient(patient);
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.getOne("HAI_TAI_OUTPATIENT_URL");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_OUTPATIENT_URL").orElse(null);
        if (wlyyHospitalSysDictDO != null) {
            url = wlyyHospitalSysDictDO.getDictCode();
        }
@ -10824,7 +10824,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public net.sf.json.JSON outpmedicaldoc(String patient) throws Exception {
        PatientMappingDO mappingDO = patientMappingDao.findByPatient(patient);
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.getOne("HAI_TAI_OUTPATIENT_URL");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_OUTPATIENT_URL").orElse(null);
        if (wlyyHospitalSysDictDO != null) {
            url = wlyyHospitalSysDictDO.getDictCode();
        }
@ -10852,7 +10852,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public net.sf.json.JSON getPatInfoDataXml(String opid,String recSn) throws Exception {
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.getOne("HAI_TAI_OUTPATIENT_URL");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_OUTPATIENT_URL").orElse(null);
        if (wlyyHospitalSysDictDO != null) {
            url = wlyyHospitalSysDictDO.getDictCode();
        }
@ -10879,7 +10879,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public String writeOutPatient(String registerSn, String chiefComplaint, String hpi, String elapsemhis, String bodycheck, String assistanTcheck, String doctorId, String doctorName) throws Exception {
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.getOne("HAI_TAI_URL");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL").orElse(null);
        if (wlyyHospitalSysDictDO != null) {
            url = wlyyHospitalSysDictDO.getDictCode();
        }
@ -11126,7 +11126,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public PageEnvelop findPatientAllPrescription(String keyName, String status, Integer page, Integer size,String patient,String isSelectDrug,boolean consumerflag) {
        BasePatientDO patientDO = basePatientDao.getOne(patient);
        BasePatientDO patientDO = basePatientDao.findById(patient).orElse(null);
        if (patientDO==null){
            return PageEnvelop.getError("找不到该患者",-1);
        }
@ -11292,18 +11292,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (wxWechatDO == null) {
            throw new Exception("微信配置不存在!");
        }
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.getOne(prescriptionId);
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
        if (prescriptionDO == null) {
            throw new Exception("处方不存在!");
        }
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(oupatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(oupatientId).orElse(null);
        List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getConsumer());
        if (patientWechatDos == null || patientWechatDos.size() == 0) {
            throw new Exception("openid不存在!");
        }
        BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(oupatientId);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(oupatientId).orElse(null);
        String idcard = null;
        if (wlyyOutpatientDO != null) {
            idcard = wlyyOutpatientDO.getCardNo();
@ -11324,7 +11324,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        BaseNatAppointmentDO natAppointmentDO = baseNatAppointmentDao.findById(id).orElse(null);
        BasePatientDO patientDO = basePatientDao.getOne(natAppointmentDO.getPatientId());
        BasePatientDO patientDO = basePatientDao.findById(natAppointmentDO.getPatientId()).orElse(null);
        List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wxId, natAppointmentDO.getPatientId());
        if (patientWechatDos == null || patientWechatDos.size() == 0) {
            throw new Exception("openid不存在!");
@ -11417,12 +11417,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public void SOF_SignDataWithExtraInfo(WlyyPrescriptionDO prescriptionDO) throws Exception {
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
        BaseDoctorDO doctorDO = baseDoctorDao.findByIdAndDel(prescriptionDO.getDoctor());
        BasePatientDO patientDO = basePatientDao.getOne(prescriptionDO.getPatientCode());
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(prescriptionDO.getOutpatientId());
        BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode()).orElse(null);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).orElse(null);
        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.getOne(prescriptionDO.getOutpatientId());
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).orElse(null);
        List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(), 1);
        List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionDO.getId(), 1);
@ -11483,11 +11483,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @throws Exception
     */
    public void SOF_SignDataWithExtraInfoEmr(WlyyPrescriptionEmrDO prescriptionEmrDO) throws Exception {
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.getOne(prescriptionEmrDO.getPrescriptionId());
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionEmrDO.getPrescriptionId()).orElse(null);
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
        BaseDoctorDO doctorDO = baseDoctorDao.findByIdAndDel(prescriptionDO.getDoctor());
        BasePatientDO patientDO = basePatientDao.getOne(prescriptionDO.getPatientCode());
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(prescriptionDO.getOutpatientId());
        BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode()).orElse(null);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).orElse(null);
        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);
@ -11557,7 +11557,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    //更新患者的诊断记录
    public Envelop updatePatientDiagnosis(String outpatiendId,String icd10,String icd10Name){
       WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outpatiendId);
       WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatiendId).orElse(null);
        Envelop envelop = new Envelop();
       if (null!=wlyyOutpatientDO){
           if(StringUtils.isNotBlank(icd10)){
@ -11691,7 +11691,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    //作废处方
    public String disablePrescription(String prescriptionId) throws  Exception{
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.getOne(prescriptionId);
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
        if (null!=prescriptionDO){
            String hisId = prescriptionDO.getHisId();
            if("xm_xzzx_wx".equalsIgnoreCase(wechatId)){
@ -11707,7 +11707,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
                logger.info("作废处方开始" + prescriptionDO.getCheckStatus());
                WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
                WlyyOutpatientDO outpatientDO = outpatientDao.getOne(prescriptionDO.getOutpatientId());
                WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).orElse(null);
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByOutPatientIdList(prescriptionDO.getOutpatientId());
                DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
@ -11775,8 +11775,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public String appletSign(String userId){
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.getOne("SDKAPPID");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.getOne("SECRETKEY");
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("SDKAPPID").orElse(null);
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("SECRETKEY").orElse(null);
        if (sysDictDO!=null&&hospitalSysDictDO!=null){
            return GenerateUserSig.GenTLSSignature(Long.parseLong(sysDictDO.getDictValue()),userId,604800,null,hospitalSysDictDO.getDictValue());
        }
@ -11785,8 +11785,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public String yxToken(String userId,String channelName){
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.getOne("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.getOne("YXAPPSECRET");
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY").orElse(null);
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET").orElse(null);
        if (sysDictDO==null){
            return  "找不到对应的key";
        }
@ -11821,8 +11821,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (yxTokenMappingDO!=null){
            return yxTokenMappingDO.getToken();
        }
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.getOne("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.getOne("YXAPPSECRET");
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY").orElse(null);
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET").orElse(null);
        if (sysDictDO==null){
            return  "找不到对应的key";
        }
@ -11875,8 +11875,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (yxTokenMappingDO!=null){
            return yxTokenMappingDO.getToken();
        }
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.getOne("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.getOne("YXAPPSECRET");
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY").orElse(null);
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET").orElse(null);
        if (sysDictDO==null){
            return  "找不到对应的key";
        }
@ -12256,11 +12256,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return  wlyyHospitalSysDictDOS;
    }
    public WlyyHospitalSysDictDO findDictById(String dictId){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.getOne(dictId);
        WlyyHospitalSysDictDO wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findById(dictId).orElse(null);
        return  wlyyHospitalSysDictDOS;
    }
    public WlyyHospitalSysDictDO updateDictById(String dictId,String dictValue){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne(dictId);
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById(dictId).orElse(null);
        if(wlyyHospitalSysDictDO!=null){
            if (StringUtils.isNoneBlank(dictValue)){
                wlyyHospitalSysDictDO.setDictValue(dictValue);
@ -12287,7 +12287,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public WlyyOutpatientDO appointmentRevisitOnDoor(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception {
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.getOne(outpatientDO.getPatient());
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient()).orElse(null);
        BaseDoctorDO doctorDO = baseDoctorDao.findByIdAndDel(outpatientDO.getDoctor());
        outpatientDO.setMjz("mz");
@ -12325,7 +12325,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            expressageDO.setOutpatientId(outpatient.getId());
            prescriptionExpressageDao.save(expressageDO);
        }
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("WX_MONEY");
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("WX_MONEY").orElse(null);
        Double price = 0.0;
        String chargeType1 = null;
        if (doctorDO!=null){
@ -12422,7 +12422,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return outpatient;
    }
    public String savePrescriptionToDoorService(String orderId,String prescriptionId){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("doorServiceUrl");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("doorServiceUrl").orElse(null);
        String url = "";
        if (wlyyHospitalSysDictDO!=null){
            url = wlyyHospitalSysDictDO.getDictValue();
@ -12454,7 +12454,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public Long waitUpdoorCount(String doctor) {
       WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("waitUpdoorCount");
       WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("waitUpdoorCount").orElse(null);
       String url = "";
       if (wlyyHospitalSysDictDO!=null){
           url = wlyyHospitalSysDictDO.getDictValue();
@ -12568,7 +12568,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            Map<String,Object> map = findRandomDoctor();
            net.sf.json.JSONObject rs = new JSONObject();
            if (map!=null){
                WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("natTimeConfig");
                WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("natTimeConfig").orElse(null);
                String isOpen = null;
                if (hospitalSysDictDO!=null){
                    String dictValue = hospitalSysDictDO.getDictValue();
@ -12721,14 +12721,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            }
                            baseNatAppointmentDO =baseNatAppointmentDao.save(baseNatAppointmentDO);
                            if (chargeAmount.equalsIgnoreCase("0")) {
                                BasePatientDO patientDO = basePatientDao.getOne(baseNatAppointmentDO.getPatientId());
                                BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId()).orElse(null);
                                //发送预约成功通知
                                String name1 = patientDO.getName();
                                String idcard = patientDO.getIdcard();
                                String mobile1 = patientDO.getMobile();
                                String url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id=" + baseNatAppointmentDO.getId();
                                String date = DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime());
                                WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.getOne("natConfigTestNew");
                                WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.findById("natConfigTestNew").orElse(null);
                                String addres = "我院五号楼北侧(急诊部后侧)";
                                String timeDes = "6-8小时";
                                if (hospitalSysDictDO1!=null){
@ -12852,7 +12852,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            baseNatAppointmentDO.setHospitalFlag(pushFlag);
            baseNatAppointmentDO.setConsumer(consumer);
            baseNatAppointmentDO.setIdnoType(idnoType);
            BasePatientDO basePatientDO = basePatientDao.getOne(consumer);
            BasePatientDO basePatientDO = basePatientDao.findById(consumer).orElse(null);
            baseNatAppointmentDO.setConsumerName(basePatientDO.getName());
            baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
            //添加订单
@ -12895,7 +12895,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            returnMap.put("realOrder",baseNatAppointmentDO.getRealOrder());
            return returnMap;
        }else if (wechatId.equalsIgnoreCase("xm_tasy_wx")){
            BasePatientDO  basePatientDO = basePatientDao.getOne(patientId);
            BasePatientDO  basePatientDO = basePatientDao.findById(patientId).orElse(null);
            List<WlyyHospitalSysDictDO> tasyList = wlyyHospitalSysDictDao.findByDictName("natConfigList");
            String deptCode = "0001";
            String staffNo = "0001";
@ -12929,7 +12929,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            String HisSeqNo="";
            String orderNum="";
            WlyyHospitalSysDictDO tasyTime = wlyyHospitalSysDictDao.getOne("natTime");
            WlyyHospitalSysDictDO tasyTime = wlyyHospitalSysDictDao.findById("natTime").orElse(null);
            if (tasyTime!=null){
                String natTimeC   = tasyTime.getDictValue();
                if (natTimeC.equalsIgnoreCase("1")){
@ -13143,7 +13143,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
            String applyDepaName = baseNatAppointmentDO.getDeptName();
            String applyDoctorName = baseNatAppointmentDO.getDoctorName();
            BasePatientDO patientDO = basePatientDao.getOne(baseNatAppointmentDO.getPatientId());
            BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId()).orElse(null);
            String userName = null;
            String idcard = null;
            if (patientDO != null) {
@ -13170,7 +13170,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                String responseMsg="";
                String url="";
                String date = DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime());
                WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.getOne("natConfigTestNew");
                WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.findById("natConfigTestNew").orElse(null);
                String addres = "我院五号楼北侧(急诊部后侧)";
                String timeDes = "6-8小时";
                if (hospitalSysDictDO1!=null){
@ -13201,7 +13201,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    System.out.println("结束发送模板消息");
                }
            }else if (pushChannel.equalsIgnoreCase("ALI_PUB")){
                BasePatientDO patientDO = basePatientDao.getOne(baseNatAppointmentDO.getPatientId());
                BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId()).orElse(null);
                com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
                jsonObject.put("code","13");
                jsonObject.put("open_id",patientDO.getAlipayId());
@ -13209,7 +13209,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                jsonObject.put("keyword1",DateUtil.getStringDate());
                String date = DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime());
                jsonObject.put("keyword2","申请人:"+baseNatAppointmentDO.getName()+"\n预约时间:"+date);
                WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.getOne("natConfigTestNew");
                WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.findById("natConfigTestNew").orElse(null);
                String addres = "我院五号楼北侧(急诊部后侧)";
                String timeDes = "6-8小时";
                if (hospitalSysDictDO1!=null){
@ -13247,7 +13247,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            return "核酸项目不存在,发送失败";
        }
        List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>();
        BasePatientDO patientDO = basePatientDao.getOne(baseNatAppointmentDO.getPatientId());
        BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId()).orElse(null);
        String userName = "";
        if (patientDO != null) {
            userName = patientDO.getName();
@ -13416,7 +13416,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public void savePayStatusByHis(String patientId) throws Exception {
        List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientId(patientId);
        for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
            BasePatientDO patientDO = basePatientDao.getOne(baseNatAppointmentDO.getPatientId());
            BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId()).orElse(null);
            String hisId = patientMappingService.findHisPatNoByPatient(patientId,baseNatAppointmentDO.getMedicare());
            logger.info("cardNo:" + baseNatAppointmentDO.getMedicare());
            if(!patientDO.getIdcard().equalsIgnoreCase(baseNatAppointmentDO.getCardNo())){
@ -13473,14 +13473,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    //患者取消预约
    public String cancelNatAppointment (Integer id,String patientId ){
        BasePatientDO patientDO = basePatientDao.getOne(patientId);
        BasePatientDO patientDO = basePatientDao.findById(patientId).orElse(null);
        String res = "";
        if (patientDO!=null){
            try {
                BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findById(id).orElse(null);
                if (null!=baseNatAppointmentDO){
                    if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("natTimeConfig");
                        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("natTimeConfig").orElse(null);
                        String isOpen = null;
                        if (hospitalSysDictDO!=null){
                            String dictValue = hospitalSysDictDO.getDictValue();
@ -13581,7 +13581,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }else if("xm_tasy_wx".equalsIgnoreCase(wechatId)){
                        if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                            logger.info("同步his订单状态"+baseNatAppointmentDO.getRealOrder());
                            WlyyHospitalSysDictDO tasyTime = wlyyHospitalSysDictDao.getOne("natTime");
                            WlyyHospitalSysDictDO tasyTime = wlyyHospitalSysDictDao.findById("natTime").orElse(null);
                            if (tasyTime!=null){
                                if (tasyTime.getDictValue().equalsIgnoreCase("1")){
                                    //取消号源
@ -13638,7 +13638,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        code:通知代码,⽀付成功为“3” open_id:⽀付宝⽤户ID first: 您好,恭喜⽀付成功! fee: ⾦额
        fee_type_name: 费⽤类型 url: 通知详情跳转链接 remark: 备注,以\n换⾏*/
        BasePatientDO patientDO = basePatientDao.getOne(patientId);
        BasePatientDO patientDO = basePatientDao.findById(patientId).orElse(null);
        if (code.equalsIgnoreCase("3")){
            jsonObject.put("code",code);
@ -13661,7 +13661,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "预约时间:"+reserverTime+"\n" +
                    "发票流水号:"+realorder+"");
            BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findById(id).orElse(null);
            WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.getOne("natConfigTestNew");
            WlyyHospitalSysDictDO hospitalSysDictDO1 = wlyyHospitalSysDictDao.findById("natConfigTestNew").orElse(null);
            String addres = "我院五号楼北侧(急诊部后侧)";
            String timeDes = "6-8小时";
            if (hospitalSysDictDO1!=null){
@ -14179,7 +14179,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            String sender ="";//发送系统
            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            if ("OL_PAY_SUCCESS".equalsIgnoreCase(msgType)){//在线问诊-已支付问诊费
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outpatientId);
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientId);
                if(businessOrderDO!=null){
                    msgId=businessOrderDO.getOrderNo().substring(5);
@ -14206,7 +14206,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            }else if ("OL_WZ_CANCEL".equalsIgnoreCase(msgType)||"OL_WZCS_CANCEL".equalsIgnoreCase(msgType)){
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outpatientId);
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientId);
                if(businessOrderDO!=null){
                    msgId=businessOrderDO.getOrderNo().substring(5);
@ -14228,11 +14228,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            }else if ("OL_WZ_START".equalsIgnoreCase(msgType)||"OL_WZ_END".equalsIgnoreCase(msgType)||"OL_YSTZ".equalsIgnoreCase(msgType)||"OL_JSTX".equalsIgnoreCase(msgType)){
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outpatientId);
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
                if (wlyyOutpatientDO!=null){
                    visitId = wlyyOutpatientDO.getRegisterNo();
                    if (StringUtils.isNoneBlank(prescriptionId)){
                        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.getOne(prescriptionId);
                        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
                        if(wlyyPrescriptionDO!=null){
                            msgId=wlyyPrescriptionDO.getVoucherNo();
                        }
@ -14254,11 +14254,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            } else if ("OL_JS_SUCCESS".equalsIgnoreCase(msgType)){
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(outpatientId);
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId).orElse(null);
                if (wlyyOutpatientDO!=null){
                    visitId = wlyyOutpatientDO.getRegisterNo();
                    if (StringUtils.isNoneBlank(prescriptionId)){
                        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.getOne(prescriptionId);
                        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findById(prescriptionId).orElse(null);
                        if(wlyyPrescriptionDO!=null){
                            msgId=wlyyPrescriptionDO.getVoucherNo();
                        }
@ -14319,7 +14319,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }*/
    public String findDomainUrlInDict(){
        try {
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("domainUrl");
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("domainUrl").orElse(null);
            if (wlyyHospitalSysDictDO!=null){
                return wlyyHospitalSysDictDO.getDictValue();
            }else {
@ -14340,11 +14340,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    public com.alibaba.fastjson.JSONObject getSettlementInfo(String outpatientId,Integer flag) throws Exception {
        logger.info("获取患者待结算信息开始!");
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        if(outpatientDO==null){
            throw new Exception("门诊信息为空");
        }
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.getOne("ylzConfigOrgCode");
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("ylzConfigOrgCode").orElse(null);
        if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
            xzzxEntranceService.getSettleInfHospital(outpatientDO.getCardNo(),outpatientId,sysDictDO.getDictValue());
            logger.info("获取患者待结算信息结束!");
@ -14474,7 +14474,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    public String electronicPrescriptionReceiving(String outpatientId) {
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        if (outpatientDO.getMedicalState()!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
            try {
                healthCareService.electronicPrescriptionReceiving(outpatientId);
@ -14497,7 +14497,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public String confirmSettlementInfo(String outpatientId,String code) throws Exception {
        logger.info("获取患者待结算信息开始!");
        String result = "";
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        if(outpatientDO==null){
            throw new Exception("门诊信息为空");
        }
@ -14522,7 +14522,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @throws Exception
     */
    public String confirmSettlementService(String outpatientId) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        if (outpatientDO==null){
            throw new Exception("未找到待结算记录");
        }
@ -14543,7 +14543,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @throws Exception
     */
    public String confirmSettlement(String outpatientId) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        if (outpatientDO==null){
            throw new Exception("未找到待结算记录");
        }
@ -14654,7 +14654,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                logger.info("变更医保结算状态成功");
                String realOrder = msgInfoJson.getString("xtgzh0");
                List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderAndStatusList(realOrder);
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(ylzMedicalRelationDO.getRelationCode());
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(ylzMedicalRelationDO.getRelationCode()).orElse(null);
                String title = "";
                if (wlyyOutpatientDO.getHisStatus()==null){
                    title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!结算费用包含本次在线问诊的复诊诊查费:"+wlyyOutpatientDO.getFee()+"元。";
@ -14732,7 +14732,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    public String sendMessageManger(String receiver,String receiverType,String oupatientId,String businessType,String sendType){
        String msg = "";
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.getOne(oupatientId);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(oupatientId).orElse(null);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findByIdAndDel(wlyyOutpatientDO.getDoctor());
        if (StringUtils.isNoneBlank(receiverType)&&receiver.equalsIgnoreCase("1")){
            if (sendType.equalsIgnoreCase("2")){
@ -15148,7 +15148,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            com.alibaba.fastjson.JSONObject objectString = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(prescriptionDO);
            List<WlyyPrescriptionInfoDO> infoDOList = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(),1);
            objectString.put("info",infoDOList);
            WlyyOutpatientDO outpatientDO = outpatientDao.getOne(prescriptionDO.getOutpatientId());
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).orElse(null);
            if (outpatientDO!=null){
                objectString.put("consumerName",outpatientDO.getConsumerName());
            }else {
@ -15255,7 +15255,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            object.put("remainTotal","1");
            object.put("isOpen","1");
            WlyyHospitalSysDictDO hospitalSysDictDO2 = hospitalSysDictDao.getOne("natTimeConfig2");
            WlyyHospitalSysDictDO hospitalSysDictDO2 = hospitalSysDictDao.findById("natTimeConfig2").orElse(null);
            if (hospitalSysDictDO2!=null){
                if (StringUtils.isNoneBlank(hospitalSysDictDO2.getDictValue())){
                    com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(hospitalSysDictDO2.getDictValue());
@ -15289,7 +15289,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        GregorianCalendar ca = new GregorianCalendar();
        //i结果为“0”是上午 结果为“1”是下午
        Integer  i = ca.get(GregorianCalendar.AM_PM);
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.getOne("natTimeConfig");
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("natTimeConfig").orElse(null);
        String isOpen = null;
        String sql = "SELECT COUNT(1) as count FROM `base_nat_appointment` where is_success = 1 and pay_status=1 ";
        if (hospitalSysDictDO!=null){
@ -15310,7 +15310,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            Date startPmDate = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+startPm);
            Date endPmDate = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+endPm);
            WlyyHospitalSysDictDO hospitalSysDictDO2 = hospitalSysDictDao.getOne("natTimeConfig2");
            WlyyHospitalSysDictDO hospitalSysDictDO2 = hospitalSysDictDao.findById("natTimeConfig2").orElse(null);
            if (hospitalSysDictDO2!=null){
                if (StringUtils.isNoneBlank(hospitalSysDictDO2.getDictValue())){
                    com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(hospitalSysDictDO2.getDictValue());

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

@ -16,16 +16,15 @@ import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.prescription.dao.BaseNatAppointmentDao;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.util.date.DateUtil;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,8 +32,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
@ -461,7 +458,7 @@ public class TasyNatService {
//        jsonObject.put("amount",amount);
    public String placeOrder(JSONObject jsonObject){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("placeOrderUrl");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("placeOrderUrl").orElse(null);
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
@ -482,7 +479,7 @@ public class TasyNatService {
    public String orderStatus(JSONObject jsonObject){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("orderStatusUrl");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("orderStatusUrl").orElse(null);
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
@ -495,7 +492,7 @@ public class TasyNatService {
    public String tmpPush(JSONObject jsonObject){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("tmpPushUrl");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("tmpPushUrl").orElse(null);
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
@ -526,7 +523,7 @@ public class TasyNatService {
        JSONObject key4=new JSONObject();
        JSONObject key5=new JSONObject();
        JSONObject remark=new JSONObject();
        BaseNatAppointmentDO baseNatAppointmentD0 = baseNatAppointmentDao.getOne(Integer.valueOf(relationCode));
        BaseNatAppointmentDO baseNatAppointmentD0 = baseNatAppointmentDao.findById(Integer.valueOf(relationCode)).orElse(null);
        List<BasePatientWechatDo> basePatientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId("xm_tasy_wx",patient);
        if (basePatientWechatDo!=null&&basePatientWechatDo.size()>0){
            openId=basePatientWechatDo.get(0).getOpenid();
@ -648,7 +645,7 @@ public class TasyNatService {
    //查询排班部门
    public String departMent(String ApplyType){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("DepartMentUrl");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("DepartMentUrl").orElse(null);
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
@ -663,7 +660,7 @@ public class TasyNatService {
    public String saveRegOrder(String DepartId,String OrderDate,String OrderTime,String OrderID,String HisID,String Tel,
                               String HisName,String ApplyType){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("saveNatOrderUrl");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("saveNatOrderUrl").orElse(null);
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
@ -678,7 +675,7 @@ public class TasyNatService {
    //取消预约
    public String cancleOrder(String HisID,String HisSeqNo,String OrderNumber) throws Exception{
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("CancleOrderUrl");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("CancleOrderUrl").orElse(null);
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
@ -693,7 +690,7 @@ public class TasyNatService {
    //查询排班医生
    public String GetDoctorWorkDate(String ApplyType,String DepartId){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("GetDoctorWorkDateUrl");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("GetDoctorWorkDateUrl").orElse(null);
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
@ -707,7 +704,7 @@ public class TasyNatService {
    //预约查询
    public String GetOrderInfo(String HisID,String ApplyType){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("GetOrderInfoUrl");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("GetOrderInfoUrl").orElse(null);
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
@ -721,7 +718,7 @@ public class TasyNatService {
    //获取号源
    public String GetOrderSource(String DepartId,String DoctorId,String QueryDate,String ApplyType,String IsAll,String QueryTime){
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("GetOrderSourceUrl");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("GetOrderSourceUrl").orElse(null);
        if (wlyyHospitalSysDictDO!=null){
            url=wlyyHospitalSysDictDO.getDictValue();
        }
@ -959,7 +956,7 @@ public class TasyNatService {
    public String selectByRelationCode(String relationCode) throws  Exception{
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        if (NumberUtils.isDigits(relationCode) ){
            BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.getOne(Integer.valueOf(relationCode));
            BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findById(Integer.valueOf(relationCode)).orElse(null);
            if (baseNatAppointmentDO!=null&&"-1".equalsIgnoreCase(baseNatAppointmentDO.getIsSuccess())){
                throw new Exception("订单已取消");
            }
@ -1009,7 +1006,7 @@ public class TasyNatService {
        return businessOrderDO.getRematk();
    }
    public String getNatResult(String patientId) throws Exception{
        BasePatientDO basePatientDO = basePatientDao.getOne(patientId);
        BasePatientDO basePatientDO = basePatientDao.findById(patientId).orElse(null);
        Calendar c = Calendar.getInstance();
        c.add(Calendar.MONTH, -6);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@ -1075,8 +1072,8 @@ public class TasyNatService {
        return json;
    }
    public  Map checkBalance(String relationCode) throws  Exception{
        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.getOne(Integer.parseInt(relationCode));
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.getOne("MzBalance");
        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findById(Integer.parseInt(relationCode)).orElse(null);
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("MzBalance").orElse(null);
        String tmpBalance="";
        if (wlyyHospitalSysDictDO!=null){
            tmpBalance=wlyyHospitalSysDictDO.getDictValue();

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

@ -231,7 +231,7 @@ public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pr
        List<WlyyOutpatientVO> wlyyOutpatientVOS = tnyyEntranceService.BS30025(patNo,conNo,null,null,demoFlag,ksdm);
        if (wlyyOutpatientVOS!=null&&wlyyOutpatientVOS.size()!=0){
            WlyyOutpatientVO outpatientVO = wlyyOutpatientVOS.get(0);
            BasePatientDO patientDO = basePatientDao.getOne(patient);
            BasePatientDO patientDO = basePatientDao.findById(patient).orElse(null);
            if (patientDO!=null){
                outpatientVO.setSex(patientDO.getSex()+"");
                outpatientVO.setBirthday(patientDO.getBirthday());

+ 11 - 11
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/XzyyPrescriptionService.java

@ -231,7 +231,7 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    public JSONObject refundRegisterNo(String outpatientId) throws Exception {
        JSONObject object = new JSONObject();
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(outpatientId);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
        if(outpatientDO!=null){
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(outpatientDO.getDoctor());
            if (StringUtils.isNoneBlank(outpatientDO.getRegisterNo())){
@ -267,7 +267,7 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @throws Exception
     */
    public String SOF_SignDataWithExtraInfo(WlyyPrescriptionDO prescriptionDO) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(prescriptionDO.getOutpatientId());
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).orElse(null);
        List<WlyyPrescriptionInfoDO> infoDOS = infoDao.findByPrescriptionId(prescriptionDO.getId(), 1);
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = diagnosisDao.findByPrescriptionId(prescriptionDO.getId(),1);
        JSONObject object = new JSONObject();
@ -284,7 +284,7 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            hashType = data.getString("hashType");
        }
        BasePatientDO patientDO = patientDao.getOne(outpatientDO.getPatient());
        BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient()).orElse(null);
        BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(outpatientDO.getDoctor());
        if (patientDO!=null&&doctorDO!=null){
            String patientName = patientDO.getName();
@ -313,7 +313,7 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @throws Exception
     */
    public void SOF_SignDataWithExtraInfoEmr(WlyyPrescriptionDO prescriptionDO) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.getOne(prescriptionDO.getOutpatientId());
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()).orElse(null);
        WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionDO.getId());
        JSONObject object = new JSONObject();
        object.put("emr",prescriptionEmrDO);
@ -329,7 +329,7 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            hashType = data.getString("hashType");
        }
        BasePatientDO patientDO = patientDao.getOne(outpatientDO.getPatient());
        BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient()).orElse(null);
        BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(outpatientDO.getDoctor());
        if (patientDO!=null&&doctorDO!=null){
            String patientName = patientDO.getName();
@ -357,7 +357,7 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     */
    public JSONObject computeDigestForAlg(String content){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.getOne("oauth_ca_config");
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findById("oauth_ca_config").orElse(null);
            String url = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/common/computeDigestForAlg";
@ -388,7 +388,7 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     */
    public JSONObject synRecipeInfo(String templateId,String urId,String patientName,String patientAge,String patientSex,String patientCardType,String recipeTime,String hashValue,String hashType,String openId,String patientCard){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.getOne("oauth_ca_config");
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findById("oauth_ca_config").orElse(null);
            String url = "";
            String clientId= "";
            String clientSecret = "";
@ -438,7 +438,7 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     */
    public JSONObject selfSignRequest(String openId,String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.getOne("oauth_ca_config");
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findById("oauth_ca_config").orElse(null);
            String url = "";
            String clientId= "";
            String clientSecret = "";
@ -475,7 +475,7 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     */
    public JSONObject selfSignGetResult(BaseDoctorDO baseDoctorDO, String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.getOne("oauth_ca_config");
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findById("oauth_ca_config").orElse(null);
            String url = "";
            String clientId= "";
            String clientSecret = "";
@ -520,7 +520,7 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     */
    public JSONObject selfSignQuit(String openId,String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.getOne("oauth_ca_config");
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findById("oauth_ca_config").orElse(null);
            String url = "";
            String clientId= "";
            String clientSecret = "";
@ -555,7 +555,7 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        JSONObject jsonObject = new JSONObject();
        if (baseDoctorDO!=null){
            int defaultMinute=360;
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO=wlyyHospitalSysDictDao.getOne("singTimeControl");
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO=wlyyHospitalSysDictDao.findById("singTimeControl").orElse(null);
            if (wlyyHospitalSysDictDO!=null){
                defaultMinute=Integer.parseInt(wlyyHospitalSysDictDO.getDictValue());
            }

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -556,7 +556,7 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
     * @return
     */
    public PageEnvelop findPatientAllPrescription(String doctor,String keyName, String status, Integer page, Integer size,String patient,String isSelectDrug) {
        BasePatientDO patientDO = basePatientDao.getOne(patient);
        BasePatientDO patientDO = basePatientDao.findById(patient).orElse(null);
        if (patientDO==null){
            return PageEnvelop.getError("找不到该患者",-1);
        }

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -484,7 +484,7 @@ public class WxTemplateService {
                                +"' and w.OPENID = '"+relationCode+"' and w.scene = 'zxzfts' and w.WECHAT_ID='"+wechatId+"'";
                        List<Map<String, Object>> count = hibenateUtils.createSQLQuery(countSql);
                        if(count==null || count.size() == 0){
                            BasePatientDO patientDO = basePatientDao.getOne(patient);
                            BasePatientDO patientDO = basePatientDao.findById(patient).orElse(null);
                            BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(doctor);
                            List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,patient);
                            if(ps.isEmpty()){