Pārlūkot izejas kodu

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

LAPTOP-KB9HII50\70708 1 gadu atpakaļ
vecāks
revīzija
84f51ca26f

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

@ -176,12 +176,14 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    /**
     * 康复管理
     * 获取所有居民的康复计列表
     * todo 还需要代办项目还需要重新join一张新表
     */
    @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 = "doctorId", value = "医生id", required = false) @RequestParam(value = "doctorId", required = false) String doctorId,
            @ApiParam(name = "patientId", value = "居民id", required = false) @RequestParam(value = "patientId", required = false) String patientId,
            @ApiParam(name = "finishStatus", value = "空全部 1未完成 2已完成", 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
@ -191,7 +193,12 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
                doctorId = getUID();
                System.out.println("医生id==>getUID()==>" + getUID());
            }
            List<Map<String, Object>> result = rehabilitationInfoService.getRehabilitationPatientPlan(idcard, doctorId, finishStatus, page, pagesize);
            System.out.println("参数idcard:" + idcard);
            System.out.println("参数patientId:" + patientId);
            System.out.println("参数finishStatus:" + finishStatus);
            System.out.println("参数page:" + page);
            System.out.println("参数pagesize:" + pagesize);
            List<Map<String, Object>> result = rehabilitationInfoService.getRehabilitationPatientPlan(idcard, doctorId, patientId, finishStatus, page, pagesize);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
@ -200,10 +207,10 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    }
    /**
     * 康复管理
     * 获取所有居民的康复计列表数量统计
     * todo 还需要代办项目还需要重新join一张新表
     */
    @RequestMapping(value = "getRehabilitationPatientPlanCount", method = RequestMethod.GET)
    @ApiOperation("获取所有居民的康复计列表")
@ -225,6 +232,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    /**
     * 查询居民的康复计划
     * todo 还需要代办项目还需要重新join一张新表 todayTaskCount 今日任务项,等后面在整
     */
    @RequestMapping(value = "getPatientRehabilitationByPatientId", method = RequestMethod.GET)
    @ApiOperation("查询居民的康复计划")
@ -240,14 +248,51 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 查询病例信息
     */
    @RequestMapping(value = "getPatientMedicalRecordsByPatientId", method = RequestMethod.GET)
    @ApiOperation("查询居民的康复计划")
    public String getPatientMedicalRecordsByPatientId(
            @ApiParam(name = "patientId", value = "居民", required = false) @RequestParam(value = "patientId", required = false) String patientId
    ) {
        try {
            List<PatientMedicalRecordsDO> result = rehabilitationInfoService.getPatientMedicalRecordsByPatientId(patientId);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "操作失败");
        }
    }
    /**
     * 查询康复计划服务项
     * 这个服务项还没有-暂时没有
     */
    @RequestMapping(value = "getPatientPlanItem", method = RequestMethod.GET)
    @RequestMapping(value = "getPatientPlanItemList", method = RequestMethod.GET)
    @ApiOperation("查询居民的康复计划")
    public String getPatientPlanItem(
    public String getPatientPlanItemList(
            @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 = "itemId", value = "服务项id", required = false) @RequestParam(value = "itemId", required = false) String itemId,
            @ApiParam(name = "status", value = "状态  0未完成,1已完成,2已预约,3待补录", required = false) @RequestParam(value = "status", required = false) String status
    ) {
        try {
            List<Map<String, Object>> result = rehabilitationInfoService.getPatientPlanItemList(patientId, planId, itemId, status);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取频次服务的信息
     * 这个服务项次数还没有-暂时没有
     */
    @RequestMapping(value = "getPatientPlanFrequencyItemList", method = RequestMethod.GET)
    @ApiOperation("获取频次服务的信息")
    public String getPatientPlanFrequencyItemList(
            @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,
@ -256,29 +301,30 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            @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);
            List<Map<String, Object>> result = rehabilitationInfoService.getPatientPlanFrequencyItemList(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 = "getPlanDoctorList", method = RequestMethod.GET)
    @ApiOperation("获取频次服务的信息")
    public String getPlanDoctorList(
            @ApiParam(name = "planId", value = "计划id", required = false) @RequestParam(value = "planId", required = false) String planId
    ) {
        try {
            List<Map<String, Object>> result = rehabilitationInfoService.getPlanDoctorList(planId);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    //=================================================没有用到的======================================================================
@ -391,17 +437,17 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    @RequestMapping(value = "getPatientByIdcardOrSsc", method = RequestMethod.POST)
    @ApiOperation("根据患者身份证或社保卡号进行搜索添加出院记录")
    public String getPatientByIdcardOrSsc(@ApiParam(name = "patientInfo", value = "居民身份证或者社保卡", required = true)
                                          @RequestParam(value = "patientInfo")String patientInfo) {
                                          @RequestParam(value = "patientInfo") String patientInfo) {
        try {
            JSONObject object = rehabilitationInfoService.getPatientByIdcardOrSsc(patientInfo, getUID(),1);
            if(object.getInteger("status") == 200) {
            JSONObject object = rehabilitationInfoService.getPatientByIdcardOrSsc(patientInfo, getUID(), 1);
            if (object.getInteger("status") == 200) {
                return write(200, "添加成功!", "data", object.get("data"));
            }else {
            } else {
                return write(-1, "添加失败!", "data", object.getString("msg"));
            }
        } catch (ServiceException se){
            return error(-1,se.getMessage());
        } catch (ServiceException se) {
            return error(-1, se.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "操作失败");

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

@ -1,5 +1,6 @@
package com.yihu.jw.hospital.module.rehabilitation.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -29,6 +30,7 @@ import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -842,15 +844,15 @@ public class RehabilitationInfoService {
     * type 1患者家签列表 2康复下转列表
     * doctorCode
     */
    public JSONObject getPatientByIdcardOrSsc(String patientInfo, String doctorCode,Integer fromSource) {
    public JSONObject getPatientByIdcardOrSsc(String patientInfo, String doctorCode, Integer fromSource) {
        //加签列表查询wlyy_patient_discharge表,与type无关。当家签处添加时(即type=1),统一保存type=2的记录
        JSONObject data = new JSONObject();
        List<BasePatientDO> patientList = patientDao.getPatientByIdcardOrSsc(patientInfo);
        BasePatientDO patient = null;
        if(patientList.size() > 0){
        if (patientList.size() > 0) {
            patient = patientList.get(0);
        }
        if(patient==null){
        if (patient == null) {
            data.put("status", -1);
            data.put("msg", "未查询到患者");
            return data;
@ -858,12 +860,12 @@ public class RehabilitationInfoService {
        RehabilitationPatientInfoDO infoDO = new RehabilitationPatientInfoDO();
        infoDO.setPatient(patient.getId());
        infoDO.setStatus(0);
        infoDO.setAge(IdCardUtil.getAgeByBirthdayOrIdcard(patient.getIdcard(),patient.getBirthday()));
        infoDO.setAge(IdCardUtil.getAgeByBirthdayOrIdcard(patient.getIdcard(), patient.getBirthday()));
        infoDO.setSsc(patient.getSsc());
        infoDO.setAddress(patient.getAddress());
        infoDO.setCode(UUID.randomUUID().toString().replaceAll("-", ""));
        infoDO.setCreateTime(new Date());
        if(StringUtils.isNotBlank(doctorCode)){
        if (StringUtils.isNotBlank(doctorCode)) {
            BaseDoctorDO doctor = doctorDao.findById(doctorCode).orElse(null);
            infoDO.setCreateUser(doctor.getId());
            infoDO.setCreateUserName(doctor.getName());
@ -876,7 +878,7 @@ public class RehabilitationInfoService {
        rehabilitationPatientInfoDao.save(infoDO);
        //判断是否家签  修改
        JSONObject isSign = businessService.isSign(patient.getIdcard());
        if(isSign!=null&&isSign.getJSONObject("obj")!=null){
        if (isSign != null && isSign.getJSONObject("obj") != null) {
            infoDO.setSignStatus(1);
            rehabilitationPatientInfoDao.save(infoDO);
        }
@ -884,6 +886,7 @@ public class RehabilitationInfoService {
        data.put("data", infoDO);
        return data;
    }
    public JSONObject getUnm(String doctor, String patient) {
        String sqlMe = "select d.id,d.plan_id as planId,i.code,i.name,p.patient,d.frequency_code from wlyy_rehabilitation_plan_detail d \n" +
                "LEFT JOIN wlyy_patient_rehabilitation_plan p ON p.id=d.plan_id\n" +
@ -1103,7 +1106,7 @@ public class RehabilitationInfoService {
    /**
     * 获取所有居民的康复计列表
     */
    public List<Map<String, Object>> getRehabilitationPatientPlan(String idcard, String doctorId, String finishStatus, Integer page, Integer pagesize) {
    public List<Map<String, Object>> getRehabilitationPatientPlan(String idcard, String doctorId, String patientId, String finishStatus, Integer page, Integer pagesize) {
        String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
        String sql = "SELECT * FROM ( " +
                "SELECT DISTINCT \n" +
@ -1116,19 +1119,19 @@ public class RehabilitationInfoService {
                "        SELECT GROUP_CONCAT(DISTINCT w.plan_doctor_name) FROM wlyy_patient_rehabilitation_plan w WHERE a.id = w.patient \n" +
                "      ) 'planDoctorListName',\n" +
                "	   (\n" +
                "			SELECT count(1) 	FROM wlyy_patient_rehabilitation_plan w \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" +
                "			WHERE 1 = 1 AND w.patient = a.id \n" +
                "		)'itemAllCount',\n" +
                "		(\n" +
                "			SELECT count(1) 	FROM wlyy_patient_rehabilitation_plan w \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" +
                "			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" +
                "			WHERE	1 = 1 	AND q.`status`='1'	AND w.patient = a.id \n" +
                "		)'finishCount',\n" +
                "		0 'totayTask'\n" +
                "FROM\n" +
@ -1139,14 +1142,20 @@ public class RehabilitationInfoService {
                "	1 = 1 \n" +
                "	AND a.del = '1'\n";
        if (StringUtils.isNotBlank(doctorId)) {
        if (StringUtils.isNotBlank(doctorId) && StringUtils.isBlank(patientId)) {
            //计划负责人或者任务执行人-执行人不为空
            sql += "	AND (b.plan_doctor='" + doctorId + "' OR c.doctor='" + doctorId + "' )";
            sql += " and  c.doctor is not null  ";
        }
        if (StringUtils.isNotBlank(idcard)) {
        if (StringUtils.isNotBlank(patientId)) {
            //康复计划状态 [0已中止,1进行中,2已完成]
            sql += "	AND a.id ='" + patientId + "' ";
        }
        if (StringUtils.isNotBlank(idcard) && !"null".equals(idcard)) {
            //康复计划状态 [0已中止,1进行中,2已完成]
            sql += "	AND a.idcard like'%" + idcard + "%'";
            sql += " AND a.idcard like'%" + idcard + "%'";
        }
        sql += " )q WHERE 1=1  ";
@ -1162,10 +1171,14 @@ public class RehabilitationInfoService {
            }
        }
        sql += limitSql;
        System.out.println("查询sql==>" + sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    /**
     * 还需要代办项目还需要重新join一张新表
     */
    public HashMap<String, Object> getRehabilitationPatientPlanCount(String doctorId) {
        String sql =
                "SELECT DISTINCT \n" +
@ -1213,12 +1226,12 @@ public class RehabilitationInfoService {
    }
    /**
     * todayTaskCount 今日任务项,等后面在整
     * todo 还需要代办项目还需要重新join一张新表 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,a.idcard,\n" +
                "	 b.plan_doctor_name 'planDoctorName',d. `name` 'diseaseName',c.dept_name 'deptName',\n" +
                "	 b.id 'planId',b.title 'planTitle',b.plan_doctor_name 'planDoctorName',d. `name` 'diseaseName',c.dept_name 'deptName',\n" +
                "	 b.`status` 'planStatus', c.hospital_name 'hospitalName'," +
                "    c.from_source, " +
                "       CASE  \n" +
@ -1226,8 +1239,8 @@ public class RehabilitationInfoService {
                "        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" +
                "     c.ijk_id, c.status,'patientStatus'," +
                "     b.advice_content '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" +
@ -1243,6 +1256,7 @@ public class RehabilitationInfoService {
            sql += "	AND a.id='" + patientId + "' ";
        }
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        System.out.println("数据:" + JSON.toJSONString(list));
        return list;
    }
@ -1271,8 +1285,65 @@ public class RehabilitationInfoService {
    }
    public List<Map<String, Object>> getPatientPlanItem(String patientId, String planId, String startTime, String endTime, String doctorId, String type) {
        String sql = " ";
    /**
     * 查询病例信息
     */
    public List<PatientMedicalRecordsDO> getPatientMedicalRecordsByPatientId(String patientId) {
        String sql = "select  * from wlyy_patient_medical_records_rehabilitation where patient='" + patientId + "' order by create_time desc ";
        List<PatientMedicalRecordsDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(PatientMedicalRecordsDO.class));
        return list;
    }
    /**
     * 查询康复计划服务项
     */
    public List<Map<String, Object>> getPatientPlanItemList(String patientId, String planId, String itemId, String status) {
        String sql = "SELECT\n" +
                "	b.`name`,\n" +
                "	a.plan_id \n" +
                "FROM\n" +
                "	wlyy_rehabilitation_plan_detail a\n" +
                "	INNER JOIN wlyy_rehabilitation_service_item b ON a.hospital_service_item_id = b.id \n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "	AND a.plan_id = '" + planId + "'";
        if (StringUtils.isNotBlank(itemId)) {
            sql += " and b.id= '" + itemId + "'";
        }
        if (StringUtils.isNotBlank(status)) {
            sql += " a.status =" + status + "'";
        }
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    /**
     * 获取频次服务的信息
     * 这个服务项次数还没有-暂时没有
     */
    public List<Map<String, Object>> getPatientPlanFrequencyItemList(String patientId, String planId, String startTime, String endTime, String doctorId, String type) {
        return null;
    }
    public List<Map<String, Object>> getPlanDoctorList(String planId) {
        String sql = "SELECT DISTINCT q.* FROM (\n" +
                "	SELECT \n" +
                "		a.id,a.`name`,a.mobile,a.photo,a.sex\n" +
                "	FROM\n" +
                "		base_doctor a\n" +
                "		INNER JOIN wlyy_rehabilitation_plan_detail b ON a.id = b.doctor\n" +
                "		WHERE 1=1 AND b.plan_id='" + planId + "'\n" +
                "	UNION ALL\n" +
                "	SELECT \n" +
                "		a.id,a.`name`,a.mobile,a.photo,a.sex\n" +
                "	FROM\n" +
                "		base_doctor a\n" +
                "		INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.plan_doctor\n" +
                "		WHERE 1=1 AND b.id='" + planId + "'\n" +
                ")q";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
}