Browse Source

Merge branch 'dev' of liuwenbin/wlyy2.0 into dev

liuwenbin 6 years ago
parent
commit
a9f68ba588

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

@ -79,11 +79,13 @@ public class SpecialistMapping {
        public static final String findServiceItemsByHospital = "/findServiceItemsByHospital";
        public static final String serviceDoctorList = "/serviceDoctorList";
        public static final String dailyJob = "/dailyJob";
        public static final String dailyJobReserve = "/dailyJobReserve";
        public static final String appCalendarPlanDetailList = "/appCalendarPlanDetailList";
        public static final String updatePlanDetailStatusById = "/updatePlanDetailStatusById";
        public static final String updatePlanStatusById = "/updatePlanStatusById";
        public static final String planSchedule = "/planSchedule";
        public static final String planListByPatient = "/planListByPatient";
        public static final String patientCount = "/patientCount";
    }
    public static class serviceItem{

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

@ -346,4 +346,32 @@ public class RehabilitationManageController {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = SpecialistMapping.rehabilitation.patientCount)
    @ApiOperation(value = "医生已计划数,已完成计划数(居民数)")
    public ObjEnvelop patientCount(@ApiParam(name = "doctorCode", value = "医生code", required = true)
                               @RequestParam(value = "doctorCode", required = true)String doctorCode){
        try {
            return rehabilitationManageService.patientCount(doctorCode);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = SpecialistMapping.rehabilitation.dailyJobReserve)
    @ApiOperation(value = "10天、7天、5天、当天康复服务预约复诊通知")
    public ObjEnvelop dailyJobReserve(@ApiParam(name = "startTime", value = "开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                               @RequestParam(value = "startTime", required = true)String startTime,
                               @ApiParam(name = "endTime", value = "结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                               @RequestParam(value = "endTime", required = true)String endTime){
        try {
            return rehabilitationManageService.dailyJobReserve(startTime,endTime);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return ObjEnvelop.getError(e.getMessage());
        }
    }
}

+ 1 - 1
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistPatientRelationDao.java

@ -17,6 +17,6 @@ public interface SpecialistPatientRelationDao extends PagingAndSortingRepository
    @Query("select p from SpecialistPatientRelationDO p where p.doctor=?1 and p.patient =?2 and p.status>=0")
    public SpecialistPatientRelationDO findByDoctorAndPatient(String doctor,String patient);
    @Query("select p from SpecialistPatientRelationDO p where p.doctor=?1 and p.patient=?2 and p.signStatus='1' and p.status>=0 ")
    @Query("select p from SpecialistPatientRelationDO p where p.doctor=?1 and (p.patient=?2 or p.healthAssistant=?2) and p.signStatus='1' and p.status>=0 ")
    SpecialistPatientRelationDO findByPatientAndDoctor(String doctor,String patient);
}

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

@ -29,4 +29,10 @@ public interface PatientRehabilitationPlanDao extends PagingAndSortingRepository
    @Modifying
    @Query("update PatientRehabilitationPlanDO p set p.servicePackageId = ?2 where p.id = ?1")
    void updateServicePackageId(String planId, String servicePackageId);
    @Query("select count(distinct p.patient) from PatientRehabilitationPlanDO p where p.createUser=?1  and p.status>0 ")
    Integer patientCount(String doctorCode);
    @Query("select count(distinct p.patient) from PatientRehabilitationPlanDO p where p.createUser=?1  and p.status=1 ")
    Integer patientCountByUnfinish(String doctorCode);
}

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

@ -656,7 +656,8 @@ public class RehabilitationManageService {
            serviceDoctorList.add(healthDoctorMap);
        }
        String specialistRelationSql = "select * from wlyy_specialist.wlyy_specialist_patient_relation where patient='"+patientCode+"' and sign_status='1' and status >=0  ";
//        String specialistRelationSql = "select * from wlyy_specialist.wlyy_specialist_patient_relation where patient='"+patientCode+"' and sign_status='1' and status >=0  ";
        String specialistRelationSql = "select DISTINCT d.doctor,d.doctor_name from wlyy_specialist.wlyy_rehabilitation_plan_detail d LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.type=2 and  p.patient='"+patientCode+"'";
        List<Map<String,Object>> specialistRelationList = jdbcTemplate.queryForList(specialistRelationSql);
        for(Map<String,Object> one:specialistRelationList){
            String doctor = one.get("doctor")+"";
@ -874,7 +875,7 @@ public class RehabilitationManageService {
            adminTeamCode = specialistPatientRelationDO.getTeamCode();
            doctorName = specialistPatientRelationDO.getDoctorName();
        }else if(doctorType==2){
            String signFamilySql = " select f.* from "+basedb+".wlyy_sign_family f where f.status=1 and f.expenses_status='1' and f.patient='"+patient;
            String signFamilySql = " select f.* from "+basedb+".wlyy_sign_family f where f.status=1 and f.expenses_status='1' and f.patient='"+patient+"'";
            List<Map<String,Object>> signFamily = jdbcTemplate.queryForList(signFamilySql);
            adminTeamCode = (Integer)signFamily.get(0).get("admin_team_code");
            doctorName = signFamily.get(0).get("doctor_name").toString();
@ -946,7 +947,8 @@ public class RehabilitationManageService {
            serviceDoctorList.add(healthDoctorMap);
        }
        String specialistRelationSql = "select * from wlyy_specialist.wlyy_specialist_patient_relation where patient='"+patientCode+"' and sign_status='1' and status='1'";
//        String specialistRelationSql = "select * from wlyy_specialist.wlyy_specialist_patient_relation where patient='"+patientCode+"' and sign_status='1' and status='1'";
        String specialistRelationSql = "select DISTINCT d.doctor,d.doctor_name from wlyy_specialist.wlyy_rehabilitation_plan_detail d LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.type=2 and  p.patient='"+patientCode+"'";
        List<Map<String,Object>> specialistRelationList = jdbcTemplate.queryForList(specialistRelationSql);
        for(Map<String,Object> one:specialistRelationList){
            String doctor = one.get("doctor")+"";
@ -1100,4 +1102,46 @@ public class RehabilitationManageService {
        List<PatientRehabilitationPlanDO> list = patientRehabilitationPlanDao.findByPatients(patient);
        return ObjEnvelop.getSuccess(SpecialistMapping.api_success,list);
    }
    /**
     * 医生已计划数,已完成计划数(居民数)
     * @param doctorCode
     * @return
     */
    public ObjEnvelop patientCount(String doctorCode){
        Integer count =patientRehabilitationPlanDao.patientCount(doctorCode);
        Integer unfinishCount = patientRehabilitationPlanDao.patientCountByUnfinish(doctorCode);
        Map<String,Object> map = new HashMap<>();
        map.put("planCount",count);
        map.put("finishedPlanCount",count-unfinishCount);
        return ObjEnvelop.getSuccess(SpecialistMapping.api_success,map);
    }
    public ObjEnvelop dailyJobReserve(String startTime,String endTime){
        String sql = "select DISTINCT d.doctor,p.patient,d.hospital from wlyy_rehabilitation_plan_detail d left join wlyy_patient_rehabilitation_plan p on d.plan_id=p.id " +
                " left join wlyy_hospital_service_item h on d.hospital_service_item_id=h.id " +
                " left join wlyy_service_item i on i.id =h.service_item_id "+
                " where d.status!=1 and d.execute_time>='"+startTime+"' and d.execute_time<='"+endTime+"' and i.reserve=1";
//        List<Object> list = rehabilitationDetailDao.dailyJob(startTime,endTime);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        String doctorCode = "";
        String patientCode = "";
//        List<String> listMap  = null;
        for(Map<String,Object> one:list){
            doctorCode = one.get("doctor")+"";
            patientCode = one.get("patient")+"";
            String sql2 ="select d.id from wlyy_rehabilitation_plan_detail d left join wlyy_patient_rehabilitation_plan p on d.plan_id=p.id " +
                    " left join wlyy_hospital_service_item h on d.hospital_service_item_id=h.id " +
                    " left join wlyy_service_item i on i.id =h.service_item_id "+
                    " where d.status!=1 and d.execute_time>='"+startTime+"' and d.execute_time<='"+endTime+"' and i.reserve=1 and d.doctor='"+doctorCode+"' and p.patient='"+patientCode+"'";
            List<Map<String,Object>> list2 = jdbcTemplate.queryForList(sql2);
//            listMap = rehabilitationDetailDao.findByPatientAndDoctor(startTime,endTime,doctorCode,patientCode);
            String ids = "";
            for(Map<String,Object> one2 : list2){
                ids += ","+one2.get("id");
            }
            one.put("planDetailIds",StringUtils.isNotEmpty(ids)?ids.substring(1):"");
        }
        return ObjEnvelop.getSuccess(SpecialistMapping.api_success,list);
    }
}