Browse Source

暂存

hnsdlyy
zhangye 11 hours ago
parent
commit
bd7bb956a0
  1. 30
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/PmsController.java
  2. 175
      ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/PmsPatientDao.xml

30
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/PmsController.java

@ -69,9 +69,35 @@ public class PmsController extends BaseController {
startPageOvertop(dto);
List<PmsPatientVo.PatientList> serverList = patientService.queryPatientList(dto.getParam(), dataScope, loginUser.getUserId(), loginUser.getUsername());
// startPageOvertop(dto);
// List<PmsPatientVo.PatientList> serverList = patientService.queryPatientList(dto.getParam(), dataScope, loginUser.getUserId(), loginUser.getUsername());
// return JsonResponse.ok(new PageInfo<>(serverList));
//获取用户的权限
LoginUser loginUser = SecurityUtils.getLoginUser();
List<Long> deptIdList = new ArrayList<>();
if (dto.getParam().getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) {
deptIdList.add(Long.parseLong(deptId));
}
}
}else {
deptIdList.add(dto.getParam().getDeptId());
}
startPageOvertop(dto);
List<PmsPatientVo.PatientList> serverList = patientService.queryPatientList(dto.getParam(), null, loginUser.getUserId(), loginUser.getUsername(), deptIdList);
return JsonResponse.ok(new PageInfo<>(serverList));
}

175
ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/PmsPatientDao.xml

@ -23,140 +23,36 @@
update pms_patient_personal set del_flag = 1 where patient_id = #{patientId};
</delete>
<select id="queryPatientList" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientList">
SELECT DISTINCT
a.patientId,
a.patientName,
a.sex,
a.idcard,
a.phone, -- 核心修复:将 a.mobile 改为 a.phone(与内层别名一致)
a.educationalStatus,
a.independentLivingSkills,
a.birthNumber,
a.dwellingState,
a.lastEvaluationTime,
a.lastTesterName, -- 修正之前的笔误(原 astTesterName)
a.evaluationCount,
a.createBy,
a.createTime,
a.hospitalName,
a.birthday,
a.career,
a.maritalStatus,
a.domicile,
a.nation,
a.nativePlace,
a.contactName,
a.contactRelation,
a.contactMobile,
a.address,
a.belief,
a.hobby,
a.aboBloodType,
a.rhBloodType
FROM
(
SELECT DISTINCT
pp.id AS patientId,
pp.`name` AS patientName,
pp.sex,
pp.idcard,
pp.mobile AS phone, -- 内层别名是 phone
pp.educational_status AS educationalStatus,
pp.independent_living_skills AS independentLivingSkills,
pp.birth_number AS birthNumber,
pp.dwelling_state AS dwellingState,
MAX(ee.create_time) AS lastEvaluationTime,
uu.nick_name AS lastTesterName,
COUNT(ee.id) AS evaluationCount,
(SELECT nick_name FROM ums_user WHERE user_name = pp.create_by AND del_flag = 0) AS createBy,
pp.create_time AS createTime,
ud.dept_name AS hospitalName,
pp.birthday,
pp.career,
pp.marital_status AS maritalStatus,
pp.domicile,
pp.nation,
pp.native_place AS nativePlace,
pp.contact_name AS contactName,
pp.contact_relation AS contactRelation,
pp.contact_mobile AS contactMobile,
pp.address,
pp.belief,
pp.hobby,
pp.abo_blood_type AS aboBloodType,
pp.rh_blood_type AS rhBloodType
FROM
pms_patient pp
LEFT JOIN ems_evaluation ee ON pp.id = ee.patient_id AND ee.del_flag = 0
LEFT JOIN ums_user uu ON ee.tester_id = uu.user_id
LEFT JOIN ums_dept ud ON pp.hospital_id = ud.dept_id
WHERE
pp.del_flag = 0
<if test="deptIdList != null and deptIdList.size()>0">
<if test="deptIdList != null and deptIdList.size()>0">
and pp.hospital_id IN
<foreach item="item" collection="deptIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
<if test="searchValue != null and searchValue != ''">
and (
pp.name like CONCAT('%',#{searchValue},'%')
or
pp.name_initial like CONCAT('%',LOWER(#{searchValue}),'%')
or
pp.name_full like CONCAT('%',LOWER(#{searchValue}),'%')
or
pp.idcard like CONCAT('%',#{searchValue},'%')
or
pb.outpatient_no like CONCAT('%',#{searchValue},'%')
)
</if>
<if test="idcard != null and idcard != ''">
and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt})
</if>
GROUP BY
pp.id
UNION ALL
SELECT DISTINCT
pp.id AS patientId,
pp.`name` AS patientName,
SELECT
DISTINCT
pp.id as patientId,
pp.`name` as patientName,
pp.sex,
pp.idcard,
pp.mobile AS phone, -- 内层别名统一为 phone
pp.educational_status AS educationalStatus,
pp.independent_living_skills AS independentLivingSkills,
pp.birth_number AS birthNumber,
pp.dwelling_state AS dwellingState,
MAX(ee.create_time) AS lastEvaluationTime,
uu.nick_name AS lastTesterName,
COUNT(ee.id) AS evaluationCount,
(SELECT nick_name FROM ums_user WHERE user_name = pp.create_by AND del_flag = 0) AS createBy,
pp.create_time AS createTime,
ud.dept_name AS hospitalName,
pp.mobile as phone,
pp.birth_year as birthYear,
pp.birthday,
pp.career,
pp.marital_status AS maritalStatus,
pp.domicile,
pp.nation,
pp.native_place AS nativePlace,
pp.contact_name AS contactName,
pp.contact_relation AS contactRelation,
pp.contact_mobile AS contactMobile,
pp.address,
pp.belief,
pp.hobby,
pp.abo_blood_type AS aboBloodType,
pp.rh_blood_type AS rhBloodType
pp.contact_name as contactName,
pp.contact_relation as contactRelation,
pp.contact_mobile as contactMobile,
pp.contact_other as contactOther,
pp.id_card_type as idCardType,
pp.id_card_type_other as idCardTypeOther,
pp.abo_blood_type as aboBloodType,
pp.rh_blood_type as rhBloodType,
MAX(ae.create_time) as lastEvaluationTime,
uu.nick_name as lastTesterName,
COUNT(ae.id) as evaluationCount,
(select nick_name from ums_user where user_name = pp.create_by and del_flag = 0) as creatorName,
pp.create_time as createTime
FROM
pms_patient pp
LEFT JOIN pms_patient_body pb ON pb.patient_id = pp.id AND pb.del_flag = 0
LEFT JOIN ems_evaluation ee ON pp.id = ee.patient_id AND ee.del_flag = 0
LEFT JOIN ums_user uu ON ee.tester_id = uu.user_id
LEFT JOIN ums_dept ud ON pp.hospital_id = ud.dept_id
LEFT JOIN ems_evaluation ae on pp.id = ae.patient_id
LEFT JOIN ums_user uu on pp.create_by = uu.user_name
left join pms_patient_body pb on pp.id = pb.patient_id
WHERE
pp.del_flag = 0
<if test="searchValue != null and searchValue != ''">
@ -172,25 +68,16 @@
pb.outpatient_no like CONCAT('%',#{searchValue},'%')
)
</if>
<if test="idcard != null and idcard != ''">
and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt})
</if>
<if test="deptIdList != null and deptIdList.size()>0">
<if test="deptIdList != null and deptIdList.size()>0">
and pp.hospital_id IN
<foreach item="item" collection="deptIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
GROUP BY
pp.id
) a
group by a.patientId
ORDER BY a.createTime DESC
<if test="idcard != null and idcard != ''">
and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt})
</if>
<!-- 权限 总测评师和测评师都是本部门及以下 -->
and uu.dept_id IN ( SELECT d.dept_id FROM ums_user u LEFT JOIN ums_dept d on (d.dept_id = u.dept_id or FIND_IN_SET(u.dept_id,ancestors))
WHERE user_id = #{userId}
)
GROUP BY pp.id
order by pp.create_time desc
</select>
<select id="queryPatientByIdCard" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientInfo">
SELECT
DISTINCT

Loading…
Cancel
Save