瀏覽代碼

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

wangzhinan 6 年之前
父節點
當前提交
92f65e6d27

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

@ -43,6 +43,8 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntityWithOperator
    private String abortReason;//中止原因
    @Column(name = "abort_time")
    private Date abortTime;//中止时间
    @Column(name = "patient_img")
    private String patientImg;//居民签名照/证件照
    @Column(name = "saas_id")
    public String getSaasId() {
@ -161,4 +163,13 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntityWithOperator
    public void setAbortTime(Date abortTime) {
        this.abortTime = abortTime;
    }
    @Column(name = "patient_img")
    public String getPatientImg() {
        return patientImg;
    }
    public void setPatientImg(String patientImg) {
        this.patientImg = patientImg;
    }
}

+ 2 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/specialist/SpecialistMapping.java

@ -98,6 +98,8 @@ public class SpecialistMapping {
        public static final String selectByLabelAndPatient = "/selectByLabelAndPatient";
        public static final String sendToFamilyDoctor = "/sendToFamilyDoctor";
        public static final String abortPlanById = "/abortPlanById";
        public static final String updatePatientImgById = "/updatePatientImgById";
    }
    public static class serviceItem{

+ 5 - 3
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -381,12 +381,12 @@ public class SpecialistController extends EnvelopRestEndpoint {
    @GetMapping(value = SpecialistMapping.specialist.searchPatientInSpecialist)
    @ApiOperation(value = "搜索注册居民")
    public MixEnvelop searchPatientInSpecialist(
//            @ApiParam(name = "doctorCode", value = "医生code",required = true) @RequestParam(required = true)String doctorCode,
            @ApiParam(name = "doctorCode", value = "医生code",required = true) @RequestParam(required = true)String doctorCode,
            @ApiParam(name = "keywords", value = "居民姓名,手机号,身份证") @RequestParam(required = false)String keywords,
            @ApiParam(name = "page", value = "第几页,1开始",defaultValue = "1") @RequestParam(required = true,defaultValue = "1")Integer page,
            @ApiParam(name = "pageSize", value = "每页大小",defaultValue = "5") @RequestParam(required = true,defaultValue = "5")Integer pageSize){
        try {
            return specialistService.searchPatientInSpecialistNew(keywords,page,pageSize);
            return specialistService.searchPatientInSpecialistNew(doctorCode,keywords,page,pageSize);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -399,10 +399,12 @@ public class SpecialistController extends EnvelopRestEndpoint {
    public ObjEnvelop<Object> searchPatientInSpecialist(
            @ApiParam(name = "doctorCode", value = "医生code",required = true)
            @RequestParam(value = "doctorCode",required = true)String doctorCode,
            @ApiParam(name = "signStatus", value = "签约状态,待审核:0;未签约:-1",required = true)
            @RequestParam(value = "signStatus",required = true)String signStatus,
            @ApiParam(name = "patientCode", value = "居民id",required = true)
            @RequestParam(value = "patientCode",required = true)String patientCode){
        try {
            JSONObject object=specialistService.doctorForSpecialistInfo(doctorCode,patientCode);
            JSONObject object=specialistService.doctorForSpecialistInfoNew(signStatus,doctorCode,patientCode);
            return  success(object);
        }catch (Exception e){
            e.printStackTrace();

+ 15 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java

@ -341,4 +341,19 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = SpecialistMapping.rehabilitation.updatePatientImgById)
    @ApiOperation(value = "更新康复计划居民签名照/证件照")
    public Envelop updatePatientImgById(@ApiParam(name = "planId", value = "康复计划id", required = true)
                                            @RequestParam(value = "planId")String planId,
                                        @ApiParam(name = "patientImg", value = "居民签名/证件照地址",required = true)
                                            @RequestParam(value = "patientImg")String patientImg){
        try {
            return rehabilitationPlanService.updatePatientImgById(planId, patientImg);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 8 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/PatientRehabilitationPlanDao.java

@ -45,4 +45,12 @@ public interface PatientRehabilitationPlanDao extends PagingAndSortingRepository
    @Query("select p from PatientRehabilitationPlanDO p where p.disease =?1 and p.status=1 and p.patient=?2")
    List<PatientRehabilitationPlanDO> selectByDiseaseAndPatient(String disease,String patient);
    @Modifying
    @Query("update PatientRehabilitationPlanDO t set t.patientImg = ?2 where t.id=?1 ")
    int updatePatientImgById(String planId, String patientImg);
    @Query("update PatientRehabilitationPlanDO a set a.status=?1,a.abortTime= ?3 where a.id =?2 ")
    @Modifying
    int updateStatusAndTimeById(Integer status, String id, Date date);
}

+ 173 - 17
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -187,8 +187,6 @@ public class SpecialistService{
    public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType, String labelCode, Integer page, Integer size){
    
    
        String sql="SELECT " +
                " p. NAME, " +
                " p. CODE, " +
@ -223,7 +221,11 @@ public class SpecialistService{
                " ) lb " +
                " JOIN "+basedb+".wlyy_patient p ON p. CODE = lb.patient " +
                " JOIN wlyy_specialist_patient_relation s ON s.patient = lb.patient " +
                " WHERE ( s.doctor ='"+doctor+"' OR s.health_doctor='"+doctor+"' OR s.health_assistant='"+doctor+ "') AND s.status >=0  AND s.sign_status >0"+
                " WHERE s.doctor in " +
                " (SELECT m.doctor_code FROM  wlyy.wlyy_admin_team_member m where m.team_id in " +
                " (SELECT dt.id FROM  wlyy.wlyy_admin_team dt LEFT JOIN  wlyy.wlyy_admin_team_member watm ON dt.id=watm.team_id " +
                " WHERE dt.available='1' AND watm.available='1' AND watm.doctor_code='"+doctor+"') AND  m.available='1') "+
                " AND s.status >=0  AND s.sign_status >0"+
                " LIMIT "+(page-1)*size+","+size;
        System.out.print("日志:"+sql);
        if("7".equals(labelType)){
@ -242,13 +244,15 @@ public class SpecialistService{
                    "JOIN "+basedb+".wlyy_patient_disease_server b ON a.id=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+
                    "JOIN "+basedb+".wlyy_patient c ON a.patient=c.CODE " +
                    "LEFT JOIN "+basedb+".wlyy_sign_patient_label_info d ON a.patient=d.patient AND d.label_type=8 AND d.`status`=1" +
                    " WHERE a.sign_status> 0 AND a.`status`>=0 AND a.doctor='"+doctor+"' OR a.health_assistant= '"+doctor+
                    "' LIMIT "+(page-1)*size+","+size;
                    " WHERE a.sign_status> 0 AND a.`status`>=0 " +
//                    "AND a.doctor='"+doctor+"' OR a.health_assistant= '"+doctor+
                    " AND a.doctor in " +
                    " (SELECT m.doctor_code FROM  wlyy.wlyy_admin_team_member m where m.team_id in " +
                    " (SELECT dt.id FROM  wlyy.wlyy_admin_team dt LEFT JOIN  wlyy.wlyy_admin_team_member watm ON dt.id=watm.team_id " +
                    " WHERE dt.available='1' AND watm.available='1' AND watm.doctor_code='"+doctor+"') AND  m.available='1') "+
                    " LIMIT "+(page-1)*size+","+size;
        }
        List<PatientLabelVO> PatientLabelVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientLabelVO.class));
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,PatientLabelVOs);
    }
@ -616,15 +620,19 @@ public class SpecialistService{
                " d.hospital_name AS hospital_name, " +
                " d.`level` " +
                " FROM " +
                " wlyy_specialist_patient_relation r " +
                " wlyy_specialist.wlyy_specialist_patient_relation r " +
                " JOIN "+basedb+".wlyy_doctor d ON r.doctor = d.`code` " +
                " WHERE  " +
                " r.patient ='"+patient+"' " +
                " AND r.doctor ='"+doctor+"' " +
                " AND r.doctor in" +
                " (SELECT m.doctor_code FROM  wlyy.wlyy_admin_team_member m where m.team_id in  " +
                "  (SELECT dt.id FROM  wlyy.wlyy_admin_team dt LEFT JOIN  wlyy.wlyy_admin_team_member watm ON dt.id=watm.team_id  " +
                "  WHERE dt.available='1' AND watm.available='1' AND watm.doctor_code='"+doctor+"') AND  m.available='1')" +
                " AND r.`status`>=0 " +
                " AND r.sign_status >0 ) r join "+basedb+".wlyy_patient p on r.patient = p.code order by p.czrq DESC ";
        List<PatientSignInfoVO> patientSignInfoVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientSignInfoVO.class));
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientSignInfoVOs.get(0));
        PatientSignInfoVO patientSignInfoVO = (null != patientSignInfoVOs && patientSignInfoVOs.size() > 0 )? patientSignInfoVOs.get(0):null;
        return MixEnvelop.getSuccess(SpecialistMapping.api_success, patientSignInfoVO);
    }
    
    public MixEnvelop findDoctorAndDoctorHealthBySpecialDoctor(String doctor,String name) {
@ -839,9 +847,15 @@ public class SpecialistService{
     * 病人的家签信息、专科开通信息
     * @param doctorCode 医生code
     * @param patientCode 病人id
     * @param signStatus 签约状态,待审核:0;未签约:-1
     */
    public JSONObject doctorForSpecialistInfo(String doctorCode, String patientCode)  throws Exception{
    public JSONObject doctorForSpecialistInfo(String signStatus,String doctorCode, String patientCode)  throws Exception{
        JSONObject jsonObject = new JSONObject();
        SpecialistPatientRelationDO specialistPatientRelationDO = new SpecialistPatientRelationDO();
        //待审核
        if ("0".equals(signStatus)) {
            specialistPatientRelationDO = specialistPatientRelationDao.findByDoctorAndPatient(doctorCode, patientCode);
        }
        //1、获取居民基础信息
        String preSql = "SELECT p.name as name, p.photo as photo,p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
                " CASE  WHEN wd.name is null THEN '无' ELSE wd.name END as doctorName,CASE  WHEN wd.hospital_name is NULL THEN '无' ELSE wd.hospital_name END as hospitalName,CASE  WHEN wd.mobile is NULL THEN '无' ELSE wd.mobile END as doctorMobole ";
@ -902,6 +916,118 @@ public class SpecialistService{
        return jsonObject;
    }
    /**
     * 病人的家签信息、专科开通信息
     * @param doctorCode 医生code
     * @param patientCode 病人id
     * @param signStatus 签约状态,待审核:0;未签约:-1
     */
    public JSONObject doctorForSpecialistInfoNew(String signStatus,String doctorCode, String patientCode)  throws Exception{
        JSONObject jsonObject = new JSONObject();
        SpecialistPatientRelationDO specialistPatientRelationDO = new SpecialistPatientRelationDO();
        //待审核
        if ("0".equals(signStatus)) {
            specialistPatientRelationDO = selectByDoctorAndPatient(doctorCode, patientCode);
        }
        jsonObject.put("specialistPatientRelationId", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getId());
        //1、获取居民基础信息
        String preSql = "SELECT p.name as name, p.photo as photo,p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
                " CASE  WHEN wd.name is null THEN '无' ELSE wd.name END as doctorName,CASE  WHEN wd.hospital_name is NULL THEN '无' ELSE wd.hospital_name END as hospitalName,CASE  WHEN wd.mobile is NULL THEN '无' ELSE wd.mobile END as doctorMobole ";
        String patientSql = " from " + basedb + ".wlyy_patient p LEFT JOIN " + basedb + ".wlyy_sign_family wsf " +
                " ON p.code=wsf.patient AND wsf.type='2' AND wsf.status='1' " +
                " LEFT JOIN " + basedb + ".wlyy_doctor wd ON wsf.doctor =wd.code WHERE p.code='" + patientCode + "'";
        //一个居民 生效的家签信息只会有一条
        Map<String, Object> map = jdbcTemplate.queryForMap(preSql + patientSql);
        map.put("age",IdCardUtil.getAgeForIdcard(map.get("idcard")+""));
        String sexCode=IdCardUtil.getSexForIdcard_new(map.get("idcard")+"");
        String sexName="";
        if("1".equals(sexCode)){
            sexName="男";
        }else if("2".equals(sexCode)){
            sexName="女";
        }else{
            sexName="未知";
        }
        map.put("sex",sexName);
        jsonObject.put("patientInfo", map);
        //2、获取医生信息(所属医院、科室、姓名)
        String doctorSql = "SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName,wd.name as name FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + doctorCode + "'";;
        if("0".equals(signStatus)){
            doctorSql="SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName,wd.name as name FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + specialistPatientRelationDO.getDoctor() + "'";
        }
        Map<String,Object> result =jdbcTemplate.queryForMap(doctorSql);
        if(doctorCode.equals(specialistPatientRelationDO.getDoctor())){
            result.put("buttonShowFlag",true);
        }else{
            result.put("buttonShowFlag",false);
        }
        jsonObject.put("doctorInfo", result);
        //3、获取该医生所属团队及团队成员信息
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code, wd.NAME as doctorName  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
                "WHERE tm.team_id IN ( SELECT watm.team_id teamId FROM  " + basedb + ".wlyy_admin_team_member watm WHERE watm.doctor_code ='" + doctorCode + "'" + " AND watm.available = '1' ) AND tm.available='1' AND `at`.id=tm.team_id";
        List<Map<String, Object>> teamList = jdbcTemplate.queryForList(teamSql);
        Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList()));
        List<Map<String, Object>> mapList = new ArrayList<>();
        for (Integer i : m.keySet()) {
            Map<String, Object> objectMap = new HashMap<>();
            if ("0".equals(signStatus) && i.equals(specialistPatientRelationDO.getTeamCode())) {
                objectMap.put("checkFlag", true);
            } else {
                objectMap.put("checkFlag", false);
            }
            objectMap.put("teamId", i);
            objectMap.put("teamName", m.get(i).get(0).get("teamName"));
            objectMap.put("teamDoctors", m.get(i));
            //获取专科团队疾病标签
            String disSql = "SELECT wtdr.disease_code, wtdr.disease_name from  wlyy.wlyy_team_disease_relation wtdr WHERE wtdr.team_code ='" + i + "'" +"  AND wtdr.del='1'";
            //new BeanPropertyRowMapper(
            List<Map<String, Object>>  stringList = jdbcTemplate.queryForList(disSql);
            String areaSql = "SELECT wpds.disease FROM wlyy.wlyy_patient_disease_server wpds WHERE wpds.patient='" + patientCode + "'" + " AND wpds.del='1'";
            List<String> signDiseaseList = jdbcTemplate.queryForList(areaSql,String.class);
            Set<String> stringSet =new HashSet<>(signDiseaseList);
            List<String> speciaSignDiseaseList = new ArrayList<>();
            if("0".equals(signStatus) ){
                String speciaSignSql = "SELECT wpds.disease FROM wlyy.wlyy_patient_disease_server wpds WHERE wpds.patient='" + patientCode + "'" + " AND wpds.del='1' and wpds.specialist_relation_code='" + specialistPatientRelationDO.getId() + "'";
                speciaSignDiseaseList = jdbcTemplate.queryForList(speciaSignSql,String.class);
            }
            Set<String> speciaSignSet =new HashSet<>(speciaSignDiseaseList);
            //已签约的疾病状态改成1
            stringList.stream().forEach(item->{
                int status=0;
                if(stringSet.contains( item.get("disease_code"))){
                    //已签约过的疾病
                    status=1;
                }
                if(null!=speciaSignSet&& speciaSignSet.contains(item.get("disease_code"))){
                    //本次专病签约的疾病
                    status=2;
                }
                item.put("status",status) ;
            });
            objectMap.put("teamDisease", stringList);
            mapList.add(objectMap);
        }
        jsonObject.put("teamAndDoctors", mapList);
        //康复情况标签
        String labelSql = "SELECT wspl.label_code,wspl.label_name from  wlyy.wlyy_sign_patient_label wspl WHERE wspl.label_type='8' AND status='1'";
        List<Map<String, Object>> signPatientLabelList = jdbcTemplate.queryForList(labelSql);
        //居民的康复情况
        String patientLabelSql = "SELECT wspl.label from  wlyy.wlyy_sign_patient_label_info wspl WHERE wspl.patient='"+patientCode+"' and  wspl.label_type='8' AND status='1'";
        List<String> patientLabelList = jdbcTemplate.queryForList(patientLabelSql,String.class);
        Set<String> patientLabelSet =new HashSet<>(patientLabelList);
        signPatientLabelList.stream().forEach(item->{
            item.put("status",patientLabelSet.contains(item.get("label_code").toString())?1:0) ;
        });
        jsonObject.put("signPatientLabels", signPatientLabelList);
        return jsonObject;
    }
    /**
     * 专科医生发起签约
     * @param specialistPatientRelationDO
@ -958,21 +1084,33 @@ public class SpecialistService{
     * 专科-通过手机号码精确搜索注册居民
     * @param keywords
     */
    public MixEnvelop searchPatientInSpecialistNew(String keywords,Integer page,Integer pageSize) throws Exception{
    public MixEnvelop searchPatientInSpecialistNew(String doctorCode,String keywords,Integer page,Integer pageSize) throws Exception{
        String sql1 = " select count(1) as num ";
        String sql2 = " select p.name as name,p.idcard,p.code,p.photo ,r.sign_status";
        String sql2 = " select p.name as name,p.idcard,p.code,p.photo";
        String whereSql ="";
        if(!StringUtils.isEmpty(keywords)){
            whereSql+=" and  p.mobile ='"+keywords+"'";
        }
        //根据手机号码精确查找居民
        String centerSql =" from "+basedb+".wlyy_patient p LEFT JOIN wlyy_specialist.wlyy_specialist_patient_relation r ON p.code=r.patient where  p.openid IS NOT NULL "+whereSql;
        String centerSql =" from "+basedb+".wlyy_patient p /*LEFT JOIN wlyy_specialist.wlyy_specialist_patient_relation r ON p.code=r.patient */where  p.openid IS NOT NULL "+whereSql;
        String signSql ="SELECT r.patient,r.sign_status  FROM  wlyy_specialist.wlyy_specialist_patient_relation r WHERE (r.sign_status = '1' or r.sign_status = '0') " +
                " AND doctor in (SELECT m.doctor_code FROM  "+basedb+".wlyy_admin_team_member m where m.team_id in " +
                " (SELECT dt.id FROM  "+basedb+".wlyy_admin_team dt LEFT JOIN  "+basedb+".wlyy_admin_team_member watm ON dt.id=watm.team_id " +
                " WHERE dt.available='1' AND watm.available='1' AND watm.doctor_code='"+doctorCode+"') AND  m.available='1')";
        List<Map<String,Object>> map1=jdbcTemplate.queryForList(signSql);
        String sqlCount=sql1+centerSql;
        String sql=sql2+centerSql+" LIMIT "+(page-1)*pageSize+","+pageSize;
        List<Map<String,Object>> map = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> countMap = jdbcTemplate.queryForList(sqlCount);
        //根据居民查找专科签约状态
        //已签约专科,获取签约信息
        Map<String,String> patientMap = new HashMap<>();
        if(null!=map1){
            map1.stream().forEach(temp->{
                patientMap.put(temp.get("patient").toString(),temp.get("sign_status").toString()) ;
            });
        }
        //未签约,获取居民信息,及专科医生信息
        List<Map<String,Object>> resultList = new ArrayList<>();
        Map m = null;
@ -983,13 +1121,14 @@ public class SpecialistService{
            m = new HashMap();
            age = IdCardUtil.getAgeForIdcard(one.get("idcard")+"");
            sex = IdCardUtil.getSexForIdcard_new(one.get("idcard")+"");
            String patientCode=null==one.get("code")?"":one.get("code").toString();
            m.put("name",one.get("name"));
            m.put("age",age);
            m.put("sex",sex);
            //1已签约,0待审核,-1未签约或已取消或已拒绝
            if(null != one.get("sign_status")&& one.get("sign_status").toString()=="1"){
            if(patientMap.containsKey(patientCode)&&"1".equals(patientMap.get(patientCode))){
                m.put("sign_status", 1);
            }else if(null != one.get("sign_status")&& one.get("sign_status").toString()=="0"){
            }else if(patientMap.containsKey(patientCode)&&"0".equals(patientMap.get(patientCode))){
                m.put("sign_status", 0);
            }else {
                m.put("sign_status", -1);
@ -1008,4 +1147,21 @@ public class SpecialistService{
        }
        return MixEnvelop.getSuccessListWithPage(SpecialistMapping.api_success,resultList,page,pageSize,countMap.size()>0?Long.valueOf(countMap.get(0).get("num")+""):0);
    }
    /**
     * 根据医生和居民code查询居民与该医生所在团队的待审核专科签约信息
     *
     * @param patient
     * @param doctor
     * @return
     */
    public SpecialistPatientRelationDO selectByDoctorAndPatient(String doctor,String patient){
        String sql = "select * from wlyy_specialist.wlyy_specialist_patient_relation r where r.doctor in ( " +
                " SELECT m.doctor_code  FROM wlyy.wlyy_admin_team_member m " +
                " WHERE  m.team_id IN ( SELECT dt.id  FROM  wlyy.wlyy_admin_team dt LEFT JOIN wlyy.wlyy_admin_team_member watm ON dt.id = watm.team_id   WHERE " +
                " dt.available = '1' AND watm.available = '1'  AND watm.doctor_code = '"+doctor+"') AND m.available = '1'  ) and r.patient = '"+patient+"' and r.sign_status=0";
        List<SpecialistPatientRelationDO> relationDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationDO.class));
        SpecialistPatientRelationDO specialistPatientRelationDO=null!=relationDOS&&relationDOS.size()>0?relationDOS.get(0):new SpecialistPatientRelationDO();
        return specialistPatientRelationDO;
    }
}

+ 21 - 3
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -78,7 +78,7 @@ public class RehabilitationManageService {
            sql.replace("from", ",f.idcard,f.hospital_name from");
            sql += leftSql;
        }
        sql += " where p.`status` > 0 ";
        sql += " where 1=1 ";
        if(planType!=null){
            sql += " and p.plan_type="+planType;
        }
@ -1165,7 +1165,7 @@ public class RehabilitationManageService {
            }
            if (rehabilitationDetailDOList.size()>0 && rehabilitationDetailDOList.size()==allCount){
                planId = rehabilitationDetailDOList.get(0).getPlanId();
                patientRehabilitationPlanDao.updateStatusById(2,planId);
                patientRehabilitationPlanDao.updateStatusAndTimeById(2,planId, new Date());
            }
        }catch (Exception e){
            throw  new Exception("更新服务状态失败!");
@ -1238,6 +1238,8 @@ public class RehabilitationManageService {
            resultMap.put("diseaseName",p.getDiseaseName());
            resultMap.put("createUser",p.getCreateUser());
            resultMap.put("planTitle",p.getTitle());
            resultMap.put("status", p.getStatus());
            resultMap.put("patientImg", p.getPatientImg());
        }
//        resultMap.put("healthyCondition",healthyCondition);
        return ObjEnvelop.getSuccess(SpecialistMapping.api_success,resultMap);
@ -1321,7 +1323,7 @@ public class RehabilitationManageService {
                " p.patient," +
                " p.`name`," +
                " p.title," +
                " p.disease_name,p.abort_reason,p.abort_time," +
                " p.disease_name,p.abort_reason,p.abort_time,p.create_time," +
                " a.*" +
                " FROM" +
                " wlyy_patient_rehabilitation_plan p" +
@ -1351,6 +1353,8 @@ public class RehabilitationManageService {
        Integer finishCount = list.size();//完成服务项目数
        double totalExpense = 0;
        Set<String> hospitalSet = new HashSet();
        Set<String> serviceDoctor = new HashSet();
        DecimalFormat df = new DecimalFormat("0.00");
        for (Map<String,Object> map : list){
            double expense = 0;
@ -1359,11 +1363,25 @@ public class RehabilitationManageService {
            }
            totalExpense += expense;
            map.put("expense",df.format(expense/100));
            //组装机构和服务医生
            if(map.get("hospital") != null){
                if(map.get("hospital_name") != null && !hospitalSet.contains(("hospital_name") + "")) {
                    hospitalSet.add(map.get("hospital_name") + "");
                }
            }
            if(map.get("doctor_code") != null){
                if(map.get("doctor_name") != null && !hospitalSet.contains(("doctor_name") + "")) {
                    serviceDoctor.add(map.get("doctor_name") + "");
                }
            }
        }
        reslutMap.put("totalExpense",df.format(totalExpense/100));
        reslutMap.put("allCount",allCount);
        reslutMap.put("finishCount",finishCount);
        reslutMap.put("serviceList",list);
        reslutMap.put("hospitalAll", hospitalSet.toString().replace("[","").replace("]","").replace(",", "、"));
        reslutMap.put("serviceDoctor", serviceDoctor.toString().replace("[","").replace("]","").replace(",", "、"));
        return ObjEnvelop.getSuccess(SpecialistMapping.api_success,reslutMap);
    }
}

+ 16 - 2
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

@ -373,9 +373,16 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
     * @return
     */
    public MixEnvelop updatePlanStatusById(Integer status, String planId) throws Exception{
        if(patientRehabilitationPlanDao.updateStatusById(status,planId)>0){
        if(status == 1) {
            if (patientRehabilitationPlanDao.updateStatusById(status, planId) > 0) {
            return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientRehabilitationPlanDao.findById(planId));
                return MixEnvelop.getSuccess(SpecialistMapping.api_success, patientRehabilitationPlanDao.findById(planId));
            }
        }else if(status == 2){
            if (patientRehabilitationPlanDao.updateStatusAndTimeById(2,planId, new Date()) > 0) {
                return MixEnvelop.getSuccess(SpecialistMapping.api_success, patientRehabilitationPlanDao.findById(planId));
            }
        }
        return MixEnvelop.getError("更新失败!");
    }
@ -404,4 +411,11 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
    public List<PatientRehabilitationPlanDO> selectByLabelAndPatient(String patient,String label){
        return patientRehabilitationPlanDao.selectByDiseaseAndPatient(label,patient);
    }
    public Envelop updatePatientImgById(String planId, String patientImg) {
        if(patientRehabilitationPlanDao.updatePatientImgById(planId,patientImg) > 0){
            return Envelop.getSuccess(SpecialistMapping.api_success);
        }
        return Envelop.getError("更新失败!");
    }
}

+ 3 - 3
svr/svr-wlyy-specialist/src/main/resources/application.yml

@ -100,7 +100,7 @@ wechat:
  accId: gh_ffd64560fb21
im:
  im_list_get: http://172.19.103.88:3000/
  im_list_get: http://192.168.131.172:3000/
  #im_list_get: http://192.168.131.24:3000/
  data_base_name: ichat
@ -137,7 +137,7 @@ wechat:
  accId: gh_ffd64560fb21
im:
  im_list_get: http://172.19.103.88:3000/
  im_list_get: http://192.168.131.172:3000/
  data_base_name: im_new
---
@ -173,7 +173,7 @@ wechat:
  accId: gh_ffd64560fb21
im:
  im_list_get: http://172.19.103.88:3000/
  im_list_get: http://192.168.131.172:3000/
  data_base_name: im_new
---
spring: