针灸质控中心平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.1 KiB

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.acupuncture.system.persist.dao.PmsPatientDao">
<select id="query" resultType="com.acupuncture.system.domain.vo.PmsPatientVo$PatientResult"
parameterType="com.acupuncture.system.domain.dto.PmsPatientDto$PatientQuery">
SELECT
id,
name,
gender,
birth_date as birthDate,
ethnicity,
education_years as educationYears,
phone,
id_card_type as idCardType,
id_card as idCard,
source,
current_illness_history as currentIllnessHistory,
create_by as createBy,
create_time as createTime
FROM
pms_patient
<where>
del_flag = 0
<if test="query.tenantId != null">
AND tenant_id = #{query.tenantId}
</if>
<if test="query.gender != null">
AND gender = #{query.gender}
</if>
<if test="query.phone != null and query.phone != ''">
AND phone = #{query.phone}
</if>
<if test="query.idCard != null and query.idCard != ''">
AND id_card = #{query.idCard}
</if>
<if test="query.source != null">
AND source = #{query.source}
</if>
<if test="query.startAge != null">
AND DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), birth_date)), '%Y') + 0 &gt;= #{query.startAge}
</if>
<if test="query.endAge != null">
AND DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), birth_date)), '%Y') + 0 &lt;= #{query.endAge}
</if>
<if test="query.keywords != null and query.keywords != ''">
AND (
name LIKE CONCAT('%', #{query.keywords}, '%')
OR pinyin_full LIKE CONCAT('%', #{query.keywords}, '%')
OR pinyin_simple LIKE CONCAT('%', #{query.keywords}, '%')
)
</if>
</where>
</select>
</mapper>