suqinyi 9 ماه پیش
والد
کامیت
1270717cae

+ 397 - 239
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -22,7 +22,6 @@ import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.DsyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -97,46 +96,47 @@ public class WlyyBusinessService {
    /**
     * 推送系统门诊wlyy系统消息
     *
     * @param doctor
     * @param outPatientId
     * @return
     */
    public Boolean sendWlyyOutpatientMes(String doctor,String outPatientId){
    public Boolean sendWlyyOutpatientMes(String doctor, String outPatientId) {
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor).orElse(null);
        if(doctorDO!=null&& StringUtils.isNotBlank(doctorDO.getIdcard())){
            WlyyOutpatientDO outpatientDO =outpatientDao.findById(outPatientId).orElse(null);
        if (doctorDO != null && StringUtils.isNotBlank(doctorDO.getIdcard())) {
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId).orElse(null);
            BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient()).orElse(null);
            JSONObject param = new JSONObject();
            param.put("idCard",doctorDO.getIdcard());
            param.put("sender","hlwyy");
            param.put("senderName","互联网医院");
            param.put("relationCode",outPatientId);
            param.put("idCard", doctorDO.getIdcard());
            param.put("sender", "hlwyy");
            param.put("senderName", "互联网医院");
            param.put("relationCode", outPatientId);
            String sex = "";
            try {
                String sx = IdCardUtil.getSexForIdcard_new(basePatientDO.getIdcard());
                if("1".equals(sx)){
                if ("1".equals(sx)) {
                    sex = "男";
                }else if("2".equals(sx)){
                } else if ("2".equals(sx)) {
                    sex = "女";
                }
            }catch (Exception e){
                logger.error("推送wlyy系统消息 身份证转换性别失败!:"+e.toString());
            } catch (Exception e) {
                logger.error("推送wlyy系统消息 身份证转换性别失败!:" + e.toString());
            }
            String age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())==-1?"未知":IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())+"";
            String age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()) == -1 ? "未知" : IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()) + "";
            String content = "您已向"+outpatientDO.getHospitalName()+outpatientDO.getDeptName()+
                    "医师"+doctorDO.getName()+"发起了协同门诊请求。协同门诊患者:"+outpatientDO.getPatientName()+
                    "("+sex+" "+age+"岁),协同门诊时间:"+ DateUtil.dateToStr(outpatientDO.getRegisterDate(),"yyyy-MM-dd HH:mm");
            String content = "您已向" + outpatientDO.getHospitalName() + outpatientDO.getDeptName() +
                    "医师" + doctorDO.getName() + "发起了协同门诊请求。协同门诊患者:" + outpatientDO.getPatientName() +
                    "(" + sex + " " + age + "岁),协同门诊时间:" + DateUtil.dateToStr(outpatientDO.getRegisterDate(), "yyyy-MM-dd HH:mm");
            param.put("content",content);
            param.put("title","协同门诊消息");
            param.put("type",500);
            param.put("content", content);
            param.put("title", "协同门诊消息");
            param.put("type", 500);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyySendMes",param,null);
            if(rs!=null){
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyySendMes", param, null);
            if (rs != null) {
                return true;
            }
        }
@ -144,22 +144,22 @@ public class WlyyBusinessService {
    }
    public Boolean readWlyyOutpatientMes(String outPatientId){
    public Boolean readWlyyOutpatientMes(String outPatientId) {
        Map<String,Object> res = new HashedMap();
        Map<String, Object> res = new HashedMap();
        WlyyOutpatientDO outpatientDO =outpatientDao.findById(outPatientId).orElse(null);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId).orElse(null);
        if(outpatientDO!=null){
        if (outpatientDO != null) {
            BaseDoctorDO doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor()).orElse(null);
            JSONObject param = new JSONObject();
            param.put("idCard",doctorDO.getIdcard());
            param.put("type",500);
            param.put("relationCode",outPatientId);
            param.put("idCard", doctorDO.getIdcard());
            param.put("type", 500);
            param.put("relationCode", outPatientId);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyReadMes",param,null);
            if(rs!=null){
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyReadMes", param, null);
            if (rs != null) {
                return true;
            }
        }
@ -172,46 +172,47 @@ public class WlyyBusinessService {
     * @param idCard
     * @return
     */
    public Boolean checkSignFamily(String idCard){
    public Boolean checkSignFamily(String idCard) {
        JSONObject param = new JSONObject();
        param.put("idCard",idCard);
        JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyCheckSignFamily",param,null);
        if(rs!=null){
        param.put("idCard", idCard);
        JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyCheckSignFamily", param, null);
        if (rs != null) {
            return true;
        }
        return false;
    }
    
    /**
     * 根据身份证获取i健康居民信息
     *
     * @param idcard
     * @return
     */
    public String getPatientCodeByWlyyIdcard(String idcard) throws Exception {
        BasePatientDO patientDO =  basePatientDao.findByIdcardAndDel(idcard,"1");
        BasePatientDO patientDO = basePatientDao.findByIdcardAndDel(idcard, "1");
        String result = "";
        if(patientDO == null){
    
            Map<String,String> params = new HashMap<>();
            params.put("idcard",idcard);
    
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatient",null,params);
            if(rs!=null){
        if (patientDO == null) {
            Map<String, String> params = new HashMap<>();
            params.put("idcard", idcard);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatient", null, params);
            if (rs != null) {
                Integer status = rs.getInteger("status");
                if(200 == status){
                if (200 == status) {
                    JSONObject data = rs.getJSONObject("data");
                    BasePatientDO patient = new BasePatientDO();
                    String salt = UUID.randomUUID().toString().substring(0,5);
                    String salt = UUID.randomUUID().toString().substring(0, 5);
                    String mobile = data.getString("mobile");
                    String pw = null;
    
                    if(StringUtils.isNotBlank(mobile)){
                        pw = mobile.substring(mobile.length()-6);
                    }else{
                        pw = idcard.substring(idcard.length()-6);
                    if (StringUtils.isNotBlank(mobile)) {
                        pw = mobile.substring(mobile.length() - 6);
                    } else {
                        pw = idcard.substring(idcard.length() - 6);
                    }
    
                    patient.setIdcard(idcard);
                    patient.setName(data.getString("name"));
                    patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
@ -222,10 +223,10 @@ public class WlyyBusinessService {
                    patient.setLocked(0);
                    patient.setCreateTime(new Date());
                    patient.setUpdateTime(new Date());
                    patient.setBirthday(DateUtil.strToDate(data.getString("birthday"),"yyyyMMdd"));
                    patient.setBirthday(DateUtil.strToDate(data.getString("birthday"), "yyyyMMdd"));
                    patient = basePatientDao.save(patient);
                    result = patient.getId();
                    if(data.get("ssc")!=null){
                    if (data.get("ssc") != null) {
                        PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
                        patientMedicareCardDO.setDel("1");
                        patientMedicareCardDO.setPatientCode(patient.getId());
@ -233,20 +234,21 @@ public class WlyyBusinessService {
                        patientMedicareCardDO.setType("A_01");
                        patientMedicareCardDao.save(patientMedicareCardDO);
                    }
                }else{
                } else {
                    throw new Exception("请求i健康接口,获取居民信息失败");
                }
            }
        }else{
            result =  patientDO.getId();
        } else {
            result = patientDO.getId();
        }
        return result;
    }
    
    
    /**
     * (健康咨询)转发消息
     *
     * @param senderIdcard
     * @param reciverIdcard
     * @param messageids
@ -256,48 +258,49 @@ public class WlyyBusinessService {
     * @throws Exception
     */
    public Boolean wlyyMessageForward(String senderIdcard, String reciverIdcard, String messageids, String title, String sessionType) throws Exception {
    
        Map<String,String> params = new HashMap<>();
        params.put("senderIdcard",senderIdcard);
        params.put("reciverIdcard",reciverIdcard);
        params.put("messageids",messageids);
        params.put("title",title);
        params.put("sessionType",sessionType);
        JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyMessageForward",null,params);
        if(rs!=null){
        Map<String, String> params = new HashMap<>();
        params.put("senderIdcard", senderIdcard);
        params.put("reciverIdcard", reciverIdcard);
        params.put("messageids", messageids);
        params.put("title", title);
        params.put("sessionType", sessionType);
        JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyMessageForward", null, params);
        if (rs != null) {
            Integer status = rs.getInteger("status");
            if(200 == status){
            if (200 == status) {
                return true;
            }else{
            } else {
                return false;
            }
        }
        return false;
    }
    
    /**
     * 根据居民CODE换取居民请求秘钥
     *
     * @param patientId
     * @return
     * @throws Exception
     */
    public String wlyyGetPatientAccetokenByIdcard(String patientId,String wxId,String doctorId) throws Exception {
        
    public String wlyyGetPatientAccetokenByIdcard(String patientId, String wxId, String doctorId) throws Exception {
        String idcard = "";
        String result = "";
        BasePatientDO basePatientDO = basePatientDao.findById(patientId).get();
        if(basePatientDO != null){
        if (basePatientDO != null) {
            idcard = basePatientDO.getIdcard();
    
            Map<String,String> params = new HashMap<>();
            params.put("idcard",idcard);
            Map<String, String> params = new HashMap<>();
            params.put("idcard", idcard);
            String patientCardNo = null;
            patientMedicareCardDao.deleteByPatientId(patientId);
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                net.sf.json.JSONArray array =prescriptionService.findPatientCard(patientId);
                for (int i=0;i<array.size();i++){
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                net.sf.json.JSONArray array = prescriptionService.findPatientCard(patientId);
                for (int i = 0; i < array.size(); i++) {
                    net.sf.json.JSONObject object = array.getJSONObject(i);
                    String cardType = object.getString("CARD_TYPE");
                    String cardNo = object.getString("CARD_NO");
@ -305,10 +308,10 @@ public class WlyyBusinessService {
                    PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
                    patientMedicareCardDO.setCode(cardNo);
                    patientMedicareCardDO.setParentType("A");
                    if (cardType.equalsIgnoreCase("2")){
                    if (cardType.equalsIgnoreCase("2")) {
                        patientMedicareCardDO.setType("A_01");
                        patientCardNo = cardNo;
                    }else {
                    } else {
                        patientMedicareCardDO.setType("A_03");
                    }
                    patientMedicareCardDO.setPatientCode(patientId);
@ -318,9 +321,9 @@ public class WlyyBusinessService {
                    patientMedicareCardDO.setRemark(cardTypeName);
                    patientMedicareCardDao.save(patientMedicareCardDO);
                }
            }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            } else if (wxId.equalsIgnoreCase("xm_xzzx_wx")) {
                JSONArray array = xzzxEntranceService.selectPateintCard(patientId);
                for (int i=0;i<array.size();i++){
                for (int i = 0; i < array.size(); i++) {
                    JSONObject jsonObject = array.getJSONObject(i);
                    String cardType = jsonObject.getString("CARD_TYPE");
                    String cardNo = jsonObject.getString("CARD_NO");
@ -328,10 +331,10 @@ public class WlyyBusinessService {
                    PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
                    patientMedicareCardDO.setCode(cardNo);
                    patientMedicareCardDO.setParentType("A");
                    if (cardType.equalsIgnoreCase("01")){
                    if (cardType.equalsIgnoreCase("01")) {
                        patientMedicareCardDO.setType("A_01");
                        patientCardNo = cardNo;
                    }else {
                    } else {
                        patientMedicareCardDO.setType("A_03");
                    }
                    patientMedicareCardDO.setPatientCode(patientId);
@ -341,19 +344,19 @@ public class WlyyBusinessService {
                    patientMedicareCardDO.setRemark(cardTypeName);
                    patientMedicareCardDao.save(patientMedicareCardDO);
                }
            }else {
                PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patientId,"1");
                if (patientMedicareCardDO!=null){
            } else {
                PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01", patientId, "1");
                if (patientMedicareCardDO != null) {
                    patientCardNo = patientMedicareCardDO.getCode();
                }else {
                    Map<String,String> params2 = new HashMap<>();
                    params2.put("idcard",idcard);
                    JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatient",null,params2);
                    if(rs!=null) {
                } else {
                    Map<String, String> params2 = new HashMap<>();
                    params2.put("idcard", idcard);
                    JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatient", null, params2);
                    if (rs != null) {
                        Integer status = rs.getInteger("status");
                        if (200 == status) {
                            JSONObject data = rs.getJSONObject("data");
                            if (data!=null&&data.get("ssc")!=null){
                            if (data != null && data.get("ssc") != null) {
                                patientCardNo = data.getString("ssc");
                                patientMedicareCardDO = new PatientMedicareCardDO();
                                patientMedicareCardDO.setPatientCode(patientId);
@ -366,36 +369,36 @@ public class WlyyBusinessService {
                    }
                }
            }
            if (!StringUtils.isNoneBlank(patientCardNo)){
            if (!StringUtils.isNoneBlank(patientCardNo)) {
                return "社保卡不能为空!";
            }
            //查询i健康信息,没有就注册;
            Map<String,String> patientSccParams = new HashMap<>();
            patientSccParams.put("ssc",patientCardNo);
            patientSccParams.put("name",basePatientDO.getName());
            patientSccParams.put("idCard",basePatientDO.getIdcard());
            patientSccParams.put("sex",basePatientDO.getSex().toString());
            patientSccParams.put("phone",basePatientDO.getMobile());
            patientSccParams.put("birthday",DateUtil.dateToStrShort(basePatientDO.getBirthday()));
            Map<String, String> patientSccParams = new HashMap<>();
            patientSccParams.put("ssc", patientCardNo);
            patientSccParams.put("name", basePatientDO.getName());
            patientSccParams.put("idCard", basePatientDO.getIdcard());
            patientSccParams.put("sex", basePatientDO.getSex().toString());
            patientSccParams.put("phone", basePatientDO.getMobile());
            patientSccParams.put("birthday", DateUtil.dateToStrShort(basePatientDO.getBirthday()));
            //JSONObject object = wlyyHttpService.sendWlyyMes("wlyyFindAccountBySsc", null, patientSccParams);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatientAccetokenByIdcard",null,params);
            if(rs!=null){
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatientAccetokenByIdcard", null, params);
            if (rs != null) {
                Integer status = rs.getInteger("status");
                if(200 == status){
                if (200 == status) {
                    JSONObject data = rs.getJSONObject("data");
                    result = data.getString("patientCode");
                }else{
                } else {
                    logger.info(rs.toJSONString());
                    throw new Exception("请求i健康接口失败");
                }
            }
            try {
                baseOperateLogService.saveOperateLog(doctorId,patientId,"JKDA","健康档案","","");
            }catch (Exception e){
                baseOperateLogService.saveOperateLog(doctorId, patientId, "JKDA", "健康档案", "", "");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }else {
        } else {
            throw new Exception("该居民不存在");
        }
        return result;
@ -404,21 +407,21 @@ public class WlyyBusinessService {
    /**
     * 查询I健康接口获取居民信息
     */
    public Map<String,Object> findWlyyPatient(String idcard)throws Exception{
    public Map<String, Object> findWlyyPatient(String idcard) throws Exception {
        JSONObject param = new JSONObject();
        param.put("idcard",idcard);
        JSONObject re = wlyyHttpService.sendWlyyMes("wlyyGetSignFamily",param,null);
        if(re!=null){
        param.put("idcard", idcard);
        JSONObject re = wlyyHttpService.sendWlyyMes("wlyyGetSignFamily", param, null);
        if (re != null) {
            JSONObject p = re.getJSONObject("data");
            BasePatientDO patientDO =  basePatientDao.findByIdcardAndDel(idcard,"1");
            if(patientDO == null){
            BasePatientDO patientDO = basePatientDao.findByIdcardAndDel(idcard, "1");
            if (patientDO == null) {
                BasePatientDO patient = new BasePatientDO();
                String salt = UUID.randomUUID().toString().substring(0,5);
                String salt = UUID.randomUUID().toString().substring(0, 5);
                String mobile = p.getString("mobile");
                String pw = mobile.substring(mobile.length()-6);
                String pw = mobile.substring(mobile.length() - 6);
                patient.setIdcard(idcard);
                patient.setName(p.getString("name"));
@ -441,67 +444,67 @@ public class WlyyBusinessService {
        return null;
    }
    public Map<String,Object> getPatientInfoMap(BasePatientDO basePatientDO){
        Map<String,Object> rs = new HashedMap();
        rs.put("id",basePatientDO.getId());
        rs.put("name",basePatientDO.getName());
        rs.put("sex",basePatientDO.getSex());
        rs.put("provinceCode",basePatientDO.getProvinceCode());
        rs.put("provinceName",basePatientDO.getProvinceName());
        rs.put("cityCode",basePatientDO.getCityCode());
        rs.put("cityName",basePatientDO.getCityName());
        rs.put("townCode",basePatientDO.getTownCode());
        rs.put("townName",basePatientDO.getTownName());
        rs.put("idcard",basePatientDO.getIdcard());
        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
        rs.put("mobile",basePatientDO.getMobile());
    public Map<String, Object> getPatientInfoMap(BasePatientDO basePatientDO) {
        Map<String, Object> rs = new HashedMap();
        rs.put("id", basePatientDO.getId());
        rs.put("name", basePatientDO.getName());
        rs.put("sex", basePatientDO.getSex());
        rs.put("provinceCode", basePatientDO.getProvinceCode());
        rs.put("provinceName", basePatientDO.getProvinceName());
        rs.put("cityCode", basePatientDO.getCityCode());
        rs.put("cityName", basePatientDO.getCityName());
        rs.put("townCode", basePatientDO.getTownCode());
        rs.put("townName", basePatientDO.getTownName());
        rs.put("idcard", basePatientDO.getIdcard());
        rs.put("age", IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
        rs.put("mobile", basePatientDO.getMobile());
        return rs;
    }
    public JSONArray findPatientListBySscOrIdCard(String idcard,String ssc){
    public JSONArray findPatientListBySscOrIdCard(String idcard, String ssc) {
        Map<String,String> mapParams = new HashedMap();
        if(StringUtils.isNotBlank(idcard)){
            mapParams.put("idcard",idcard);
        Map<String, String> mapParams = new HashedMap();
        if (StringUtils.isNotBlank(idcard)) {
            mapParams.put("idcard", idcard);
        }
        if(StringUtils.isNotBlank(ssc)){
            mapParams.put("ssc",ssc);
        if (StringUtils.isNotBlank(ssc)) {
            mapParams.put("ssc", ssc);
        }
        JSONObject re = wlyyHttpService.sendWlyyMes("findPatientListBySscOrIdCard",null,mapParams);
        JSONArray list =null;
        if(re!=null){
        JSONObject re = wlyyHttpService.sendWlyyMes("findPatientListBySscOrIdCard", null, mapParams);
        JSONArray list = null;
        if (re != null) {
            list = re.getJSONArray("data");
            return list;
        }
        return null;
    }
    public String makeBase64Qrcode(String doctor){
    public String makeBase64Qrcode(String doctor) {
        BaseDoctorDO doctorDO = baseDoctorDao.findByIdAndDel(doctor);
        Map<String,String> mapParams = new HashedMap();
        mapParams.put("doctor",doctorDO.getId()+"_"+doctorDO.getName());
        Map<String, String> mapParams = new HashedMap();
        mapParams.put("doctor", doctorDO.getId() + "_" + doctorDO.getName());
        JSONObject re = wlyyHttpService.sendWlyyMes("makeBase64Qrcode",null,mapParams);
        if(re!=null){
        JSONObject re = wlyyHttpService.sendWlyyMes("makeBase64Qrcode", null, mapParams);
        if (re != null) {
            return re.getString("data");
        }
        return null;
    }
    public String findWlyyHospital(){
        JSONObject re = wlyyHttpService.sendWlyyMes("findWlyyHospital",null,null);
        if(re!=null){
    public String findWlyyHospital() {
        JSONObject re = wlyyHttpService.sendWlyyMes("findWlyyHospital", null, null);
        if (re != null) {
            JSONArray hospitals = JSONArray.parseArray(re.getString("data"));
            logger.info("hospitals size:"+hospitals.size());
            if(hospitals!=null&&hospitals.size()>0){
            logger.info("hospitals size:" + hospitals.size());
            if (hospitals != null && hospitals.size() > 0) {
                Integer addCount = 0;
                Integer updateCount =0;
                for(int i=0;i<hospitals.size();i++){
                Integer updateCount = 0;
                for (int i = 0; i < hospitals.size(); i++) {
                    JSONObject h = (JSONObject) hospitals.get(i);
                    String code = h.getString("code");
                    if(!baseOrgDao.existsByCode(code)){
                    if (!baseOrgDao.existsByCode(code)) {
                        BaseOrgDO org = new BaseOrgDO();
                        org.setCode(code);
                        org.setName(h.getString("name"));
@ -517,7 +520,7 @@ public class WlyyBusinessService {
                        org.setDel("1");
                        baseOrgDao.save(org);
                        addCount++;
                    }else{
                    } else {
                        BaseOrgDO org = baseOrgDao.findByCode(code);
                        org.setName(h.getString("name"));
                        org.setProvinceCode(h.getString("province"));
@ -531,24 +534,24 @@ public class WlyyBusinessService {
                        updateCount++;
                    }
                }
                logger.info("hospitals addCount:"+addCount+" updateCount:"+updateCount);
                logger.info("hospitals addCount:" + addCount + " updateCount:" + updateCount);
            }
        }
        return "ok";
    }
    public String findWlyyDept(){
        JSONObject re = wlyyHttpService.sendWlyyMes("findWlyyDept",null,null);
        if(re!=null){
    public String findWlyyDept() {
        JSONObject re = wlyyHttpService.sendWlyyMes("findWlyyDept", null, null);
        if (re != null) {
            JSONArray depts = JSONArray.parseArray(re.getString("data"));
            logger.info("depts size:"+depts.size());
            if(depts!=null&&depts.size()>0){
            logger.info("depts size:" + depts.size());
            if (depts != null && depts.size() > 0) {
                Integer addCount = 0;
                for(int i=0;i<depts.size();i++){
                for (int i = 0; i < depts.size(); i++) {
                    JSONObject d = (JSONObject) depts.get(i);
                    String code = d.getString("code");
                    String hospital = d.getString("hospital");
                    if(!dictHospitalDeptDao.existsByCodeAndOrgCode(code,hospital)){
                    if (!dictHospitalDeptDao.existsByCodeAndOrgCode(code, hospital)) {
                        DictHospitalDeptDO deptDO = new DictHospitalDeptDO();
                        deptDO.setCode(code);
                        deptDO.setName(d.getString("name"));
@ -560,27 +563,27 @@ public class WlyyBusinessService {
                    }
                }
                logger.info("Dept addCount"+addCount);
                logger.info("Dept addCount" + addCount);
            }
        }
        return "ok";
    }
    public String findWlyyDoctor()throws Exception{
        JSONObject re = wlyyHttpService.sendWlyyMes("findWlyyDoctor",null,null);
        if(re!=null){
    public String findWlyyDoctor() throws Exception {
        JSONObject re = wlyyHttpService.sendWlyyMes("findWlyyDoctor", null, null);
        if (re != null) {
            JSONArray doctors = JSONArray.parseArray(re.getString("data"));
            logger.info("doctors size:"+doctors.size());
            if(doctors!=null&&doctors.size()>0){
            logger.info("doctors size:" + doctors.size());
            if (doctors != null && doctors.size() > 0) {
                Integer count = 0;
                //获取全部职称.
                List<Map<String,Object>> dutys = findDutys();
                List<Map<String, Object>> dutys = findDutys();
                for(int i=0;i<doctors.size();i++){
                for (int i = 0; i < doctors.size(); i++) {
                    try {
                        JSONObject doctorJson = (JSONObject) doctors.get(i);
                        String idcard = doctorJson.getString("idcard");
                        if(StringUtils.isNotBlank(idcard)) {
                        if (StringUtils.isNotBlank(idcard)) {
                            List<BaseDoctorDO> ds = baseDoctorDao.findByIdcard(idcard);
                            if (ds != null && ds.size() > 0) {
                                //已有账号更新
@ -609,10 +612,10 @@ public class WlyyBusinessService {
                                baseDoctorDao.save(doctor);
                                //更新机构科室信息
                                String orgCode =doctorJson.getString("hospital");
                                if(StringUtils.isNotBlank(orgCode)){
                                    List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByOrgCodeAndDoctorCode(orgCode,doctor.getId());
                                    if(hospitalDOs!=null&&hospitalDOs.size()>0){
                                String orgCode = doctorJson.getString("hospital");
                                if (StringUtils.isNotBlank(orgCode)) {
                                    List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByOrgCodeAndDoctorCode(orgCode, doctor.getId());
                                    if (hospitalDOs != null && hospitalDOs.size() > 0) {
                                        BaseDoctorHospitalDO hospitalDO = hospitalDOs.get(0);
                                        hospitalDO.setOrgCode(doctorJson.getString("hospital"));
                                        hospitalDO.setOrgName(doctorJson.getString("hospitalName"));
@ -691,11 +694,11 @@ public class WlyyBusinessService {
                            }
                        }
                    }catch (Exception e){
                    } catch (Exception e) {
                        logger.info("data error");
                    }
                }
                logger.info("add count:"+count);
                logger.info("add count:" + count);
            }
        }
        return "ok";
@ -703,19 +706,20 @@ public class WlyyBusinessService {
    /**
     * 获取全部职称
     *
     * @return
     */
    public List<Map<String,Object>> findDutys(){
    public List<Map<String, Object>> findDutys() {
        String sql = "select code,name from dict_doctor_duty";
        return jdbcTemplate.queryForList(sql);
    }
    public String getDutysCode(List<Map<String,Object>> dutys,String name){
        if(StringUtils.isNotBlank(name)){
            for(Map<String,Object> d:dutys){
                String duty = (String)d.get("name");
                if(name.equals(duty)){
                    return (String)d.get("code");
    public String getDutysCode(List<Map<String, Object>> dutys, String name) {
        if (StringUtils.isNotBlank(name)) {
            for (Map<String, Object> d : dutys) {
                String duty = (String) d.get("name");
                if (name.equals(duty)) {
                    return (String) d.get("code");
                }
            }
        }
@ -727,142 +731,296 @@ public class WlyyBusinessService {
        StringBuffer buffer = new StringBuffer();
        Random random = new Random();
        for(int i = 0; i < length; ++i) {
        for (int i = 0; i < length; ++i) {
            int pos = random.nextInt(str.length());
            buffer.append(str.charAt(pos));
        }
        return buffer.toString();
    }
    
    /**
     * 推送i健康智能助手模版消息
     *
     * @param wxurl
     */
    public void sendDoctorTemplateByDoctorIdcard(String wxurl) {
        String re = HttpUtil.sendGet(wxurl);
        JSONObject reObject = JSONObject.parseObject(re);
        if(200 == reObject.getInteger("status")){
            logger.info("请求成功,"+re);
        }else{
        if (200 == reObject.getInteger("status")) {
            logger.info("请求成功," + re);
        } else {
            logger.info("请求失败");
        }
    }
    //居民是否签约
    public JSONObject isSign(String idCard){
        JSONObject re = wlyyHttpService.sendWlyyMesGet("isSign","?idCard="+idCard);
    public JSONObject isSign(String idCard) {
        JSONObject re = wlyyHttpService.sendWlyyMesGet("isSign", "?idCard=" + idCard);
        return re;
    }
    //获取医生信息
    public JSONObject doctorInfo(String code){
        JSONObject re = wlyyHttpService.sendWlyyMesGet("doctorInfo","?code="+code);
    public JSONObject doctorInfo(String code) {
        JSONObject re = wlyyHttpService.sendWlyyMesGet("doctorInfo", "?code=" + code);
        return re;
    }
    //获取居民信息
    public JSONObject patientInfo(String code){
        JSONObject re = wlyyHttpService.sendWlyyMesGet("patientInfo","?code="+code);
    public JSONObject patientInfo(String code) {
        JSONObject re = wlyyHttpService.sendWlyyMesGet("patientInfo", "?code=" + code);
        return re;
    }
    //获取团队列表
    public JSONObject getAdminTeamList(String teamName,String town,String teamId, String leadName, Integer page, Integer pageSize, String hospital,String doctorName,String mobile) {
        String param = "?teamName="+nullToTransfor(teamName)+"&leadName="+nullToTransfor(leadName)+"&teamId="+nullToTransfor(teamId)
                +"&page="+page+"&pageSize="+pageSize+"&hospital="+nullToTransfor(hospital)+"&doctorName="+nullToTransfor(doctorName)
                +"&mobile="+nullToTransfor(mobile)+"&town="+nullToTransfor(town);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getAdminTeamList",param);
    public JSONObject getAdminTeamList(String teamName, String town, String teamId, String leadName, Integer page, Integer pageSize, String hospital, String doctorName, String mobile) {
        String param = "?teamName=" + nullToTransfor(teamName) + "&leadName=" + nullToTransfor(leadName) + "&teamId=" + nullToTransfor(teamId)
                + "&page=" + page + "&pageSize=" + pageSize + "&hospital=" + nullToTransfor(hospital) + "&doctorName=" + nullToTransfor(doctorName)
                + "&mobile=" + nullToTransfor(mobile) + "&town=" + nullToTransfor(town);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getAdminTeamList", param);
        return re;
    }
    //获取团队成员列表
    public JSONObject getAdminTeamMemberList(String teamId, String doctorName, Integer page, Integer pageSize, String mobile) {
        String param = "?teamId="+nullToTransfor(teamId)+"&doctorName="+nullToTransfor(doctorName)+"&page="+page+"&pageSize="+pageSize+"&mobile="+nullToTransfor(mobile);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getAdminTeamMemberList",param);
        String param = "?teamId=" + nullToTransfor(teamId) + "&doctorName=" + nullToTransfor(doctorName) + "&page=" + page + "&pageSize=" + pageSize + "&mobile=" + nullToTransfor(mobile);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getAdminTeamMemberList", param);
        return re;
    }
    //获取社区医生列表
    public JSONObject getDoctorList(String hospital, String doctorName, Integer page, Integer pageSize, String mobile) {
        String param = "?hospital="+nullToTransfor(hospital)+"&doctorName="+nullToTransfor(doctorName)+"&page="+page+"&pageSize="+pageSize+"&mobile="+nullToTransfor(mobile);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getDoctorList",param);
        String param = "?hospital=" + nullToTransfor(hospital) + "&doctorName=" + nullToTransfor(doctorName) + "&page=" + page + "&pageSize=" + pageSize + "&mobile=" + nullToTransfor(mobile);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getDoctorList", param);
        return re;
    }
    //获取机构列表分页
    public JSONObject getHospitalList(String name, Integer page, Integer pageSize, String town) {
        String param = "?name="+nullToTransfor(name)+"&town="+nullToTransfor(town)+"&page="+page+"&pageSize="+pageSize;
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getHospitalList",param);
        String param = "?name=" + nullToTransfor(name) + "&town=" + nullToTransfor(town) + "&page=" + page + "&pageSize=" + pageSize;
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getHospitalList", param);
        return re;
    }
    //获取签约列表分页(只查询有效的)
    public JSONObject getSignList(String name, Integer page, Integer pageSize, String town,String hospital,String adminTeamCode
            ,String doctor,String doctorName,String doctorHealthName,String hospitalName,String idcard,String address
            ,String teamName,String leaderName,String teamId) {
        String param = "?name="+nullToTransfor(name)+"&town="+nullToTransfor(town)+"&page="+page+"&pageSize="+pageSize+"&hospital="+nullToTransfor(hospital)+
                "&adminTeamCode="+nullToTransfor(adminTeamCode)+"&doctor="+nullToTransfor(doctor)+"&doctorName="+nullToTransfor(doctorName)+
                "&doctorHealthName="+nullToTransfor(doctorHealthName)+"&hospitalName="+nullToTransfor(hospitalName)+"&idcard="+nullToTransfor(idcard)+
                "&address="+nullToTransfor(address)+"&teamName="+nullToTransfor(teamName)+"&leaderName="+nullToTransfor(leaderName)+"&teamId="+nullToTransfor(teamId);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getSignList",param);
    public JSONObject getSignList(String name, Integer page, Integer pageSize, String town, String hospital, String adminTeamCode
            , String doctor, String doctorName, String doctorHealthName, String hospitalName, String idcard, String address
            , String teamName, String leaderName, String teamId) {
        String param = "?name=" + nullToTransfor(name) + "&town=" + nullToTransfor(town) + "&page=" + page + "&pageSize=" + pageSize + "&hospital=" + nullToTransfor(hospital) +
                "&adminTeamCode=" + nullToTransfor(adminTeamCode) + "&doctor=" + nullToTransfor(doctor) + "&doctorName=" + nullToTransfor(doctorName) +
                "&doctorHealthName=" + nullToTransfor(doctorHealthName) + "&hospitalName=" + nullToTransfor(hospitalName) + "&idcard=" + nullToTransfor(idcard) +
                "&address=" + nullToTransfor(address) + "&teamName=" + nullToTransfor(teamName) + "&leaderName=" + nullToTransfor(leaderName) + "&teamId=" + nullToTransfor(teamId);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getSignList", param);
        return re;
    }
    //获取关联社区列表分页
    public JSONObject getTeamRelationList(String teamId, String doctorName, Integer page, Integer pageSize, String mobile,String hospitalName,String teamName,String leaderName) {
        String param = "?teamId="+nullToTransfor(teamId)+"&doctorName="+nullToTransfor(doctorName)+"&page="+page
                +"&pageSize="+pageSize+"&mobile="+nullToTransfor(mobile)+"&hospitalName="+nullToTransfor(hospitalName)
                +"&teamName="+nullToTransfor(teamName)+"&leaderName="+nullToTransfor(leaderName);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getTeamRelationList",param);
    public JSONObject getTeamRelationList(String teamId, String doctorName, Integer page, Integer pageSize, String mobile, String hospitalName, String teamName, String leaderName) {
        String param = "?teamId=" + nullToTransfor(teamId) + "&doctorName=" + nullToTransfor(doctorName) + "&page=" + page
                + "&pageSize=" + pageSize + "&mobile=" + nullToTransfor(mobile) + "&hospitalName=" + nullToTransfor(hospitalName)
                + "&teamName=" + nullToTransfor(teamName) + "&leaderName=" + nullToTransfor(leaderName);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getTeamRelationList", param);
        return re;
    }
    private String nullToTransfor(String str){
        return StringUtils.isBlank(str)?"":str;
    private String nullToTransfor(String str) {
        return StringUtils.isBlank(str) ? "" : str;
    }
    //专科团队保存关联社区
    public JSONObject saveIjkTeam(String teamId,String adminTeamIds){
        Map<String,String> params = new HashMap<>();
        params.put("teamId",teamId);
        params.put("adminTeamIds",adminTeamIds);
        JSONObject rs = wlyyHttpService.sendWlyyMes("saveIjkTeam",null,params);
    public JSONObject saveIjkTeam(String teamId, String adminTeamIds) {
        Map<String, String> params = new HashMap<>();
        params.put("teamId", teamId);
        params.put("adminTeamIds", adminTeamIds);
        JSONObject rs = wlyyHttpService.sendWlyyMes("saveIjkTeam", null, params);
        return rs;
    }
    //删除关联社区
    public JSONObject delIjkTeam(String teamId,Integer adminTeamId){
        Map<String,String> params = new HashMap<>();
        params.put("teamId",teamId);
        params.put("adminTeamId",adminTeamId+"");
        JSONObject rs = wlyyHttpService.sendWlyyMes("delIjkTeam",null,params);
    public JSONObject delIjkTeam(String teamId, Integer adminTeamId) {
        Map<String, String> params = new HashMap<>();
        params.put("teamId", teamId);
        params.put("adminTeamId", adminTeamId + "");
        JSONObject rs = wlyyHttpService.sendWlyyMes("delIjkTeam", null, params);
        return rs;
    }
    //推送i健康 康复下转居民
    public JSONObject pushPatientInfos(RehabilitationPatientInfoDO infoDO){
        Map<String,String> params = new HashMap<>();
    public JSONObject pushPatientInfos(RehabilitationPatientInfoDO infoDO) {
        Map<String, String> params = new HashMap<>();
        params.put("jsondata", JSON.toJSONString(infoDO));
        JSONObject rs = wlyyHttpService.sendWlyyMes("pushPatientInfos",null,params);
        JSONObject rs = wlyyHttpService.sendWlyyMes("pushPatientInfos", null, params);
        return rs;
    }
    /**
     * 获取ijk十大专病信息
     *
     * @return
     */
    public JSONObject getSpecialList(){
    public JSONObject getSpecialList() {
        JSONObject json = new JSONObject();
        String sql = "SELECT dict_code code,dict_value name from wlyy_hospital_sys_dict WHERE dict_name = 'ijkSpecialList' ORDER BY sort";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        json.put("msg","success");
        json.put("data",list);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        json.put("msg", "success");
        json.put("data", list);
        return json;
    }
    //获取i健康医生信息
    public JSONObject getDoctorInfo_IJK(String idcard) {
        String param = "?idcard=" + nullToTransfor(idcard);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getDoctorInfo_IJK", param);
        return re;
    }
    public JSONObject getReservationByDoctorAndSource_IJK(String doctorCode, String patientName, String source) {
        String param = "?doctorCode=" + nullToTransfor(doctorCode) + "&patientName=" + nullToTransfor(patientName) + "&source=" + source;
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getReservationByDoctorAndSource_IJK", param);
        return re;
    }
    public JSONObject getScreeList_IJK(
            String doctor, Integer type, int pageNo, int pageSize, String patientName,
            String isDanger, String diseaseType, Integer filterType, String patientCode) {
        String param = "?doctor=" + nullToTransfor(doctor) + "&type=" + nullToTransfor(String.valueOf(type)) + "&pageNo=" + nullToTransfor(String.valueOf(pageNo)) + "&pageSize=" + nullToTransfor(String.valueOf(pageSize)) + "&patientName=" + nullToTransfor(patientName) +
                "&isDanger=" + nullToTransfor(isDanger) + "&diseaseType=" + nullToTransfor(diseaseType) + "&filterType=" + nullToTransfor(String.valueOf(filterType)) + "&patientCode=" + nullToTransfor(patientCode);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getScreeList_IJK", param);
        return re;
    }
    public JSONObject getHealthIndexById_IJK(Long id) {
        String param = "?id=" + id;
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getHealthIndexById_IJK", param);
        return re;
    }
    public JSONObject queryByConsultCode_IJK(String code, Integer type) {
        String param = "?code=" + nullToTransfor(code) + "&type=" + nullToTransfor(String.valueOf(type));
        JSONObject re = wlyyHttpService.sendWlyyMesGet("queryByConsultCode_IJK", param);
        return re;
    }
    public JSONObject getScreenResultDetail_IJK(String code) {
        String param = "?code=" + nullToTransfor(code);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getScreenResultDetail_IJK", param);
        return re;
    }
    public JSONObject findPatientSignFamily_IJK(String patient) {
        String param = "?patient=" + nullToTransfor(patient);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("findPatientSignFamily_IJK", param);
        return re;
    }
    public JSONObject getSpecialDisease_IJK() {
        String param = "";
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getSpecialDisease_IJK", param);
        return re;
    }
    public JSONObject last_IJK(String patient) {
        String param = "?patient=" + nullToTransfor(patient);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("last_IJK", param);
        return re;
    }
    public JSONObject patient_IJK(String patient) {
        String param = "?patient=" + nullToTransfor(patient);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("patient_IJK", param);
        return re;
    }
    public JSONObject getPatientSpecialAndFamilyDoctor_IJK(String patientCode) {
        String param = "?patientCode=" + nullToTransfor(patientCode);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getPatientSpecialAndFamilyDoctor_IJK", param);
        return re;
    }
    public JSONObject selectAllCompleteServiceItemsByPatient_IJK(String patient) {
        String param = "?patient=" + nullToTransfor(patient);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("selectAllCompleteServiceItemsByPatient_IJK", param);
        return re;
    }
    public JSONObject selectAllPlaneByPatient_IJK(String patient, String eventType) {
        String param = "?patient=" + nullToTransfor(patient) + "&eventType=" + nullToTransfor(eventType);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("selectAllPlaneByPatient_IJK", param);
        return re;
    }
    public JSONObject calendarPlanDetailListBypatient_IJK(
            String executeStartTime, String executeEndTime, String patient, Integer searchTask,
            String doctorCode, Integer status, String taskExecutor) {
        String param = "?executeStartTime=" + nullToTransfor(executeStartTime) + "&executeEndTime=" + nullToTransfor(executeEndTime) + "&patient=" + nullToTransfor(patient) + "&searchTask=" + nullToTransfor(String.valueOf(searchTask)) +
                "&doctorCode=" + nullToTransfor(doctorCode) + "&status=" + nullToTransfor(String.valueOf(status)) + "&taskExecutor=" + nullToTransfor(String.valueOf(taskExecutor));
        JSONObject re = wlyyHttpService.sendWlyyMesGet("calendarPlanDetailListBypatient_IJK", param);
        return re;
    }
    public JSONObject calendarPlanDetailItems_IJK(String executeStartTime, String executeEndTime, String planId, Integer searchTask, String doctorCode, Integer status) {
        String param = "?executeStartTime=" + nullToTransfor(executeStartTime) + "&executeEndTime=" + nullToTransfor(executeEndTime) + "&planId=" + nullToTransfor(planId) + "&searchTask=" + nullToTransfor(String.valueOf(searchTask)) +
                "&doctorCode=" + nullToTransfor(doctorCode) + "&status=" + nullToTransfor(String.valueOf(status));
        JSONObject re = wlyyHttpService.sendWlyyMesGet("calendarPlanDetailItems_IJK", param);
        return re;
    }
    public JSONObject planSchedule_IJK(String planId, String patientCode) {
        String param = "?planId=" + nullToTransfor(planId) + "&patientCode=" + nullToTransfor(patientCode);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("planSchedule_IJK", param);
        return re;
    }
    public JSONObject selectByMedicalCode_IJK(String medical) {
        String param = "?medical=" + nullToTransfor(medical);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("selectByMedicalCode_IJK", param);
        return re;
    }
    public JSONObject selectPlanServerDoctor_IJK(String planId) {
        String param = "?planId=" + nullToTransfor(planId);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("selectPlanServerDoctor_IJK", param);
        return re;
    }
    public JSONObject getRehabilitationPlanLog_IJK(String planId) {
        String param = "?planId=" + nullToTransfor(planId);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getRehabilitationPlanLog_IJK", param);
        return re;
    }
    public JSONObject calendarPlanDetailList_IJK(String executeStartTime, String executeEndTime, String planId, Integer searchTask, String doctorCode, Integer status, String taskExecutor) {
        String param = "?executeStartTime=" + nullToTransfor(executeStartTime) + "&executeEndTime=" + nullToTransfor(executeEndTime) + "&searchTask=" + nullToTransfor(String.valueOf(searchTask)) +
                "&doctorCode=" + nullToTransfor(doctorCode) + "&status=" + nullToTransfor(String.valueOf(status)) + "&taskExecutor=" + nullToTransfor(String.valueOf(taskExecutor));
        JSONObject re = wlyyHttpService.sendWlyyMesGet("calendarPlanDetailList_IJK", param);
        return re;
    }
    public JSONObject getPatientDrugList_IJK(String patient) {
        String param = "?patient=" + nullToTransfor(patient);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getPatientDrugList_IJK", param);
        return re;
    }
    public JSONObject selectBySpecialistDoctor_IJK(
            String doctorCode, String doctorType, String patientInfo, String diseaseCode,
            String level, String area, Integer page, Integer pageSize,
            String filterPlan, String turnDownState, String eventType) {
        String param = "?doctorCode=" + nullToTransfor(doctorCode) + "&doctorType=" + nullToTransfor(doctorType) + "&patientInfo=" + nullToTransfor(patientInfo) + "&diseaseCode=" + nullToTransfor(diseaseCode) +
                "&level=" + nullToTransfor(level) + "&area=" + nullToTransfor(area) + "&page=" + nullToTransfor(String.valueOf(page)) + "&pageSize=" + nullToTransfor(String.valueOf(pageSize)) +
                "&filterPlan=" + nullToTransfor(filterPlan) + "&turnDownState=" + nullToTransfor(turnDownState) + "&eventType=" + nullToTransfor(eventType);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("selectBySpecialistDoctor_IJK", param);
        return re;
    }
    public JSONObject getPatientCount_IJK(String doctor) {
        String param = "?doctor=" + nullToTransfor(doctor);
        JSONObject re = wlyyHttpService.sendWlyyMesGet("getPatientCount_IJK", param);
        return re;
    }
}

+ 407 - 40
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/specialist/BaseDiseaseHospitalController.java

@ -1,18 +1,26 @@
package com.yihu.jw.hospital.endpoint.specialist;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.specialist.BaseDiseaseHospitalDO;
import com.yihu.jw.entity.specialist.rehabilitation.PatientMedicalRecordsDO;
import com.yihu.jw.hospital.disease.service.BaseDiseaseHospitalService;
import com.yihu.jw.restmodel.specialist.SurveyScreenResultVo;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@ -23,117 +31,476 @@ public class BaseDiseaseHospitalController extends EnvelopRestEndpoint {
    @Autowired
    private BaseDiseaseHospitalService baseDiseaseHospitalService;
    @Autowired
    WlyyBusinessService wlyyBusinessService;
    @ApiOperation("新增/修改专病配置")
    @PostMapping(value= BaseHospitalRequestMapping.BaseDiseaseHospital.insertAndUpdate)
    @PostMapping(value = BaseHospitalRequestMapping.BaseDiseaseHospital.insertAndUpdate)
    public Envelop insertAndUpdateQuestion(@ApiParam(name = "json", value = "专病配置实体类json", required = true)
                                       @RequestParam(value = "json", required = true)String json){
                                           @RequestParam(value = "json", required = true) String json) {
        try {
            BaseDiseaseHospitalDO diseaseHospitalDO = toEntity(json,BaseDiseaseHospitalDO.class);
            BaseDiseaseHospitalDO diseaseHospitalDO = toEntity(json, BaseDiseaseHospitalDO.class);
            return success(baseDiseaseHospitalService.insertAndUpdate(diseaseHospitalDO));
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("根据id获取专病配置详情")
    @GetMapping(value= BaseHospitalRequestMapping.BaseDiseaseHospital.findById)
    @GetMapping(value = BaseHospitalRequestMapping.BaseDiseaseHospital.findById)
    public Envelop findById(@ApiParam(name = "id", value = "专病配置id", required = true)
                              @RequestParam(value = "id", required = true)String id){
                            @RequestParam(value = "id", required = true) String id) {
        try {
            return success(baseDiseaseHospitalService.findById(id));
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("查询专病中心列表")
    @GetMapping(value= BaseHospitalRequestMapping.BaseDiseaseHospital.selectByCondition)
    @GetMapping(value = BaseHospitalRequestMapping.BaseDiseaseHospital.selectByCondition)
    public Envelop selectQuestionList(@ApiParam(name = "name", value = "专病名称", required = false)
                                  @RequestParam(value = "name", required = false)String name,
                                  @ApiParam(name = "status", value = "1开启0关闭", required = false)
                                  @RequestParam(value = "status", required = false)String status,
                                  @ApiParam(name = "page", value = "页码", required = false)
                                  @RequestParam(value = "page", required = false)Integer page,
                                  @ApiParam(name = "size", value = "大小", required = false)
                                  @RequestParam(value = "size", required = false)Integer size){
                                      @RequestParam(value = "name", required = false) String name,
                                      @ApiParam(name = "status", value = "1开启0关闭", required = false)
                                      @RequestParam(value = "status", required = false) String status,
                                      @ApiParam(name = "page", value = "页码", required = false)
                                      @RequestParam(value = "page", required = false) Integer page,
                                      @ApiParam(name = "size", value = "大小", required = false)
                                      @RequestParam(value = "size", required = false) Integer size) {
        try {
            return success(baseDiseaseHospitalService.selectByCondition(name,status,page,size));
        }catch (Exception e){
            return success(baseDiseaseHospitalService.selectByCondition(name, status, page, size));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("根据id删除专病详情")
    @PostMapping(value= BaseHospitalRequestMapping.BaseDiseaseHospital.deleteById)
    @PostMapping(value = BaseHospitalRequestMapping.BaseDiseaseHospital.deleteById)
    public Envelop deleteById(@ApiParam(name = "id", value = "专病配置id", required = true)
                                           @RequestParam(value = "id", required = true)String id){
                              @RequestParam(value = "id", required = true) String id) {
        try {
            baseDiseaseHospitalService.deleteById(id);
            return success();
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("更新启动状态或者上移下移置顶")
    @PostMapping(value= BaseHospitalRequestMapping.BaseDiseaseHospital.updateStatusOrSort)
    @PostMapping(value = BaseHospitalRequestMapping.BaseDiseaseHospital.updateStatusOrSort)
    public Envelop deleteById(@ApiParam(name = "id", value = "专病配置id", required = true)
                              @RequestParam(value = "id", required = true)String id,
                              @RequestParam(value = "id", required = true) String id,
                              @ApiParam(name = "status", value = "1启动0禁止", required = false)
                              @RequestParam(value = "status", required = false)Integer status,
                              @RequestParam(value = "status", required = false) Integer status,
                              @ApiParam(name = "flag", value = "1上移2下移3置顶", required = false)
                                  @RequestParam(value = "flag", required = false)Integer flag){
                              @RequestParam(value = "flag", required = false) Integer flag) {
        try {
            return success(baseDiseaseHospitalService.updateStatusOrSort(id,status,flag));
        }catch (Exception e){
            return success(baseDiseaseHospitalService.updateStatusOrSort(id, status, flag));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("获取诊断")
    @GetMapping(value= BaseHospitalRequestMapping.BaseDiseaseHospital.getICD10)
    @GetMapping(value = BaseHospitalRequestMapping.BaseDiseaseHospital.getICD10)
    public Envelop getICD10(@ApiParam(name = "pyKey", value = "拼音码或者诊断名称", required = false)
                                      @RequestParam(value = "pyKey", required = false)String pyKey,
                                      @ApiParam(name = "page", value = "页码", required = false)
                                      @RequestParam(value = "page", required = false)Integer page,
                                      @ApiParam(name = "size", value = "大小", required = false)
                                      @RequestParam(value = "size", required = false)Integer size){
                            @RequestParam(value = "pyKey", required = false) String pyKey,
                            @ApiParam(name = "page", value = "页码", required = false)
                            @RequestParam(value = "page", required = false) Integer page,
                            @ApiParam(name = "size", value = "大小", required = false)
                            @RequestParam(value = "size", required = false) Integer size) {
        try {
            return success(baseDiseaseHospitalService.getICD10(pyKey,page,size));
        }catch (Exception e){
            return success(baseDiseaseHospitalService.getICD10(pyKey, page, size));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("i健康授权参数加密")
    @PostMapping(value= BaseHospitalRequestMapping.BaseDiseaseHospital.ascRevertData)
    @PostMapping(value = BaseHospitalRequestMapping.BaseDiseaseHospital.ascRevertData)
    public Envelop ascRevertData(@ApiParam(name = "json", value = "加密的json值", required = false)
                            @RequestParam(value = "json", required = false)String json){
                                 @RequestParam(value = "json", required = false) String json) {
        try {
            return success(baseDiseaseHospitalService.ascRevertData(json));
        }catch (Exception e){
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("获取十大专病")
    @GetMapping(value= BaseHospitalRequestMapping.BaseDiseaseHospital.getSpecialList)
    public Envelop getSpecialList(){
    @GetMapping(value = BaseHospitalRequestMapping.BaseDiseaseHospital.getSpecialList)
    public Envelop getSpecialList() {
        try {
            return success(baseDiseaseHospitalService.getSpecialList());
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("获取i健康医生信息")
    @GetMapping(value = "/getDoctorInfo_IJK")
    public Envelop getDoctorInfo_IJK(
            @ApiParam(name = "idCard", value = "身份证", required = false) @RequestParam(value = "idCard", required = false) String idCard) {
        try {
            return success(wlyyBusinessService.getDoctorInfo_IJK(idCard));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("获取转诊到此专科医生的列表-i健康数据")
    @GetMapping(value = "/getReservationByDoctorAndSource_IJK")
    public Envelop getReservationByDoctorAndSource_IJK(
            @ApiParam(name = "doctorCode", value = "专医code") @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "patientName", value = "居民姓名") @RequestParam(value = "patientName", required = false) String patientName,
            @ApiParam(name = "source", value = "代预约来源(0全部  1体征预警 2疾病筛查 3康复复诊 4健康咨询  ,5家庭医生代预约)") @RequestParam(value = "source", required = true) String source
    ) {
        try {
            JSONObject result = wlyyBusinessService.getReservationByDoctorAndSource_IJK(doctorCode, patientName, source);
            return success(result);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @RequestMapping(value = "/getScreeList_IJK",method = RequestMethod.GET)
    @ApiOperation(value = "专科医生获取筛查记录列表")
    public Envelop getScreeList_IJK(
            @ApiParam(name = "doctor", value = "专科医生ID")@RequestParam(value = "doctor",required = false)String doctor,
            @ApiParam(value = "处理方式(1已预约 2已跟踪 3已接诊 4待处理),多个用逗号隔开")@RequestParam(value = "type",required = false) Integer type,
            @ApiParam(value = "搜索居民的姓名或身份证") @RequestParam(value = "patientName", required = false) String patientName,
            @ApiParam(value = "是否高危预警(0否 1是)") @RequestParam(value = "isDanger", required = false) String isDanger,
            @ApiParam(value = "疾病类型,多个用逗号隔开") @RequestParam(value = "diseaseType", required = false) String diseaseType,
            @ApiParam(value = "传1则根据类型查一条数据")@RequestParam(value = "filterType",required = false,defaultValue = "0")Integer filterType,
            @ApiParam(value = "居民code")@RequestParam(value = "patientCode",required = false)String patientCode,
            @ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
            @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize
    ){
        try {
            JSONObject result = wlyyBusinessService.getScreeList_IJK(doctor,type,pageNo,pageSize,patientName, isDanger, diseaseType,filterType,patientCode);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "getHealthIndexById_IJK", method = RequestMethod.GET)
    @ApiOperation("根据体征记录id获取体征记录详情")
    public Envelop getHealthIndexById_IJK(
            @ApiParam("体征记录id") @RequestParam Long id) {
        try {
            JSONObject result = wlyyBusinessService.getHealthIndexById_IJK(id);
            return success(result);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @RequestMapping(value = "queryByConsultCode_IJK",method = RequestMethod.GET)
    @ApiOperation("根据咨询code查询关联业务项详情")
    public Envelop queryByConsultCode_IJK(
            @ApiParam(name = "code", value = "咨询code") @RequestParam(value = "code", required = true) String code,
            @ApiParam(name = "type", value = "咨询类型") @RequestParam(value = "type", required = true) Integer type){
        try{
            JSONObject result = wlyyBusinessService.queryByConsultCode_IJK(code,type);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "getScreenResultDetail_IJK",method = RequestMethod.GET)
    @ApiOperation(value = "查看筛查结果记录详情")
    public Envelop getScreenResultDetail_IJK(@ApiParam(value = "筛查结果唯一code")@RequestParam(value = "code") String code) {
        try{
            JSONObject result = wlyyBusinessService.getScreenResultDetail_IJK(code);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "/findPatientSignFamily_IJK", method = RequestMethod.GET)
    @ApiOperation(value = "获取居民所有专科医生签约信息")
    public Envelop findPatientSignFamily_IJK(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true)String patient)  {
        try{
            JSONObject result = wlyyBusinessService.findPatientSignFamily_IJK(patient);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "getSpecialDisease_IJK", method = RequestMethod.GET)
    @ApiOperation(value = "获取专科疾病类型")
    public Envelop getSpecialDisease_IJK() {
        try{
            JSONObject result = wlyyBusinessService.getSpecialDisease_IJK();
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "last_IJK",method = RequestMethod.GET)
    @ApiOperation("患者最新健康指标信息")
    public Envelop last_IJK(
            @ApiParam(name="patient",value="患者代码",defaultValue = "") @RequestParam(value="patient",required = true) String patient) {
        try{
            JSONObject result = wlyyBusinessService.last_IJK(patient);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    /**
     * 获取i健康居民信息
     */
    @RequestMapping(value = "/patient_IJK")
    @ApiOperation("查询居民信息")
    public Envelop patient_IJK(@ApiParam(name="patient",value="患者代码",defaultValue = "") @RequestParam(value="patient",required = true) String patient) {
        try{
            JSONObject result = wlyyBusinessService.patient_IJK(patient);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "getPatientSpecialAndFamilyDoctor_IJK", method = RequestMethod.GET)
    @ApiOperation("获取为某患者创建康复计划的医生专科列表、家庭医生")
    public Envelop getPatientSpecialAndFamilyDoctor_IJK(@RequestParam("patientCode") String patientCode) {
        try{
            JSONObject result = wlyyBusinessService.getPatientSpecialAndFamilyDoctor_IJK(patientCode);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "selectAllCompleteServiceItemsByPatient_IJK", method = RequestMethod.GET)
    @ApiOperation("康复计划主页动态")
    public Envelop selectAllCompleteServiceItemsByPatient(
            @ApiParam(name = "patient", value = "居民Code", required = true) @RequestParam(value = "patient", required = true) String patient) {
        try{
            JSONObject result = wlyyBusinessService.selectAllCompleteServiceItemsByPatient_IJK(patient);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "selectAllPlaneByPatient_IJK", method = RequestMethod.GET)
    @ApiOperation("获取居民所有康复计划")
    public Envelop selectAllPlaneByPatient_IJK(
            @ApiParam(name = "patient", value = "居民Code", required = true) @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "eventType", value = "1门诊 2住院", required = false) @RequestParam(value = "eventType", required = false) String eventType
    ) {
        try{
            JSONObject result = wlyyBusinessService.selectAllPlaneByPatient_IJK(patient,eventType);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "calendarPlanDetailListBypatient_IJK", method = RequestMethod.GET)
    @ApiOperation("康复管理--某患者的康复计划按列表展示")
    public Envelop calendarPlanDetailListBypatient_IJK(
            @ApiParam(name = "executeStartTime", value = "日历开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = false) @RequestParam(value = "executeStartTime", required = false) String executeStartTime,
            @ApiParam(name = "executeEndTime", value = "日历结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = false) @RequestParam(value = "executeEndTime", required = false) String executeEndTime,
            @ApiParam(name = "patient", value = "患者code", required = true) @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "searchTask", value = "快速查找任务:(1电话/短信关怀,2康复咨询,3健康监测,4上门服务,5康复指导,6康复随访,7康复复诊)", required = false) @RequestParam(value = "searchTask", required = false) Integer searchTask,
            @ApiParam(name = "doctorCode", value = "医生code(专科医生、家庭医生)", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "status", value = "任务状态(0未完成,1已完成,2已预约)", required = false) @RequestParam(value = "status", required = false) Integer status,
            @ApiParam(name = "taskExecutor", value = "任务执行人:0全部;1我的任务:2他人任务", required = false) @RequestParam(value = "taskExecutor", required = false, defaultValue = "0") String taskExecutor
    ) {
        try{
            JSONObject result = wlyyBusinessService.calendarPlanDetailListBypatient_IJK(executeStartTime,executeEndTime,patient,searchTask,doctorCode,status,taskExecutor);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "calendarPlanDetailItems_IJK", method = RequestMethod.GET)
    @ApiOperation("康复管理-康复计划服务项目按列表展示")
    public Envelop calendarPlanDetailItems_IJK(
            @ApiParam(name = "executeStartTime", value = "日历开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = false) @RequestParam(value = "executeStartTime", required = false) String executeStartTime,
            @ApiParam(name = "executeEndTime", value = "日历结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = false) @RequestParam(value = "executeEndTime", required = false) String executeEndTime,
            @ApiParam(name = "planId", value = "计划id", required = true) @RequestParam(value = "planId", required = true) String planId,
            @ApiParam(name = "searchTask", value = "快速查找任务:(1、我的任务,2、健康教育,3、健康指导,4、随访,5、复诊)", required = false) @RequestParam(value = "searchTask", required = false) Integer searchTask,
            @ApiParam(name = "doctorCode", value = "医生code(专科医生、家庭医生)", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "status", value = "任务状态(0未完成,1已完成,2已预约)", required = false) @RequestParam(value = "status", required = false) Integer status
    ) {
        try{
            JSONObject result = wlyyBusinessService.calendarPlanDetailItems_IJK(executeStartTime,executeEndTime,planId,searchTask,doctorCode,status);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "planSchedule_IJK", method = RequestMethod.GET)
    @ApiOperation("康复管理-计划总进度")
    public Envelop planSchedule_IJK(
            @ApiParam(name = "planId", value = "计划id", required = true) @RequestParam(value = "planId", required = true) String planId,
            @ApiParam(name = "patientCode", value = "居民code", required = true) @RequestParam(value = "patientCode", required = true) String patientCode) {
        try{
            JSONObject result = wlyyBusinessService.planSchedule_IJK(planId,patientCode);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "selectByMedicalCode_IJK", method = RequestMethod.GET)
    @ApiOperation("获取医院病历")
    public Envelop selectByMedicalCode_IJK(
            @ApiParam(name = "medical", value = "住院code", required = true) @RequestParam(value = "medical", required = true) String medical) {
        try{
            JSONObject result = wlyyBusinessService.selectByMedicalCode_IJK(medical);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "selectPlanServerDoctor_IJK", method = RequestMethod.POST)
    @ApiOperation("康复管理-康复计划的服务医生")
    public Envelop selectPlanServerDoctor_IJK(@ApiParam(name = "planId", value = "康复计划ID") @RequestParam(value = "planId", required = true) String planId) {
        try{
            JSONObject result = wlyyBusinessService.selectPlanServerDoctor_IJK(planId);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "getRehabilitationPlanLog_IJK",method = RequestMethod.GET)
    @ApiOperation(value = "获取康复计划修改记录")
    public Envelop getRehabilitationPlanLog_IJK(
            @ApiParam(name = "planId",value = "康复计划Id",required = true) @RequestParam(value = "planId",required = true) String planId){
        try{
            JSONObject result = wlyyBusinessService.getRehabilitationPlanLog_IJK(planId);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "calendarPlanDetailList_IJK", method = RequestMethod.GET)
    @ApiOperation("康复管理-康复计划按列表展示-限定频次")
    public Envelop calendarPlanDetailList_IJK(
            @ApiParam(name = "executeStartTime", value = "日历开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = true) @RequestParam(value = "executeStartTime", required = false) String executeStartTime,
            @ApiParam(name = "executeEndTime", value = "日历结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = true) @RequestParam(value = "executeEndTime", required = false) String executeEndTime,
            @ApiParam(name = "planId", value = "计划id", required = true) @RequestParam(value = "planId", required = true) String planId,
            @ApiParam(name = "searchTask", value = "快速查找任务:(1电话/短信关怀,2康复咨询,3健康监测,4上门服务,5康复指导,6康复随访,7康复复诊)", required = false) @RequestParam(value = "searchTask", required = false) Integer searchTask,
            @ApiParam(name = "doctorCode", value = "医生code(专科医生、家庭医生)", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "status", value = "任务状态(0未完成,1已完成,2已预约)", required = false)@RequestParam(value = "status", required = false) Integer status,
            @ApiParam(name = "taskExecutor", value = "任务执行人:0全部;1我的任务:2他人任务", required = false) @RequestParam(value = "taskExecutor", required = false, defaultValue = "0") String taskExecutor) {
        try{
            JSONObject result = wlyyBusinessService.calendarPlanDetailList_IJK(executeStartTime,executeEndTime,planId,searchTask,doctorCode,status,taskExecutor );
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "getPatientDrugList_IJK", method = RequestMethod.GET)
    @ApiOperation("获取居民出院带药列表")
    public Envelop getPatientDrugList_IJK(@ApiParam(name = "patient", value = "居民Code", required = true)
                                     @RequestParam(value = "patient", required = true) String patient) {
        try{
            JSONObject result = wlyyBusinessService.getPatientDrugList_IJK(patient);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    /**
     * i健康康复列表页
     * doctorCode: ff5127fbb57a414eb8f397b44a7ff288
     * patientInfo:
     * level: 3
     * area: 3502110100
     * diseaseCode:
     * turnDownState: 0
     * page: 1
     * pageSize: 10
     * doctorType: 1
     * filterPlan: 1
     */
    @RequestMapping(value = "selectBySpecialistDoctor_IJK", method = RequestMethod.GET)
    @ApiOperation("康复管理-获取签约专科居民")
    public Envelop selectBySpecialistDoctor_IJK(
            @ApiParam(name = "doctorCode", value = "医生code", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "doctorType", value = "医生类型(1专科2家医)", required = false) @RequestParam(value = "doctorType", required = false) String doctorType,
            @ApiParam(name = "patientInfo", value = "身份证或者姓名", required = false) @RequestParam(value = "patientInfo", required = false) String patientInfo,
            @ApiParam(name = "diseaseCode", value = "疾病类型code", required = false) @RequestParam(value = "diseaseCode", required = false) String diseaseCode,
            @ApiParam(name = "level", value = "1市2区3社区 4表示无归属", required = false) @RequestParam(value = "level", required = false) String level,
            @ApiParam(name = "area", value = "区域", required = false) @RequestParam(value = "area", required = false) String area,
            @ApiParam(name = "page", value = "第几页,从1开始", required = true) @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true) @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
            @ApiParam(name = "filterPlan", value = "是否过滤康复计划,1过滤,0或者放空不过滤", required = false) @RequestParam(value = "filterPlan", required = false) String filterPlan,
            @ApiParam(name = "turnDownState", value = "下转状态 0全部;1已下转;2已接受;3未下转", required = false) @RequestParam(value = "turnDownState", required = false, defaultValue = "0") String turnDownState,
            @ApiParam(name = "eventType", value = "1为门诊  2或者空为住院", required = false) @RequestParam(value = "eventType", required = false) String eventType
    ) {
        try{
            JSONObject result = wlyyBusinessService.selectBySpecialistDoctor_IJK(doctorCode,doctorType,patientInfo,diseaseCode,level,area,page,pageSize,filterPlan,turnDownState,eventType);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @RequestMapping(value = "/getPatientCount_IJK", method = RequestMethod.GET)
    @ApiOperation(value = "获取专科首页各类型数目")
    public Envelop getPatientCount_IJK(
            @ApiParam(name = "doctor", value = "医生code", required = false) @RequestParam(value = "doctor", required = false) String doctor
    ) {
        try{
            JSONObject result = wlyyBusinessService.getPatientCount_IJK(doctor);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
}

+ 8 - 14
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/team/DoctorTeamEndpoint.java

@ -107,20 +107,14 @@ public class DoctorTeamEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "getSignList")
    @ApiOperation(value = "获取签约社区列表分页")
    public String getSignList(@RequestParam(required = false) String name,
                               @RequestParam(required = false) Integer page,
                               @RequestParam(required = false) Integer pageSize,
                               @RequestParam(required = false) String teamId,
                               @RequestParam(required = false) String hospital,
                               @RequestParam(required = false) String adminTeamCode,
                               @RequestParam(required = false) String doctor,
                               @RequestParam(required = false) String doctorName,
                               @RequestParam(required = false) String doctorHealthName,
                               @RequestParam(required = false) String hospitalName,
                               @RequestParam(required = false) String idcard,
                               @RequestParam(required = false) String address,
                               @RequestParam(required = false) String teamName,
                               @RequestParam(required = false) String leaderName) {
    public String getSignList(
            @RequestParam(required = false) String name, @RequestParam(required = false) Integer page,
            @RequestParam(required = false) Integer pageSize, @RequestParam(required = false) String teamId,
            @RequestParam(required = false) String hospital, @RequestParam(required = false) String adminTeamCode,
            @RequestParam(required = false) String doctor, @RequestParam(required = false) String doctorName,
            @RequestParam(required = false) String doctorHealthName, @RequestParam(required = false) String hospitalName,
            @RequestParam(required = false) String idcard, @RequestParam(required = false) String address,
            @RequestParam(required = false) String teamName, @RequestParam(required = false) String leaderName) {
        try {
            return wlyyBusinessService.getSignList(name,page,pageSize,TONGAN_TOWN,hospital,adminTeamCode,doctor,doctorName,
                    doctorHealthName,hospitalName, idcard, address,teamName,leaderName,teamId).toJSONString();

+ 13 - 3
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/controller/DoctorRehabilitaionInfoController.java

@ -79,7 +79,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
                doctorId = getUID();
                System.out.println("医生id==>getUID()==>" + getUID());
            }
            JSONObject result = rehabilitationInfoService.getRehabilitationPatientListNew( downPatientId,idcard, doctorId, status, page, pagesize);
            JSONObject result = rehabilitationInfoService.getRehabilitationPatientListNew(downPatientId, idcard, doctorId, status, page, pagesize);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
@ -196,7 +196,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            if (StringUtils.isBlank(doctorId)) {
                doctorId = getUID();
            }
            List<Map<String, Object>> result = rehabilitationInfoService.getRehabilitationPatientPlan(idcard, doctorId, patientId, finishStatus, page, pagesize,diseaseId);
            List<Map<String, Object>> result = rehabilitationInfoService.getRehabilitationPatientPlan(idcard, doctorId, patientId, finishStatus, page, pagesize, diseaseId);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
@ -254,7 +254,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            @ApiParam(name = "diseaseId", value = "专病id", required = false) @RequestParam(value = "diseaseId", required = false) String diseaseId
    ) {
        try {
            List<Map<String, Object>> result = rehabilitationInfoService.getPatientRehabilitationByPatientId(patientId,planId,diseaseId);
            List<Map<String, Object>> result = rehabilitationInfoService.getPatientRehabilitationByPatientId(patientId, planId, diseaseId);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
@ -344,6 +344,16 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    }
    /**
     * 社区管理-i健康数量
     */
    @RequestMapping(value = "getRehabilitationCount_IJK", method = RequestMethod.GET)
    @ApiOperation("获取频次服务的信息")
    public String getRehabilitationCount_IJK() {
        return null;
    }
    //=================================================没有用到的======================================================================
    @RequestMapping(value = "getRehabilitationPatientList", method = RequestMethod.GET)
    @ApiOperation("获取康复管理居民列表")