suqinyi hace 1 año
padre
commit
c61ba1d4a7

+ 48 - 23
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,7 @@ 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);
            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 +202,10 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    }
    /**
     * 康复管理
     * 获取所有居民的康复计列表数量统计
     * todo 还需要代办项目还需要重新join一张新表
     */
    @RequestMapping(value = "getRehabilitationPatientPlanCount", method = RequestMethod.GET)
    @ApiOperation("获取所有居民的康复计列表")
@ -225,6 +227,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    /**
     * 查询居民的康复计划
     * todo 还需要代办项目还需要重新join一张新表 todayTaskCount 今日任务项,等后面在整
     */
    @RequestMapping(value = "getPatientRehabilitationByPatientId", method = RequestMethod.GET)
    @ApiOperation("查询居民的康复计划")
@ -240,14 +243,50 @@ 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
    ) {
        try {
            List<Map<String, Object>> result = rehabilitationInfoService.getPatientPlanItemList(patientId, planId);
            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 +295,15 @@ 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, "操作失败");
//        }
//    }
    //=================================================没有用到的======================================================================

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

@ -29,6 +29,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 +843,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 +859,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 +877,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 +885,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 +1105,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 +1118,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" +
@ -1144,6 +1146,12 @@ public class RehabilitationInfoService {
            sql += "	AND (b.plan_doctor='" + doctorId + "' OR c.doctor='" + doctorId + "' )";
            sql += " and  c.doctor is not null  ";
        }
        if (StringUtils.isNotBlank(patientId)) {
            //康复计划状态 [0已中止,1进行中,2已完成]
            sql += "	AND a.patientId ='" + patientId + "' ";
        }
        if (StringUtils.isNotBlank(idcard)) {
            //康复计划状态 [0已中止,1进行中,2已完成]
            sql += "	AND a.idcard like'%" + idcard + "%'";
@ -1166,6 +1174,9 @@ public class RehabilitationInfoService {
        return list;
    }
    /**
     * 还需要代办项目还需要重新join一张新表
     */
    public HashMap<String, Object> getRehabilitationPatientPlanCount(String doctorId) {
        String sql =
                "SELECT DISTINCT \n" +
@ -1213,7 +1224,7 @@ public class RehabilitationInfoService {
    }
    /**
     * todayTaskCount 今日任务项,等后面在整
     * todo 还需要代办项目还需要重新join一张新表 todayTaskCount 今日任务项,等后面在整
     */
    public List<Map<String, Object>> getPatientRehabilitationByPatientId(String patientId) {
        String sql = "SELECT DISTINCT \n" +
@ -1227,7 +1238,7 @@ public class RehabilitationInfoService {
                "        WHEN c.from_source='3' THEN '扫码添加'\n" +
                "      END 'fromSourceName',\n" +
                "     c.ijk_id, c.status, 'patientStatus'," +
                "     b.adviceContent,\n" +
                "     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" +
@ -1271,8 +1282,40 @@ 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 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 + "'";
        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;
    }
}