Browse Source

代码修改

suqinyi 1 year ago
parent
commit
62dfa13316

+ 2 - 1
common/common-entity/src/db/2023.sql

@ -230,6 +230,7 @@ ADD COLUMN `patient` varchar(50) NULL COMMENT '居民code' AFTER `code`,
ADD COLUMN `create_user` varchar(100) NULL COMMENT '创建人' AFTER `sign_status`,
ADD COLUMN `create_user_name` varchar(50) NULL COMMENT '创建人姓名' AFTER `create_user`;
ALTER TABLE `base`.`wlyy_patient_rehabilitation_plan`
ADD COLUMN `patient_info_code` varchar(255) NULL AFTER `plan_doctor_name`;
=========================== 康复模块[结束]=================================

+ 7 - 7
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/controller/DiagnosisInformationController.java

@ -31,13 +31,13 @@ public class DiagnosisInformationController extends EnvelopRestEndpoint {
    @PostMapping(value = SpecialistMapping.diagnosisInformation.createDiagnosisInformation)
    @ApiOperation(value = "诊疗信息创建")
    public Envelop createDiagnosisInformation(@ApiParam(name = "diagnosisInformationJson", value = "实体JSON")
                                                       @RequestParam(value = "diagnosisInformationJson")String diagnosisInformationJson){
                                              @RequestParam(value = "diagnosisInformationJson") String diagnosisInformationJson) {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
            PatientDiagnosisInformationDO diagnosisInformationDO = objectMapper.readValue(diagnosisInformationJson, PatientDiagnosisInformationDO.class);
            return diagnosisInformationService.createDiagnosisInformation(diagnosisInformationDO);
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
            // tracer.getCurrentSpan().logEvent(e.getMessage())
            return ObjEnvelop.getError(e.getMessage());
@ -47,10 +47,10 @@ public class DiagnosisInformationController extends EnvelopRestEndpoint {
    @GetMapping(value = SpecialistMapping.diagnosisInformation.findDiagnosisInformationByPlanId)
    @ApiOperation(value = "根据康复计划id查找诊疗信息")
    public Envelop findDiagnosisInformationByPlanId(@ApiParam(name = "planId", value = "康复计划id")
                                              @RequestParam(value = "planId") String planId){
                                                    @RequestParam(value = "planId") String planId) {
        try {
            return diagnosisInformationService.findDiagnosisInformationByPlanId(planId);
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
            // tracer.getCurrentSpan().logEvent(e.getMessage())
            return ObjEnvelop.getError(e.getMessage());
@ -60,14 +60,14 @@ public class DiagnosisInformationController extends EnvelopRestEndpoint {
    @GetMapping(value = SpecialistMapping.diagnosisInformation.findDiagnosisInformationByPatient)
    @ApiOperation(value = "查找居民诊疗信息记录")
    public Envelop findDiagnosisInformationByPatient(@ApiParam(name = "patient", value = "居民code")
                                                    @RequestParam(value = "patient") String patient,
                                                     @RequestParam(value = "patient") String patient,
                                                     @ApiParam(name = "page", value = "第几页")
                                                     @RequestParam(value = "page") Integer page,
                                                     @ApiParam(name = "size", value = "行数")
                                                         @RequestParam(value = "size") Integer size){
                                                     @RequestParam(value = "size") Integer size) {
        try {
            return diagnosisInformationService.findDiagnosisInformationByPatient(patient, page, size);
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
            // tracer.getCurrentSpan().logEvent(e.getMessage())
            return ObjEnvelop.getError(e.getMessage());

+ 8 - 12
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/controller/DoctorDiagnosisInformationController.java

@ -2,9 +2,7 @@ package com.yihu.jw.hospital.module.rehabilitation.controller;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.hospital.module.rehabilitation.service.DiagnosisInformationService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -59,27 +57,25 @@ public class DoctorDiagnosisInformationController extends EnvelopRestEndpoint {
    @RequestMapping(value = "/findDiagnosisInformationByPlanId", method = RequestMethod.GET)
    @ApiOperation(value = "根据康复计划id获取诊疗信息")
    public String findDiagnosisInformationByPlanId(@ApiParam(name = "planId", value = "康复计划id")
                                                   @RequestParam String planId) {
    public String findDiagnosisInformationByPlanId(
            @ApiParam(name = "planId", value = "康复计划id") @RequestParam String planId) {
        try {
            return write(200, "获取成功", "data", diagnosisInformationService.findDiagnosisInformationByPlanId(planId));
        } catch (Exception e) {
            return error(-1,e.getMessage());
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/findDiagnosisInformationByPatient", method = RequestMethod.GET)
    @ApiOperation(value = "根据居民获取诊疗信息")
    public String findDiagnosisInformationByPatient(@ApiParam(name = "patient", value = "居民code")
                                                    @RequestParam(value = "patient") String patient,
                                                    @ApiParam(name = "page", value = "第几页,page从0开始")
                                                    @RequestParam(value = "page") Integer page,
                                                    @ApiParam(name = "size", value = "行数")
                                                    @RequestParam(value = "size") Integer size) {
    public String findDiagnosisInformationByPatient(
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient") String patient,
            @ApiParam(name = "page", value = "第几页,page从0开始") @RequestParam(value = "page") Integer page,
            @ApiParam(name = "size", value = "行数") @RequestParam(value = "size") Integer size) {
        try {
            return write(200, "获取成功", "data", diagnosisInformationService.findDiagnosisInformationByPatient(patient, page, size));
        } catch (Exception e) {
            return error(-1,e.getMessage());
            return error(-1, e.getMessage());
        }
    }
}

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

@ -35,13 +35,11 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    @RequestMapping(value = "getRehabilitationPatientList", method = RequestMethod.GET)
    @ApiOperation("获取康复下转居民列表")
    public String getRehabilitationPatientList(
            @ApiParam(name = "idcard", value = "身份证", required = false)
            @RequestParam(value = "idcard", required = false) String idcard,
            @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
            @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) {
@ -50,7 +48,11 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            if (pagesize == null) {
                pagesize = 10;
            }
            JSONObject result = rehabilitationInfoService.getRehabilitationPatientList(idcard, getUID(), isTurnDown, page, pagesize);
            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) {
            return error(-1, e.getMessage());
@ -97,15 +99,14 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            rehabilitationInfoService.deleteAdvice(id);
            return write(200, "删除成功");
        } catch (Exception e) {
            return error(-1,e.getMessage());
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "getAdviceListByDoctor", method = RequestMethod.GET)
    @ApiOperation("获取医生创建康复建议模板及系统模板")
    public String getAdviceListByDoctor(@ApiParam(name = "doctorCode", value = "医生code", required = false)
                                        @RequestParam(value = "doctorCode", required = false) String doctorCode) {
    public String getAdviceListByDoctor(
            @ApiParam(name = "doctorCode", value = "医生code", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode) {
        try {
            if (StringUtils.isBlank(doctorCode)) {
                doctorCode = getUID();
@ -113,7 +114,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            List<RehabilitationAdviceDO> list = rehabilitationInfoService.getAdviceListByDoctor(doctorCode);
            return write(200, "请求成功", "data", list);
        } catch (Exception e) {
            return error(-1,e.getMessage());
            return error(-1, e.getMessage());
        }
    }
@ -134,7 +135,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            PatientMedicalRecordsDO patientMedicalRecordsDO = objectMapper.readValue(jsonData, PatientMedicalRecordsDO.class);
            return write(200, "添加成功", "data", rehabilitationInfoService.createMedicalRecords(doctorCode, patient, patientName, patientMedicalRecordsDO, id));
        } catch (Exception e) {
            return error(-1,e.getMessage());
            return error(-1, e.getMessage());
        }
    }
@ -159,10 +160,10 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            @ApiParam(name = "page", value = "page", required = true) @RequestParam(value = "page", required = true) Integer page,
            @ApiParam(name = "size", value = "size", required = true) @RequestParam(value = "size", required = true) Integer size) {
        try {
            List<Map<String,Object>> list = rehabilitationInfoService.getMedicalHistoryList(code,page,size);
            List<Map<String, Object>> list = rehabilitationInfoService.getMedicalHistoryList(code, page, size);
            return write(200, "请求成功", "data", list);
        } catch (Exception e) {
            return error(-1,e.getMessage());
            return error(-1, e.getMessage());
        }
    }
@ -176,7 +177,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            JSONObject result = rehabilitationInfoService.getDischargePatientList(hospital, getUID());
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            return error(-1,e.getMessage());
            return error(-1, e.getMessage());
        }
    }

+ 14 - 20
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/controller/RehabilitationManageController.java

@ -60,22 +60,16 @@ public class RehabilitationManageController {
    @GetMapping(value = SpecialistMapping.rehabilitation.findRehabilitationPlanList)
    @ApiOperation(value = "康复管理-康复计划列表")
    public MixEnvelop findRehabilitationPlan(@ApiParam(name = "doctorType", value = "医生类型(1、专科医生,2、家庭医生)", required = true)
                                             @RequestParam(value = "doctorType", required = true) Integer doctorType,
                                             @ApiParam(name = "doctorCode", value = "医生code", required = true)
                                             @RequestParam(value = "doctorCode", required = true) String doctorCode,
                                             @ApiParam(name = "patientCondition", value = "居民条件,可以按身份证或者居民名称模糊匹配", required = false)
                                             @RequestParam(value = "patientCondition", required = false) String patientCondition,
                                             @ApiParam(name = "diseaseCode", value = "疾病类型code", required = false)
                                             @RequestParam(value = "diseaseCode", required = false) String diseaseCode,
                                             @ApiParam(name = "planType", value = "安排类型(1康复计划,2转社区医院,3转家庭病床)", required = false)
                                             @RequestParam(value = "planType", required = false) Integer planType,
                                             @ApiParam(name = "todaybacklog", value = "今日待办(1、今日待办,2、全部)", required = false)
                                             @RequestParam(value = "todaybacklog", required = false, defaultValue = "1") Integer todaybacklog,
                                             @ApiParam(name = "page", value = "第几页,从1开始", 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) {
    public MixEnvelop findRehabilitationPlan(
            @ApiParam(name = "doctorType", value = "医生类型(1、专科医生,2、家庭医生)", required = true) @RequestParam(value = "doctorType", required = true) Integer doctorType,
            @ApiParam(name = "doctorCode", value = "医生code", required = true) @RequestParam(value = "doctorCode", required = true) String doctorCode,
            @ApiParam(name = "patientCondition", value = "居民条件,可以按身份证或者居民名称模糊匹配", required = false) @RequestParam(value = "patientCondition", required = false) String patientCondition,
            @ApiParam(name = "diseaseCode", value = "疾病类型code", required = false) @RequestParam(value = "diseaseCode", required = false) String diseaseCode,
            @ApiParam(name = "planType", value = "安排类型(1康复计划,2转社区医院,3转家庭病床)", required = false) @RequestParam(value = "planType", required = false) Integer planType,
            @ApiParam(name = "todaybacklog", value = "今日待办(1、今日待办,2、全部)", required = false) @RequestParam(value = "todaybacklog", required = false, defaultValue = "1") Integer todaybacklog,
            @ApiParam(name = "page", value = "第几页,从1开始", 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 {
            return rehabilitationManageService.findRehabilitationPlan(doctorType, doctorCode, diseaseCode, planType, todaybacklog, patientCondition, page, pageSize);
        } catch (Exception e) {
@ -87,10 +81,10 @@ public class RehabilitationManageController {
    @GetMapping(value = SpecialistMapping.rehabilitation.findRehabilitationPlanDetailList)
    @ApiOperation(value = "康复管理-康复计划详情列表")
    public ObjEnvelop findRehabilitationPlanDetailList(@ApiParam(name = "doctorCode", value = "医生code", required = true)
                                                       @RequestParam(value = "doctorCode", required = true) String doctorCode,
                                                       @ApiParam(name = "patientCode", value = "居民code", required = true)
                                                       @RequestParam(value = "patientCode", required = true) String patientCode) {
    public ObjEnvelop findRehabilitationPlanDetailList(
            @ApiParam(name = "doctorCode", value = "医生code", required = true) @RequestParam(value = "doctorCode", required = true) String doctorCode,
            @ApiParam(name = "patientCode", value = "居民code", required = true) @RequestParam(value = "patientCode", required = true) String patientCode
    ) {
        try {
            return rehabilitationManageService.findRehabilitationPlanDetailList(doctorCode, patientCode);
        } catch (Exception e) {

+ 0 - 1
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/controller/RehabilitationPlanController.java

@ -3,7 +3,6 @@ package com.yihu.jw.hospital.module.rehabilitation.controller;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.hospital.module.rehabilitation.dao.RehabilitationOperateRecordsDao;
import com.yihu.jw.hospital.module.rehabilitation.service.RehabilitationPlanService;

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

@ -427,28 +427,41 @@ public class RehabilitationInfoService {
     */
    public JSONObject noDownCount(String doctorCode, JSONObject object) {
        //未下转所有
        String notTurnedDownCountSql = "select count(*) from wlyy_patient_discharge d,wlyy_patient p where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient AND d.patient NOT IN (   \n" +
                "SELECT i.patient FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i,wlyy_patient p WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p. CODE = i.patient GROUP BY i.patient ORDER BY i.create_time desc)\n";
        Integer allCount = jdbcTemplate.queryForObject(notTurnedDownCountSql, Integer.class);
        String notTurnedDownCountSql = "select count(*) \n" +
                "from wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON p.id = d.patient \n" +
                "  where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2)  AND d.patient NOT IN (   \n" +
                "		SELECT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p \n" +
                "		WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p.id = i.patient ) ";
        //未家签
        String notSignedAtHomeSql = "SELECT count(*) FROM (\n" +
                "select '' id, p.idcard,p.code,p.NAME patientName,p.sex,NULL age,p.address  from wlyy_patient_discharge d,wlyy_patient p\n" +
                "where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient AND d.patient NOT IN (SELECT patient FROM wlyy_sign_family WHERE sign_year='" + DateUtil.getSignYear() + "' AND `status`=1) AND d.patient NOT IN \n" +
                "(   SELECT i.patient FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i,wlyy_patient p   WHERE i.create_user = '" + doctorCode + "' \n" +
                "AND i. STATUS != 0 AND p. CODE = i.patient GROUP BY i.patient ORDER BY i.create_time desc)GROUP BY d.patient ORDER BY d.create_time DESC\n" +
                ")aa\n";
        Integer notSignedAtHome = jdbcTemplate.queryForObject(notSignedAtHomeSql, Integer.class);
                "select '' id, p.idcard,p.id 'patientId',p.`name` patientName,p.sex,NULL age,p.address  \n" +
                " from wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON  p.id = d.patient\n" +
                " where d.create_user ='" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND d.sign_status='0' \n" +
                " AND d.patient NOT IN ( \n" +
                "	SELECT i.patient FROM wlyy_patient_rehabilitation_plan i INNER JOIN base_patient p  ON p.id = i.patient \n" +
                "	WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 \n" +
                "	GROUP BY i.patient \n" +
                "  )GROUP BY d.patient \n" +
                ")aa";
        String notSignedAtHome1Sql = "SELECT count(*) FROM (\n" +
                "select '' id, p.idcard,p.code,p.NAME patientName,p.sex,NULL age,p.address,f.status signStatus,f.czrq  from wlyy_patient_discharge d,wlyy_patient p,wlyy_sign_family f\n" +
                "where d.create_user = '" + doctorCode + "' and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient AND d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "' AND d.patient NOT IN \n" +
                "(   SELECT i.patient FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i,wlyy_patient p   WHERE i.create_user = '" + doctorCode + "' \n" +
                "AND i. STATUS != 0 AND p. CODE = i.patient GROUP BY i.patient ORDER BY i.create_time desc)GROUP BY d.patient ORDER BY d.create_time DESC\n" +
                ")aa\n" +
                "WHERE aa.signStatus = 1";
                "	select '' id, p.idcard,p.id 'patientId',p.`name` patientName,p.sex,NULL age,p.address\n" +
                "	from wlyy_rehabilitation_patient_info d \n" +
                "	INNER JOIN base_patient p ON  p.id= d.patient \n" +
                "	where d.create_user = '" + doctorCode + "' and ( ISNULL(d.type) or d.type=2)  AND d.sign_status='1'\n" +
                "	AND d.patient NOT IN (  \n" +
                "  	SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p   \n" +
                "	  WHERE i.create_user = '" + doctorCode + "'  AND i. STATUS != 0 AND p.id = i.patient  \n" +
                "	)\n" +
                "	GROUP BY d.patient\n" +
                ")aa";
        Integer allCount = jdbcTemplate.queryForObject(notTurnedDownCountSql, Integer.class);
        Integer notSignedAtHome = jdbcTemplate.queryForObject(notSignedAtHomeSql, Integer.class);
        Integer notSignedAtHome1 = jdbcTemplate.queryForObject(notSignedAtHome1Sql, Integer.class);
        object.put("allCount", allCount);//全部
        object.put("notTurnedDownCount", notSignedAtHome1);//
        object.put("notTurnedDownCount", notSignedAtHome1);//签约的
        object.put("notSignedAtHome", notSignedAtHome);//未家签
        return object;
    }
@ -457,16 +470,28 @@ public class RehabilitationInfoService {
     * 未下转已家签
     */
    public JSONObject noDownAndSign(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
        String aa = " d.create_user ='" + doctorCode + "'";
        String filterSql = " and  d.create_user ='" + doctorCode + "'";
        if (StringUtils.isNotBlank(idcard)) {
            aa += " and  p.idcard like '%" + idcard + "%' ";
            filterSql += " and  p.idcard like '%" + idcard + "%' ";
        }
        String sql = "select '' id, p.idcard,p.code patient,p.NAME patientName,p.sex,NULL age,p.address,f.status signStatus," +
                "f.czrq,f.doctor_name doctorName,f.doctor_health_name doctorHealthName,f.hospital_name hospitalName,f.admin_team_code teamCode " +
                " from wlyy_patient_discharge d,wlyy_patient p,wlyy_sign_family f\n" +
                "where " + aa + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient AND d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "' AND d.patient NOT IN \n" +
                "(   SELECT i.patient FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i,wlyy_patient p   WHERE i.create_user = '" + doctorCode + "' \n" +
                "AND i. STATUS != 0 AND p. CODE = i.patient GROUP BY i.patient ORDER BY i.create_time desc)GROUP BY d.patient ORDER BY d.create_time DESC ";
//        String sql = "select '' id, p.idcard,p.code patient,p.NAME patientName,p.sex,NULL age,p.address,f.status signStatus," +
//                "f.czrq,f.doctor_name doctorName,f.doctor_health_name doctorHealthName,f.hospital_name hospitalName,f.admin_team_code teamCode " +
//                " from wlyy_patient_discharge d,wlyy_patient p,wlyy_sign_family f\n" +
//                "where 1=1 " + filterSql + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient AND d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "' AND d.patient NOT IN \n" +
//                "(   SELECT i.patient FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i,wlyy_patient p   WHERE i.create_user = '" + doctorCode + "' \n" +
//                "AND i. STATUS != 0 AND p. CODE = i.patient GROUP BY i.patient ORDER BY i.create_time desc)GROUP BY d.patient ORDER BY d.create_time DESC ";
        String sql = "SELECT  \n" +
                " p.idcard,p.id patient,p.`name` 'patientName',p.sex,NULL age,p.address,\n" +
                " d.`dept`,d.`dept_name`\n" +
                " FROM wlyy_rehabilitation_patient_info d INNER JOIN base_patient p ON  p.id = d.patient \n" +
                " WHERE  1=1 \n" + filterSql +
                " AND ( ISNULL(d.type) or d.type=2)  AND d.sign_status='1' \n" +
                " AND d.patient NOT IN (\n" +
                "		SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p  \n" +
                "		WHERE i.create_user = '" + doctorCode + "' AND i. STATUS != 0 AND p.id = i.patient\n" +
                ")\n" +
                "GROUP BY d.patient ORDER BY d.create_time DESC ";
        sql += " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
@ -488,18 +513,29 @@ public class RehabilitationInfoService {
     */
    public JSONObject noDown(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
        String aa = " d.create_user ='" + doctorCode + "'";
        String filterSql = " and  d.create_user ='" + doctorCode + "'";
        if (StringUtils.isNotBlank(idcard)) {
            aa += " and  p.idcard like '%" + idcard + "%' ";
        }
        String sql = "select '' id, p.idcard,p.code patient,p.NAME patientName,p.sex,NULL age,p.address,f.status signStatus," +
                "f.czrq,f.doctor_name doctorName,f.doctor_health_name doctorHealthName,f.hospital_name hospitalName,f.admin_team_code teamCode," +
                " if(f.id is null,-2,-1) as isTurnDown " +
                " from wlyy_patient p,wlyy_patient_discharge d " +
                " left JOIN wlyy_sign_family f on d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "'" +
                "where " + aa + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient  AND d.patient NOT IN \n" +
                "(   SELECT DISTINCT i.patient FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i,wlyy_patient p   WHERE i.create_user = '" + doctorCode + "' \n" +
                "AND i. STATUS != 0 AND p. CODE = i.patient )GROUP BY d.patient ORDER BY d.create_time DESC ";
            filterSql += " and  p.idcard like '%" + idcard + "%' ";
        }
//        String sql = "select '' id, p.idcard,p.code patient,p.NAME patientName,p.sex,NULL age,p.address," +
//                "f.status signStatus,f.czrq,f.doctor_name doctorName,f.doctor_health_name doctorHealthName,f.hospital_name hospitalName,f.admin_team_code teamCode," +
//                " if(f.id is null,-2,-1) as isTurnDown " +
//                " from wlyy_patient p,wlyy_patient_discharge d " +
//                " left JOIN wlyy_sign_family f on d.patient=f.patient AND f.`status`=1 AND f.sign_year='" + DateUtil.getSignYear() + "'" +
//                "where 1=1 " + filterSql + " and ( ISNULL(d.type) or d.type=2) AND p. CODE = d.patient  AND d.patient NOT IN \n" +
//                "(   SELECT DISTINCT i.patient FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i,wlyy_patient p   WHERE i.create_user = '" + doctorCode + "' \n" +
//                "AND i. STATUS != 0 AND p. CODE = i.patient )GROUP BY d.patient ORDER BY d.create_time DESC ";
        String sql = "SELECT '' id, p.idcard,p.id 'patient',p.`name` patientName,p.sex,NULL age,p.address,\n" +
                " if(p.sign_status=0,-2,-1) as isTurnDown  \n" +
                " FROM base_patient p \n" +
                " INNER JOIN wlyy_rehabilitation_patient_info d  ON p.id = d.patient and d.sign_status='1'  \n" +
                " WHERE 1=1  " + filterSql +
                "	 and d.create_user ='" + doctorCode + "'  AND ( ISNULL(d.type) or d.type=2) AND  d.patient NOT IN( \n" +
                "	 SELECT DISTINCT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p   \n" +
                "	 WHERE i.create_user = '" + doctorCode + "' AND i.`status` != 0 AND p.id = i.patient \n" +
                "	)\n" +
                "GROUP BY d.patient ORDER BY d.create_time DESC ";
        sql += " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        list.stream().forEach(one -> {
@ -515,15 +551,31 @@ public class RehabilitationInfoService {
     * 已下转未接收
     */
    public JSONObject downAndNoSign(String idcard, String doctorCode, Integer page, Integer pagesize, JSONObject object) {
        String sql2 = "SELECT i.disease_name diseaseName,s.doctor,s.idcard,p.sex, s.patient,CAST(IFNULL(p.birthday,'') AS char ) birthday," +
                " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
                "s.admin_team_code teamCode ,pr.is_manage isManage \n" +
                "FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
                "wlyy_specialist.wlyy_specialist_patient_relation pr \n" +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 " +
                " and  (pr.is_manage != 1 OR isnull(pr.is_manage)) ";
//        String sql2 = "SELECT i.disease_name diseaseName,s.doctor,s.idcard,p.sex, s.patient,CAST(IFNULL(p.birthday,'') AS char ) birthday," +
//                " i. STATUS, p. NAME patientName, p.address, CONCAT(s.doctor_name,'(全科医生)' ) AS doctorName, \n" +
//                "IFNULL(CONCAT(s.doctor_health_name,'(健管师)'), s.doctor_health_name ) doctorHealthName, s.hospital_name hospitalName, \n" +
//                "s.admin_team_code teamCode ,pr.is_manage isManage \n" +
//                "FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
//                "wlyy_specialist.wlyy_specialist_patient_relation pr \n" +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
//                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 " +
//                " and  (pr.is_manage != 1 OR isnull(pr.is_manage)) ";
        String sql2 = "SELECT \n" +
                " i.disease_name diseaseName,i.create_user,p.idcard,p.sex,p.id 'patient',\n" +
                " i.`status`, p.`name` 'patientName', p.address, \n" +
                " CAST(IFNULL(p.birthday,'') AS char ) birthday,\n" +
                " pr.is_manage isManage \n" +
                "FROM wlyy_patient_rehabilitation_plan i \n" +
                "INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id AND q.sign_status='1' AND i.patient_info_code=q.`code` \n" +
                "INNER JOIN base_patient p ON  p.id = i.patient\n" +
                "INNER JOIN  wlyy_specialist_patient_relation pr ON  pr.patient=p.id\n" +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 \n" +
                "	 and pr.`status`>=0 and pr.sign_status=1  \n" +
                "	AND  (pr.is_manage != 1 OR isnull(pr.is_manage))  \n";
        if (StringUtils.isNotBlank(idcard)) {
            sql2 += " and  p.idcard like '%" + idcard + "%' ";
        }
@ -555,32 +607,45 @@ public class RehabilitationInfoService {
     * 已经下转统计
     */
    public JSONObject downCount(String doctorCode, JSONObject object) {
        String sql1 = "SELECT COUNT(distinct i.patient) \n" +
                "FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
                "wlyy_specialist.wlyy_specialist_patient_relation pr \n" +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 ";
//        String sql1 = "SELECT COUNT(distinct i.patient) \n" +
//                "FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
//                "wlyy_specialist.wlyy_specialist_patient_relation pr \n" +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
//                "AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 ";
        String sql1 = "SELECT \n" +
                " COUNT(distinct i.patient) \n" +
                "FROM wlyy_patient_rehabilitation_plan i \n" +
                "INNER JOIN  base_patient p ON  p.id = i.patient  \n" +
                "INNER JOIN wlyy_rehabilitation_patient_info q ON q.patient=i.id  AND i.patient_info_code=q.`code`  AND q.sign_status='1'\n" +
                "INNER JOIN wlyy_specialist_patient_relation pr ON  pr.patient=p.id\n" +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0   and pr.`status`>=0 and pr.sign_status=1 ";
        Integer list1 = jdbcTemplate.queryForObject(sql1, Integer.class);
        //康复计划数量
//        String sql2 = "SELECT COUNT(distinct i.id) \n" +
//                "FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p\n" +
//                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient \n" +
//                "AND s.status = 1 AND s.expenses_status = 1 ";
        String sql2 = "SELECT COUNT(distinct i.id) \n" +
                "FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p\n" +
                "WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient \n" +
                "AND s.status = 1 AND s.expenses_status = 1 ";
                " FROM wlyy_patient_rehabilitation_plan i " +
                " inner join  base_patient p on  p.id = i.patient \n" +
                " inner join  wlyy_rehabilitation_patient_info q on  q.patient = i.patient AND i.patient_info_code=q.`code` AND q.sign_status='1' \n" +
                " WHERE i.create_user = '" + doctorCode + "' AND i.status != 0    \n";
        Integer list2 = jdbcTemplate.queryForObject(sql2, Integer.class);
        //家医接收
        String sql3 = "SELECT COUNT(distinct i.patient) " +
                " FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
                " wlyy_specialist.wlyy_specialist_patient_relation pr \n" +
                " WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
                " AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1";
        Integer list3 = jdbcTemplate.queryForObject(sql3, Integer.class);
//        String sql3 = "SELECT COUNT(distinct i.patient) " +
//                " FROM wlyy_specialist.wlyy_patient_rehabilitation_plan i, wlyy_sign_family s, wlyy_patient p ,\n" +
//                " wlyy_specialist.wlyy_specialist_patient_relation pr \n" +
//                " WHERE i.create_user = '" + doctorCode + "' AND i.status != 0 AND i.patient = s.patient AND p.code = i.patient AND s.status = 1 \n" +
//                " AND s.expenses_status = 1 AND pr.patient=p.code and pr.team_code = i.team_code and pr.`status`>=0 and pr.sign_status=1 and pr.is_manage=1";
//        Integer list3 = jdbcTemplate.queryForObject(sql3, Integer.class);
        object.put("deorsumvergenceCount", list1);//下转人数
        object.put("rehabilitationPlan", list2);//康复计划
        object.put("patientReceiveCount", list3);//家医接收人数
        object.put("unPatientReceiveCount", list1 - list3);//家医未接收人数
//        object.put("patientReceiveCount", list3);//家医接收人数
//        object.put("unPatientReceiveCount", list1 - list3);//家医未接收人数
        return object;
    }

+ 1 - 1
svr/svr-visit-behind/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name:  svr-visit-behind
    name:  svr-visit-behind --
  cloud:
    config:
      failFast: true