Bladeren bron

代码修改

LAPTOP-KB9HII50\70708 1 jaar geleden
bovenliggende
commit
490a27fc70

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanDO.java

@ -39,7 +39,7 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntity implements S
    @Column(name = "service_package_id")
    private String servicePackageId;//服务包id
    @Column(name = "status")
    private Integer status;//状态(0已中止,1进行中,2已完成)
    private Integer status;//状态(0已中止,1进行中(已下转 已管理),2已完成,3待分配
    @Column(name = "abort_reason")
    private String abortReason;//中止原因
    @Column(name = "abort_time")

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationPatientInfoDO.java

@ -38,8 +38,8 @@ public class RehabilitationPatientInfoDO extends IdEntity {
    private String jwHospitalName;//社区医院名称
    private String hospitalDoctor;//转诊医生
    private Date createTime;//请求时间
    private Integer status;//是否分配下转:0未分配,1已分配(已下转列表),2创建计划过程失败,3患者无住院病历信息(等待重新下转),4不支持该医院自动下转,5同步居民失败,6下转列表(未下转-未签约)
    private String statusName;//是否分配下转:0未分配,1已分配(已下转列表),2创建计划过程失败,3患者无住院病历信息(等待重新下转),4不支持该医院自动下转,5同步居民失败,6下转列表(未下转)
    private Integer status;//是否分配下转:0未分配,1已分配(已下转列表),2已推送i健康 3患者无住院病历信息(等待重新下转),4不支持该医院自动下转,5添加居民失败,6下转列表(未下转-未签约)
    private String statusName;//是否分配下转:0未分配,1已分配(已下转列表),2已推送i健康,3患者无住院病历信息(等待重新下转),4不支持该医院自动下转,5添加居民失败,6下转列表(未下转)
    private String problemCode;//问题代码1001肺癌,1002慢性胃肠病,1003冠心病,1004慢性前列腺疾病,1005慢性乳腺疾病,
                               // 1006慢性阻塞性肺病,1007脂肪肝,1008慢性妇科炎症,1009脑卒中,1010慢性肾病
    private String diagnoseDoctor;//诊断医生

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationPlanTemplateDO.java

@ -57,6 +57,7 @@ public class RehabilitationPlanTemplateDO extends UuidIdentityEntityWithOperator
    //非数据库字段
    private Integer isFamily;//是否关联三师共管专病(1是0否)
    private String familyRelation;//关联专病code
    public String getType() {
        return type;
@ -173,4 +174,13 @@ public class RehabilitationPlanTemplateDO extends UuidIdentityEntityWithOperator
    public void setIsFamily(Integer isFamily) {
        this.isFamily = isFamily;
    }
    @Transient
    public String getFamilyRelation() {
        return familyRelation;
    }
    public void setFamilyRelation(String familyRelation) {
        this.familyRelation = familyRelation;
    }
}

+ 155 - 78
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/service/SynchronizePatientService.java

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.module.rehabilitation.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.BaseFrequencyDictDao;
import com.yihu.jw.dict.dao.FrequencyDao;
@ -128,40 +129,51 @@ public class SynchronizePatientService  {
            saveModifyList(modifyList);
            return "下转数据错误,身份证号不存在";
        }
        List<BasePatientDO> patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//获取患者信息
        if (patientList.size() == 0) {
            //未找到居民,从健康档案添加居民
            patient = patientService.addPaitentByIdcard(re.getIdcard(),re.getName(),re.getSsc(),re.getMobile(),re.getSex());
            if (patient == null) {
                infoUpdate(tmpList,5,modifyList,null);
                saveModifyList(modifyList);
                return "居民信息不存在";
            } else {
                patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//重新获取该患者信息
                patient = patientList.get(0);
        if(StringUtils.isBlank(re.getPatient())){
            List<BasePatientDO> patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//获取患者信息
            if (patientList.size() == 0) {
                //未找到居民,从健康档案添加居民
                patient = patientService.addPaitentByIdcard(re.getIdcard(),re.getName(),re.getSsc(),re.getMobile(),re.getSex());
                if (patient == null) {
                    infoUpdate(tmpList,5,modifyList,null);
                    saveModifyList(modifyList);
                    return "居民信息不存在";
                } else {
                    patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//重新获取该患者信息
                    patient = patientList.get(0);
                }
            }
            infoUpdate4(tmpList,patient.getId(),modifyList);
        }else {
            patient = patientDao.findByIdAndDel(re.getPatient(),"1");
        }
        String dept = re.getDept();
        String diagnosis = re.getDiagnosis();
        //或者三院专病配置
        String sql = "SELECT t.*,d.is_family isFamily,d.id diseaseId,d.name diseaseName FROM base_disease_hospital d,wlyy_rehabilitation_plan_template t " +
                "WHERE d.rehabilitation_template_id=t.id and d.`status`='1' and d.rehabilitation_down_type='1' and d.rehabilitation_type='1'" +
                "and d.dept like '%"+dept+"%' and d.diagnosis like '%"+diagnosis+"%' LIMIT 1";
        List<RehabilitationPlanTemplateDO> diseaseList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RehabilitationPlanTemplateDO.class));
        if(diseaseList.size()==0){
        //专病配置
        RehabilitationPlanTemplateDO planTemplateDO = findPlanTemplate(dept,diagnosis);
        if(planTemplateDO==null){
            return "未找到满足条件的专病配置";
        }
        RehabilitationPlanTemplateDO planTemplateDO = diseaseList.get(0);
        if(planTemplateDO.getIsFamily()==1){
            //推送i健康数据
            com.alibaba.fastjson.JSONObject jsonObject = businessService.pushPatientInfos(re);
            if(jsonObject.getInteger("status")!=-1){
                return "推送i健康失败";
            //判断签约的才推送i健康
            JSONObject isSign = businessService.isSign(re.getIdcard());
            if(isSign==null){
                return "请求i健康失败";
            }
            if(isSign.getJSONObject("obj")!=null){
                //推送i健康数据
                infoUpdate2(tmpList,planTemplateDO.getFamilyRelation(),modifyList);
                saveModifyList(modifyList);
                com.alibaba.fastjson.JSONObject jsonObject = businessService.pushPatientInfos(re);
                if(jsonObject==null||jsonObject.getInteger("status")==-1){
                    return "请求i健康失败";
                }
                Long ijkId = jsonObject.getLong("data");
                infoUpdate3(tmpList,3,ijkId,modifyList,null);
                saveModifyList(modifyList);
                return "推送i健康成功";
            }
            Long ijkId = jsonObject.getLong("data");
            re.setIjkId(ijkId);
            rehabilitationPatientInfoDao.save(re);
            return "推送i健康成功";
        }
        String diseaseId = planTemplateDO.getDiseaseId();
        String diseaseName = planTemplateDO.getDiseaseName();
@ -333,6 +345,19 @@ public class SynchronizePatientService  {
        }
    }
    //获取三院专病配置
    public RehabilitationPlanTemplateDO findPlanTemplate(String dept,String diagnosis){
        String sql = "SELECT t.*,d.is_family isFamily,d.id diseaseId,d.name diseaseName,d.family_relation familyRelation " +
                "FROM base_disease_hospital d,wlyy_rehabilitation_plan_template t " +
                "WHERE d.rehabilitation_template_id=t.id and d.`status`='1' and d.rehabilitation_down_type='1' and d.rehabilitation_type='1'" +
                "and d.dept like '%"+dept+"%' and d.diagnosis like '%"+diagnosis+"%' LIMIT 1";
        List<RehabilitationPlanTemplateDO> diseaseList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RehabilitationPlanTemplateDO.class));
        if(diseaseList.size()==0){
            return null;
        }
        return diseaseList.get(0);
    }
    //基卫补推送出院小结后,重新下转
    public StringBuilder reSynchronizePation(String type,String hospital,String createTime) throws Exception{
        StringBuilder results = new StringBuilder("居民下转\n");
@ -371,43 +396,55 @@ public class SynchronizePatientService  {
                results.append("下转数据错误,身份证号不存在\n");
                continue;
            }
            List<BasePatientDO> patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//获取患者信息
            if (patientList.size() == 0) {
                //未找到居民,从健康档案添加居民
                patient = patientService.addPaitentByIdcard(re.getIdcard(),re.getName(),re.getSsc(),re.getMobile(),re.getSex());
                if (patient == null) {
                    infoUpdate(tmpList,5,modifyList,null);
                    saveModifyList(modifyList);
                    results.append("居民信息不存在\n");
                    continue;
                } else {
                    patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//重新获取该患者信息
                    patient = patientList.get(0);
            if(StringUtils.isBlank(re.getPatient())){
                List<BasePatientDO> patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//获取患者信息
                if (patientList.size() == 0) {
                    //未找到居民,从健康档案添加居民
                    patient = patientService.addPaitentByIdcard(re.getIdcard(),re.getName(),re.getSsc(),re.getMobile(),re.getSex());
                    if (patient == null) {
                        infoUpdate(tmpList,5,modifyList,null);
                        saveModifyList(modifyList);
                        results.append("居民信息不存在\n");
                        continue;
                    } else {
                        patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//重新获取该患者信息
                        patient = patientList.get(0);
                    }
                }
                infoUpdate4(tmpList,patient.getId(),modifyList);
            }else {
                patient = patientDao.findByIdAndDel(re.getPatient(),"1");
            }
            String dept = re.getDept();
            String diagnosis = re.getDiagnosis();
            //或者三院专病配置
            String sql = "SELECT t.*,d.is_family isFamily,d.id diseaseId,d.name diseaseName FROM base_disease_hospital d,wlyy_rehabilitation_plan_template t " +
                    "WHERE d.rehabilitation_template_id=t.id and d.`status`='1' and d.rehabilitation_down_type='1' and d.rehabilitation_type='1'" +
                    "and d.dept like '%"+dept+"%' and d.diagnosis like '%"+diagnosis+"%' LIMIT 1";
            List<RehabilitationPlanTemplateDO> diseaseList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RehabilitationPlanTemplateDO.class));
            if(diseaseList.size()==0){
            //三院专病配置
            RehabilitationPlanTemplateDO planTemplateDO = findPlanTemplate(dept,diagnosis);
            if(planTemplateDO==null){
                results.append("未找到满足条件的专病配置\n");
                continue;
            }
            RehabilitationPlanTemplateDO planTemplateDO = diseaseList.get(0);
            if(planTemplateDO.getIsFamily()==1){
                //推送i健康数据
                com.alibaba.fastjson.JSONObject jsonObject = businessService.pushPatientInfos(re);
                if(jsonObject.getInteger("status")!=-1){
                //判断签约的才推送i健康
                JSONObject isSign = businessService.isSign(re.getIdcard());
                if(isSign==null){
                    results.append("推送i健康失败\n");
                    continue;
                }
                Long ijkId = jsonObject.getLong("data");
                re.setIjkId(ijkId);
                results.append("推送i健康成功\n");
                continue;
                if(isSign.getJSONObject("obj")!=null) {
                    //推送i健康数据
                    infoUpdate2(tmpList,planTemplateDO.getFamilyRelation(),modifyList);
                    saveModifyList(modifyList);
                    com.alibaba.fastjson.JSONObject jsonObject = businessService.pushPatientInfos(re);
                    if(jsonObject==null||jsonObject.getInteger("status")==-1){
                        results.append("推送i健康失败\n");
                        continue;
                    }
                    Long ijkId = jsonObject.getLong("data");
                    infoUpdate3(tmpList,3,ijkId,modifyList,null);
                    saveModifyList(modifyList);
                    results.append("推送i健康成功\n");
                    continue;
                }
            }
            String diseaseId = planTemplateDO.getDiseaseId();
            String diseaseName = planTemplateDO.getDiseaseName();
@ -658,43 +695,55 @@ public class SynchronizePatientService  {
                results.append("下转数据错误,身份证号不存在\n");
                continue;
            }
            List<BasePatientDO> patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//获取患者信息
            if (patientList.size() == 0) {
                //未找到居民,从健康档案添加居民
                patient = patientService.addPaitentByIdcard(re.getIdcard(),re.getName(),re.getSsc(),re.getMobile(),re.getSex());
                if (patient == null) {
                    infoUpdate(tmpList,5,modifyList,null);
                    saveModifyList(modifyList);
                    results.append("居民信息不存在\n");
                    continue;
                } else {
                    patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//重新获取该患者信息
                    patient = patientList.get(0);
            if(StringUtils.isBlank(re.getPatient())){
                List<BasePatientDO> patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//获取患者信息
                if (patientList.size() == 0) {
                    //未找到居民,从健康档案添加居民
                    patient = patientService.addPaitentByIdcard(re.getIdcard(),re.getName(),re.getSsc(),re.getMobile(),re.getSex());
                    if (patient == null) {
                        infoUpdate(tmpList,5,modifyList,null);
                        saveModifyList(modifyList);
                        results.append("居民信息不存在\n");
                        continue;
                    } else {
                        patientList = patientDao.getPatientByIdcardOrSsc(re.getIdcard());//重新获取该患者信息
                        patient = patientList.get(0);
                    }
                }
                infoUpdate4(tmpList,patient.getId(),modifyList);
            }else {
                patient = patientDao.findByIdAndDel(re.getPatient(),"1");
            }
            String dept = re.getDept();
            String diagnosis = re.getDiagnosis();
            //或者三院专病配置
            String sql = "SELECT t.*,d.is_family isFamily,d.id diseaseId,d.name diseaseName FROM base_disease_hospital d,wlyy_rehabilitation_plan_template t " +
                    "WHERE d.rehabilitation_template_id=t.id and d.`status`='1' and d.rehabilitation_down_type='1' and d.rehabilitation_type='1'" +
                    "and d.dept like '%"+dept+"%' and d.diagnosis like '%"+diagnosis+"%' LIMIT 1";
            List<RehabilitationPlanTemplateDO> diseaseList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RehabilitationPlanTemplateDO.class));
            if(diseaseList.size()==0){
            //三院专病配置
            RehabilitationPlanTemplateDO planTemplateDO = findPlanTemplate(dept,diagnosis);
            if(planTemplateDO==null){
                results.append("未找到满足条件的专病配置\n");
                continue;
            }
            RehabilitationPlanTemplateDO planTemplateDO = diseaseList.get(0);
            if(planTemplateDO.getIsFamily()==1){
                //推送i健康数据
                com.alibaba.fastjson.JSONObject jsonObject = businessService.pushPatientInfos(re);
                if(jsonObject.getInteger("status")!=-1){
                //判断签约的才推送i健康
                JSONObject isSign = businessService.isSign(re.getIdcard());
                if(isSign==null){
                    results.append("推送i健康失败\n");
                    continue;
                }
                Long ijkId = jsonObject.getLong("data");
                re.setIjkId(ijkId);
                results.append("推送i健康成功\n");
                continue;
                if(isSign.getJSONObject("obj")!=null) {
                    //推送i健康数据
                    infoUpdate2(tmpList,planTemplateDO.getFamilyRelation(),modifyList);
                    saveModifyList(modifyList);
                    com.alibaba.fastjson.JSONObject jsonObject = businessService.pushPatientInfos(re);
                    if(jsonObject==null||jsonObject.getInteger("status")==-1){
                        results.append("推送i健康失败\n");
                        continue;
                    }
                    Long ijkId = jsonObject.getLong("data");
                    infoUpdate3(tmpList,3,ijkId,modifyList,null);
                    saveModifyList(modifyList);
                    results.append("推送i健康成功\n");
                    continue;
                }
            }
            String diseaseId = planTemplateDO.getDiseaseId();
            String diseaseName = planTemplateDO.getDiseaseName();
@ -989,4 +1038,32 @@ public class SynchronizePatientService  {
        }
    }
    public void infoUpdate2(List<RehabilitationPatientInfoDO> lists,String problemCode,List<RehabilitationPatientInfoDO> modifyList){
        for (RehabilitationPatientInfoDO re:lists){
            re.setProblemCode(problemCode);
            modifyList.remove(re);
            modifyList.add(re);
        }
    }
    public void infoUpdate3(List<RehabilitationPatientInfoDO> lists,Integer status,Long ijkId,List<RehabilitationPatientInfoDO> modifyList,BaseDoctorDO doctorDO){
        for (RehabilitationPatientInfoDO re:lists){
            re.setStatus(status);
            re.setIjkId(ijkId);
            modifyList.remove(re);
            if(status==1&&doctorDO!=null){
                re.setDoctor(doctorDO.getId());
                re.setDoctorName(doctorDO.getName());
                re.setReceiveTime(new Date());
            }
            modifyList.add(re);
        }
    }
    public void infoUpdate4(List<RehabilitationPatientInfoDO> lists,String patient,List<RehabilitationPatientInfoDO> modifyList){
        for (RehabilitationPatientInfoDO re:lists){
            re.setPatient(patient);
            modifyList.remove(re);
            modifyList.add(re);
        }
    }
}