Sfoglia il codice sorgente

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

LAPTOP-KB9HII50\70708 1 anno fa
parent
commit
fdd8901949

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

@ -73,7 +73,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            }
            if (StringUtils.isBlank(doctorId)) {
                doctorId = getUID();
                System.out.println("获取康复下转居民列表--医生id==>getUID()==>" + getUID());
                System.out.println("医生id==>getUID()==>" + getUID());
            }
            JSONObject result = rehabilitationInfoService.getRehabilitationPatientListNew(idcard, doctorId, status, page, pagesize);
            return write(200, "请求成功", "data", result);
@ -83,6 +83,25 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
        }
    }
    @RequestMapping(value = "getRehabilitationPatientCountNew", method = RequestMethod.GET)
    @ApiOperation("康复下转状态数量")
    public String getRehabilitationPatientListNew(
            @ApiParam(name = "doctorId", value = "医生id", required = false) @RequestParam(value = "doctorId", required = false) String doctorId
    ) {
        try {
            if (StringUtils.isBlank(doctorId)) {
                doctorId = getUID();
                System.out.println("医生id==>getUID()==>" + getUID());
            }
            List<Map<String, Object>> list = rehabilitationInfoService.getRehabilitationPatientCountNew(doctorId);
            return write(200, "请求成功", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 查询科室和医生
     */
@ -112,7 +131,6 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            @ApiParam(name = "name", value = "模板名称", required = true) @RequestParam(value = "name", required = true) String name,
            @ApiParam(name = "content", value = "模板内容", required = true) @RequestParam(value = "content", required = true) String content
    ) {
        try {
            if (StringUtils.isBlank(doctorCode)) {
                doctorCode = getUID();
@ -155,35 +173,6 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    }
    @RequestMapping(value = "getRehabilitationPatientList", method = RequestMethod.GET)
    @ApiOperation("获取康复下转居民列表")
    public String getRehabilitationPatientList(
            @ApiParam(name = "doctorId", value = "医生id", required = false) @RequestParam(value = "doctorId", required = false) String doctorId,
            @ApiParam(name = "idcard", value = "身份证", required = false) @RequestParam(value = "idcard", required = false) String idcard,
            @ApiParam(name = "isTurnDown", value = "是否已下转 -2:未下转未家签,-1未下转 0未下转全部,;1已下转(未接收);2已下转(已接收);3已下转全部;03已下转全部+未下转全部", defaultValue = "0", required = false) @RequestParam(value = "isTurnDown", required = false, defaultValue = "3") String isTurnDown,
            @ApiParam(name = "page", value = "起始页", required = false) @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
            @ApiParam(name = "pagesize", value = "每页显示数据条数", required = false) @RequestParam(value = "pagesize", required = false, defaultValue = "10") Integer pagesize
    ) {
        try {
            if (page == null) {
                page = 1;
            }
            if (pagesize == null) {
                pagesize = 10;
            }
            if (StringUtils.isBlank(doctorId)) {
                doctorId = getUID();
                System.out.println("获取康复下转居民列表--医生id==>getUID()==>" + getUID());
            }
            JSONObject result = rehabilitationInfoService.getRehabilitationPatientList(idcard, doctorId, isTurnDown, page, pagesize);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "操作失败");
        }
    }
    /**
     * 康复管理
     * 获取所有居民的康复计列表
@ -200,7 +189,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
        try {
            if (StringUtils.isBlank(doctorId)) {
                doctorId = getUID();
                System.out.println("获取康复下转居民列表--医生id==>getUID()==>" + getUID());
                System.out.println("医生id==>getUID()==>" + getUID());
            }
            List<Map<String, Object>> result = rehabilitationInfoService.getRehabilitationPatientPlan(idcard, doctorId, finishStatus, page, pagesize);
            return write(200, "请求成功", "data", result);
@ -211,6 +200,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    }
    /**
     * 康复管理
     * 获取所有居民的康复计列表数量统计
@ -223,7 +213,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
        try {
            if (StringUtils.isBlank(doctorId)) {
                doctorId = getUID();
                System.out.println("获取康复下转居民列表--医生id==>getUID()==>" + getUID());
                System.out.println("医生id==>getUID()==>" + getUID());
            }
            HashMap<String, Object> result = rehabilitationInfoService.getRehabilitationPatientPlanCount(doctorId);
            return write(200, "请求成功", "data", result);
@ -251,6 +241,76 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    }
    /**
     * 查询康复计划服务项
     * 这个服务项还没有-暂时没有
     */
    @RequestMapping(value = "getPatientPlanItem", method = RequestMethod.GET)
    @ApiOperation("查询居民的康复计划")
    public String getPatientPlanItem(
            @ApiParam(name = "patientId", value = "居民", required = false) @RequestParam(value = "patientId", required = false) String patientId,
            @ApiParam(name = "planId", value = "计划id", required = false) @RequestParam(value = "planId", required = false) String planId,
            @ApiParam(name = "startTime", value = "开始时间", required = false) @RequestParam(value = "startTime", required = false) String startTime,
            @ApiParam(name = "endTime", value = "结束时间", required = false) @RequestParam(value = "endTime", required = false) String endTime,
            @ApiParam(name = "doctorId", value = "医生id", required = false) @RequestParam(value = "doctorId", required = false) String doctorId,
            @ApiParam(name = "type", value = "1全部 2奔人 3 他人", required = false) @RequestParam(value = "type", required = false) String type
    ) {
        try {
            List<Map<String, Object>> result = rehabilitationInfoService.getPatientPlanItem(patientId, planId, startTime, endTime, doctorId, type);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
//    /**
//     * 查询病例信息
//     */
//    @RequestMapping(value = "getPatientMedicalRecords", method = RequestMethod.GET)
//    @ApiOperation("查询居民的康复计划")
//    public String getPatientMedicalRecords(
//            @ApiParam(name = "patientId", value = "居民", required = false) @RequestParam(value = "patientId", required = false) String patientId
//    ) {
//        try {
//            List<Map<String, Object>> result = rehabilitationInfoService.getPatientRehabilitationByPatientId(patientId);
//            return write(200, "请求成功", "data", result);
//        } catch (Exception e) {
//            e.printStackTrace();
//            return error(-1, "操作失败");
//        }
//    }
    //=================================================没有用到的======================================================================
    @RequestMapping(value = "getRehabilitationPatientList", method = RequestMethod.GET)
    @ApiOperation("获取康复管理居民列表")
    public String getRehabilitationPatientList(
            @ApiParam(name = "doctorId", value = "医生id", required = false) @RequestParam(value = "doctorId", required = false) String doctorId,
            @ApiParam(name = "idcard", value = "身份证", required = false) @RequestParam(value = "idcard", required = false) String idcard,
            @ApiParam(name = "isTurnDown", value = "是否已下转 -2:未下转未家签,-1未下转 0未下转全部,;1已下转(未接收);2已下转(已接收);3已下转全部;03已下转全部+未下转全部", defaultValue = "0", required = false) @RequestParam(value = "isTurnDown", required = false, defaultValue = "3") String isTurnDown,
            @ApiParam(name = "page", value = "起始页", required = false) @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
            @ApiParam(name = "pagesize", value = "每页显示数据条数", required = false) @RequestParam(value = "pagesize", required = false, defaultValue = "10") Integer pagesize
    ) {
        try {
            if (page == null) {
                page = 1;
            }
            if (pagesize == null) {
                pagesize = 10;
            }
            if (StringUtils.isBlank(doctorId)) {
                doctorId = getUID();
                System.out.println("获取康复下转居民列表--医生id==>getUID()==>" + getUID());
            }
            JSONObject result = rehabilitationInfoService.getRehabilitationPatientList(idcard, doctorId, isTurnDown, page, pagesize);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "操作失败");
        }
    }
    @RequestMapping(value = "getDeorsumvergenceCount", method = RequestMethod.GET)
    @ApiOperation("康复下转已下转顶头数据")
    public String getDeorsumvergenceCount() {

+ 65 - 20
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/service/RehabilitationInfoService.java

@ -968,8 +968,16 @@ public class RehabilitationInfoService {
                " 	d.dept_name 'deptName',	d.create_user 'createUserId', \n" +
                " 	d.create_user_name 'createUserName',DATE_FORMAT(d.create_time, '%Y-%m-%d %H:%i:%s') 'createTime',\n" +
                "	q.`status` 'planStaus',q.plan_doctor 'planDoctor', q.plan_doctor_name 'planDoctorName' ,\n" +
                "	DATE_FORMAT(q.create_time, '%Y-%m-%d %H:%i:%s') 'planCreateTime',d.ijk_id , " +
                "   d.problem_code,q.disease 'diseaseId',q.disease_name 'diseaseName' \n" +
                "	DATE_FORMAT(q.create_time, '%Y-%m-%d %H:%i:%s') 'planCreateTime'," +
                "   d.from_source," +
                "       CASE  \n" +
                "        WHEN d.from_source='1' THEN '手动添加'\n" +
                "        WHEN d.from_source='2' THEN '自动下转'\n" +
                "        WHEN d.from_source='3' THEN '扫码添加'\n" +
                "      END 'fromSourceName',\n" +
                "   d.ijk_id, d.status 'patientStatus', \n" +
                "   d.problem_code," +
                "   q.disease 'diseaseId',q.disease_name 'diseaseName' \n" +
                " FROM base_patient p \n" +
                " INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient \n" +
                " LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code`=q.patient_info_code  " +
@ -981,12 +989,12 @@ public class RehabilitationInfoService {
        String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        String filterSql = "";
        if (StringUtils.isNotBlank(idcard)) {
            filterSql += " and d.idcard='" + idcard + "'";
            filterSql += " and d.idcard='" + idcard + "' ";
        }
        if (StringUtils.isBlank(status)) {
            //看全部数据
            filterSql += "	(AND d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  ) )\n" +
                    "	AND ( ISNULL( d.type ) OR d.type = 2 ) ORDER BY d.create_time DESC ";
            filterSql += "	AND (d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  ) )\n" +
                    "	    AND ( ISNULL( d.type ) OR d.type = 2 ) ORDER BY d.create_time DESC ";
            detailSql += filterSql + limitSql;
            countSql += filterSql;
            list = jdbcTemplate.queryForList(detailSql);
@ -1019,7 +1027,7 @@ public class RehabilitationInfoService {
            if ("7".equals(status)) {
                //已经分配医生
                filterSql += "	AND d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  )\n" +
                filterSql += "	AND ( d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  ) )  \n" +
                        "	AND ( ISNULL( d.type ) OR d.type = 2 ) and d.status='7' ";
                filterSql += " ORDER BY d.create_time DESC ";
                detailSql += filterSql + limitSql;
@ -1092,11 +1100,14 @@ public class RehabilitationInfoService {
        return list;
    }
    /**
     * 获取所有居民的康复计列表
     */
    public List<Map<String, Object>> getRehabilitationPatientPlan(String idcard, String doctorId, String finishStatus, Integer page, Integer pagesize) {
        String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        String sql = "SELECT * FROM ( " +
                "SELECT DISTINCT \n" +
                "	 a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,c.age,\n" +
                "	 a.idcard,a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,c.age,\n" +
                "	  (\n" +
                "		SELECT GROUP_CONCAT(q.`name`) FROM base_disease_hospital q  INNER JOIN wlyy_patient_rehabilitation_plan w ON q.id = w.disease \n" +
                "		 WHERE 1 = 1 AND w.patient=a.id  GROUP BY w.patient\n" +
@ -1201,21 +1212,25 @@ public class RehabilitationInfoService {
        return map;
    }
    /**
     * todayTaskCount 今日任务项,等后面在整
     */
    public List<Map<String, Object>> getPatientRehabilitationByPatientId(String patientId) {
        String sql = "SELECT DISTINCT \n" +
                "	 a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,c.age,\n" +
                "	 a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,c.age,a.idcard,\n" +
                "	 b.plan_doctor_name 'planDoctorName',d. `name` 'diseaseName',c.dept_name 'deptName',\n" +
                "	 b.`status` 'planStatus', \n" +
                "		(\n" +
                "			SELECT count(1) 	FROM wlyy_patient_rehabilitation_plan w \n" +
                "			INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
                "			WHERE		1 = 1 	AND w.patient = a.id \n" +
                "		)'itemAllCount',\n" +
                "		(\n" +
                "			SELECT count(1) 	FROM wlyy_patient_rehabilitation_plan w \n" +
                "			INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
                "			WHERE		1 = 1 	AND q.`status`='1'		AND w.patient = a.id \n" +
                "		)'finishCount'\n" +
                "	 b.`status` 'planStatus', c.hospital_name 'hospitalName'," +
                "    c.from_source, " +
                "       CASE  \n" +
                "        WHEN c.from_source='1' THEN '手动添加'\n" +
                "        WHEN c.from_source='2' THEN '自动下转'\n" +
                "        WHEN c.from_source='3' THEN '扫码添加'\n" +
                "      END 'fromSourceName',\n" +
                "     c.ijk_id, c.status, 'patientStatus'," +
                "     b.adviceContent,\n" +
                "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q WHERE	1 = 1 AND q.plan_id = b.id )'itemAllCount',\n" +
                "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q WHERE	1 = 1 AND q.`status`='1' AND q.plan_id = b.id )'finishCount',\n" +
                "	 0 'todayTaskCount'\n" +
                "FROM\n" +
                "	base_patient a\n" +
                "	INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient\n" +
@ -1223,11 +1238,41 @@ public class RehabilitationInfoService {
                "	INNER JOIN base_disease_hospital d ON  d.id=b.disease\n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "	AND a.del = '1'\n";
                "	AND a.del = '1' ";
        if (StringUtils.isNotBlank(patientId)) {
            sql += "	AND a.id='" + patientId + "' ";
        }
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public List<Map<String, Object>> getRehabilitationPatientCountNew(String doctorId) {
        String sql = "SELECT\n" +
                "	CASE \n" +
                "		WHEN d.`status`='0' THEN '未下转'\n" +
                "		WHEN d.`status`='1' THEN '待分配'\n" +
                "		WHEN d.`status`='2' THEN '创建计划过程失败'\n" +
                "		WHEN d.`status`='3' THEN '患者无住院病历信息'\n" +
                "		WHEN d.`status`='5' THEN '同步居民失败'\n" +
                "		WHEN d.`status`='7' THEN '已管理'\n" +
                "  END 'statusName',\n" +
                "  d.`status`,count(1) 'count' \n" +
                "FROM\n" +
                "	base_patient p\n" +
                "	INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient\n" +
                "	LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code` = q.patient_info_code \n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                " 	AND ( d.create_user = '" + doctorId + "'  OR q.plan_doctor='" + doctorId + "' OR ISNULL( d.create_user ) ) \n" +
                "	AND ( ISNULL( d.type ) OR d.type = 2 )\n" +
                "	GROUP BY d.`status`";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public List<Map<String, Object>> getPatientPlanItem(String patientId, String planId, String startTime, String endTime, String doctorId, String type) {
        String sql = " ";
        return null;
    }
}