Browse Source

签约医生查询修改

liubing 3 years ago
parent
commit
f6186021b5

+ 3 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -554,7 +554,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            sql.append(" AND EXISTS (" +
                    "SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = i.team_code " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = r.team_code " +
                    " and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') group by ord.status");
        }
        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql.toString());
@ -604,7 +604,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            sql.append(" AND EXISTS (" +
                    "SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = i.team_code " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = r.team_code " +
                    " and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') ");
        }
        if (StringUtils.isNotBlank(patient)){
@ -632,7 +632,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            sql.append(" AND EXISTS (" +
                    "SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = i.team_code " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = r.team_code " +
                    " and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') ");
        }
        if (StringUtils.isNotBlank(patient)){

+ 3 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/birthday/BirthdayWishesService.java

@ -180,7 +180,7 @@ public class BirthdayWishesService {
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient  and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code and m.doctor_code = '"+doctor+"' ) "+
                "and i.del = 1 and m.team_code = r.team_code and m.doctor_code = '"+doctor+"' ) "+
                " and (p.archive_status<>2 or p.archive_status is null) " +
                "AND CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END =  '" + dateString + "' " ;
        List<Map<String, Object>> patientInfos =  jdbcTemplate.queryForList(sql);
@ -226,7 +226,7 @@ public class BirthdayWishesService {
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient  and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code and m.doctor_code = '"+doctor+"' ) "+
                "and i.del = 1 and m.team_code = r.team_code and m.doctor_code = '"+doctor+"' ) "+
                " and (p.archive_status<>2 or p.archive_status is null) " +
                "AND CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END =  '" + dateString + "'  " ;
        List<String> patientInfos =  jdbcTemplate.queryForList(sql,String.class);
@ -261,7 +261,7 @@ public class BirthdayWishesService {
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient  and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code ";
                "and i.del = 1 and m.team_code = r.team_code ";
        //根据权限获取生日居民列表
        if (roleType == 1) {

+ 31 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.service.doctor;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.doorCoach.BaseDoorCoachOrderDao;
import com.yihu.jw.care.service.birthday.BirthdayWishesService;
import com.yihu.jw.care.service.device.DeviceService;
import com.yihu.jw.care.service.role.RoleService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -59,6 +60,8 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    private ImService imService;
    @Autowired
    private DeviceService deviceService;
    @Autowired
    private BirthdayWishesService birthdayWishesService;
    /**
     * 获取医生简单详情
@ -75,7 +78,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        String sql1 = "SELECT COUNT(DISTINCT sr.patient) FROM " +
                " base_service_package_sign_record sr, base_service_package_record r, base_service_package_item i, base_team_member m " +
                " WHERE  sr.id = r.sign_id and sr.status=1  AND r.service_package_id = i.service_package_id " +
                " AND i.del = 1 and m.team_code = i.team_code " +
                " AND i.del = 1 and m.team_code = r.team_code " +
                "  and m.del = '1' and m.doctor_code = '"+doctorId+"'";
        Integer signNum = jdbcTemplate.queryForObject(sql1,Integer.class);
        String sqlLife= "SELECT COUNT(*) from base_life_care_order where `status` = 2";
@ -550,7 +553,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject result = new JSONObject();
        result.put("lifeCare",0);
        result.put("emergencyAssistance",0);
        result.put("patientCare",0);
        result.put("patientCare",0);//人文关怀
        result.put("security",0);
        List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(doctor);
        String hospital = doctorHospitalDOs.get(0).getOrgCode();
@ -568,11 +571,34 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            result.put("lifeCare",count);
        }
        //紧急救助
//        countSql = " select ord.status,count(ord.id) count from base_emergency_assistance_order ord where 1=1  "
        countSql = " select count(ord.id) count from base_emergency_assistance_order ord where ord.status=1 " +
                "AND EXISTS (SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                " base_service_package_item i ,base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and " +
                " sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = r.team_code " +
                "  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
        count = jdbcTemplate.queryForObject(countSql,Long.class);
        if (count>0){
            result.put("emergencyAssistance",count);
        }
        //安防工单
        countSql = " select count(ord.id) count from base_security_monitoring_order ord where ord.status=1 " +
                "AND EXISTS (SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                " base_service_package_item i ,base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and " +
                " sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = r.team_code " +
                "  and i.del = 1 and sr.`status`=1  and i.topic_item='security' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
        count = jdbcTemplate.queryForObject(countSql,Long.class);
        if (count>0){
            result.put("security",count);
        }
        //人文关怀
        try {
            Integer counts = birthdayWishesService.getPatientByDoctorCount(doctor);
            if (count>0){
                result.put("patientCare",count);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return result;
    }

+ 6 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java

@ -95,7 +95,7 @@ public class DoctorMessageService {
            sql+= "and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                    " r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
                    " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
            sql+=" order by create_time asc ";
            Map<String,Object> sqlResult  = jdbcTemplate.queryForMap(sql);
            if (sqlResult.containsKey("count")){
@ -119,7 +119,7 @@ public class DoctorMessageService {
            sql+= "and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                    " r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
                    " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
            sql+=" order by create_time asc ";
            Map<String,Object> sqlResult  = jdbcTemplate.queryForMap(sql);
            if (sqlResult.containsKey("count")){
@ -148,7 +148,7 @@ public class DoctorMessageService {
                    "and  EXISTS ( \n" +
                    "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                    "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                    "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' \n" +
                    "r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' \n" +
                    "and m.doctor_code = '"+doctor+"' and m.del = '1') \n" +
                    "order by create_time DESC ";
@ -159,7 +159,7 @@ public class DoctorMessageService {
                        "and  EXISTS ( \n" +
                        "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                        "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                        "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' \n" +
                        "r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' \n" +
                        "and m.doctor_code = '"+doctor+"' and m.del = '1') ";
            }
@ -173,7 +173,7 @@ public class DoctorMessageService {
                    "and EXISTS ( \n" +
                    "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                    "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                    "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' \n" +
                    "r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' \n" +
                    "and m.doctor_code = '"+doctor+"' and m.del = '1')\n" +
                    "order by create_time DESC ";
@ -186,7 +186,7 @@ public class DoctorMessageService {
                        "and EXISTS ( \n" +
                        "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                        "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                        "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' \n" +
                        "r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' \n" +
                        "and m.doctor_code = '"+doctor+"' and m.del = '1')";
            }

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -79,7 +79,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        String filters = " from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m,base_patient p " +
                "WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code and p.id = sr.patient " +
                "and i.del = 1 and m.team_code = r.team_code and p.id = sr.patient " +
                "and m.doctor_code = '"+doctorId+"' and m.del = '1' ";
        if(!StringUtil.isEmpty(name)){

+ 3 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -505,7 +505,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            fliter+=" and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                    " r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
                    " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
        }
        if (StringUtils.isNotBlank(serverDoctor)){
            fliter +=" and ord.doctor = '"+serverDoctor+"' ";
@ -607,7 +607,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            fliter+=" and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                    " r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
                    " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
        }
        if (StringUtils.isNotBlank(patient)){
            fliter+=" and ord.patient='"+patient+"' ";
@ -644,7 +644,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        sql+= "and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                "base_team_member m " +
                "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                " r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
                " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
        sql +=" order by ord.create_time asc ";
        result= jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map:result){

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ArchiveService.java

@ -102,7 +102,7 @@ public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
                    "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                    "base_service_package_item i,base_team_member m " +
                    "WHERE  sr.id = r.sign_id and sr.patient = a.patient and sr.status=1 and r.service_package_id = i.service_package_id " +
                    "and i.del = 1 and m.team_code = i.team_code " ;
                    "and i.del = 1 and m.team_code = r.team_code " ;
            if(StringUtils.isNotBlank(doctorId)){
                filters += " and m.doctor_code = '"+doctorId+"' ";
            }

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java

@ -131,7 +131,7 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
                "base_service_package_sign_record sr,base_service_package_record r,  " +
                "                base_service_package_item i,base_team_member m  " +
                "                WHERE sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id  " +
                "                and i.del = 1 and m.team_code = i.team_code and ar.patient = sr.patient " +
                "                and i.del = 1 and m.team_code = r.team_code and ar.patient = sr.patient " +
                "                and m.doctor_code = '"+doctorId+"' and m.del = '1' and sr.`status`=1 " +
                "GROUP BY ar.level_conclusion" ;
        List<Map<String,Object>> countMapList = jdbcTemplate.queryForList(sql);