Kaynağa Gözat

康复计划

suqinyi 1 yıl önce
ebeveyn
işleme
351c4bb5a9

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

@ -17,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -40,7 +41,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            @ApiParam(name = "idcard", value = "身份证") @RequestParam(value = "idcard", required = false) String idcard
    ) {
        try {
            List<Map<String, Object>> list = rehabilitationInfoService.getPatientInfo(patientId,idcard);
            List<Map<String, Object>> list = rehabilitationInfoService.getPatientInfo(patientId, idcard);
            return MixEnvelop.getSuccess(SpecialistMapping.api_success, list);
        } catch (Exception e) {
            e.printStackTrace();
@ -92,7 +93,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            @ApiParam(name = "deptCode", value = "科室code", required = false) @RequestParam(value = "deptCode", required = false) String deptCode,
            @ApiParam(name = "deptName", value = "科室", required = false) @RequestParam(value = "deptName", required = false) String deptName) {
        try {
            List<Map<String, Object>> list = rehabilitationInfoService.getDetpAndDoctor(doctorName, deptCode, deptName, type,disease);
            List<Map<String, Object>> list = rehabilitationInfoService.getDetpAndDoctor(doctorName, deptCode, deptName, type, disease);
            return write(200, "请求成功", "data", list);
        } catch (Exception e) {
            return error(-1, e.getMessage());
@ -148,7 +149,6 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    }
    @RequestMapping(value = "getRehabilitationPatientList", method = RequestMethod.GET)
    @ApiOperation("获取康复下转居民列表")
    public String getRehabilitationPatientList(
@ -177,6 +177,54 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    }
    /**
     * 康复管理
     * 获取所有居民的康复计列表
     */
    @RequestMapping(value = "getRehabilitationPatientPlan", method = RequestMethod.GET)
    @ApiOperation("获取所有居民的康复计列表")
    public String getRehabilitationPatientPlan(
            @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 = "finishStatus", value = "完成状态", required = false) @RequestParam(value = "finishStatus", required = false) String finishStatus,
            @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 (StringUtils.isBlank(doctorId)) {
                doctorId = getUID();
                System.out.println("获取康复下转居民列表--医生id==>getUID()==>" + getUID());
            }
            List<Map<String, Object>> result = rehabilitationInfoService.getRehabilitationPatientPlan(idcard, doctorId, finishStatus, page, pagesize);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 康复管理
     * 获取所有居民的康复计列表数量统计
     */
    @RequestMapping(value = "getRehabilitationPatientPlanCount", method = RequestMethod.GET)
    @ApiOperation("获取所有居民的康复计列表")
    public String getRehabilitationPatientPlanCount(
            @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());
            }
            HashMap<String, Object> result = rehabilitationInfoService.getRehabilitationPatientPlanCount(doctorId);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "getDeorsumvergenceCount", method = RequestMethod.GET)
    @ApiOperation("康复下转已下转顶头数据")
    public String getDeorsumvergenceCount() {
@ -189,8 +237,6 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    }
    @RequestMapping(value = "createMedicalRecords", method = RequestMethod.POST)
    @ApiOperation("添加编辑住院病历")
    public String createMedicalRecords(

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

@ -1184,4 +1184,110 @@ public class RehabilitationInfoService {
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        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" +
                "	  (\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" +
                "	  ) 'diseaseListName',\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`='0'		AND w.patient = a.id \n" +
                "		)'unFinishCount',\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" +
                "		0 'totayTask'\n" +
                "FROM\n" +
                "	base_patient a\n" +
                "	INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient\n" +
                "	INNER JOIN wlyy_rehabilitation_patient_info c ON c.patient = b.patient \n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "	AND a.del = '1'\n";
        if (StringUtils.isNotBlank(doctorId)) {
            //计划负责人或者任务执行人-执行人不为空
            sql += "	AND (b.plan_doctor='" + doctorId + "' OR c.doctor='" + doctorId + "' )";
            sql += " and  c.doctor is not null  ";
        }
        if (StringUtils.isNotBlank(idcard)) {
            //康复计划状态 [0已中止,1进行中,2已完成]
            sql += "	AND a.idcard like'%" + idcard + "%'";
        }
        sql += " )q WHERE 1=1  ";
        if (StringUtils.isNotBlank(finishStatus)) {
            //康复计划状态 [0已中止,1进行中,2已完成]
            if ("1".equals(finishStatus)) {
                //未完成
                sql += "	AND q.unFinishCount<>0 ";
            }
            if ("2".equals(finishStatus)) {
                //已完成
                sql += "	AND q.unFinishCount=0 ";
            }
        }
        sql += limitSql;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public HashMap<String, Object> getRehabilitationPatientPlanCount(String doctorId) {
        String sql =
                "SELECT DISTINCT \n" +
                        "	 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" +
                        "	  ) 'diseaseListName',\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`='0'		AND w.patient = a.id \n" +
                        "		)'unFinishCount'\n" +
                        "FROM\n" +
                        "	base_patient a\n" +
                        "	INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient\n" +
                        "	INNER JOIN wlyy_rehabilitation_patient_info c ON c.patient = b.patient \n" +
                        "WHERE\n" +
                        "	1 = 1 \n" +
                        "	AND a.del = '1'\n";
        if (StringUtils.isNotBlank(doctorId)) {
            //计划负责人或者任务执行人-执行人不为空
            sql += "	AND (b.plan_doctor='" + doctorId + "' OR c.doctor='" + doctorId + "' )";
            sql += " and  c.doctor is not null  ";
        }
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        int allCount = 0;
        int unFinishCount = 0;
        int finishCount = 0;
        for (Map<String, Object> map : list) {
            if (0 == Integer.parseInt(map.get("unFinishCount").toString())) {
                finishCount += 1;
            } else {
                unFinishCount += 1;
            }
            allCount += 1;
        }
        HashMap<String, Object> map = new HashMap<>();
        map.put("allCount", allCount);
        map.put("unFinishCount", unFinishCount);
        map.put("finishCount", finishCount);
        return map;
    }
}