|
|
@@ -12,21 +12,32 @@
|
|
|
<result property="patientGender" column="gender"/>
|
|
|
<result property="patientCardNo" column="card_no"/>
|
|
|
</resultMap>
|
|
|
-
|
|
|
<select id="selectPatientList" resultMap="PatientAndClinicResult">
|
|
|
- SELECT queryResult.patient_code,
|
|
|
+ SELECT
|
|
|
queryResult.countResult,
|
|
|
+ bp.id,
|
|
|
bp.name,
|
|
|
bp.birthday,
|
|
|
bp.gender,
|
|
|
- bp.card_no
|
|
|
- FROM ( (SELECT patient_id, patient_code, COUNT(1) AS countResult
|
|
|
- FROM biz_clinic_room
|
|
|
- GROUP BY patient_code, patient_id)) AS queryResult
|
|
|
- JOIN biz_patient AS bp ON queryResult.patient_id = bp.id
|
|
|
+ bp.current_clinic_id,
|
|
|
+ bp.card_no,
|
|
|
+ bp.patient_code
|
|
|
+ FROM
|
|
|
+ ( SELECT patient_id, COUNT ( 1 ) AS countResult FROM biz_clinic_room
|
|
|
+ <where>
|
|
|
+ <if test="query.queryTime != null and query.queryTime.size() > 0">
|
|
|
+ AND clinic_start_time >= #{query.queryTime[0]}
|
|
|
+ </if>
|
|
|
+ <if test="query.queryTime != null and query.queryTime.size() > 1">
|
|
|
+ AND clinic_start_time <= #{query.queryTime[1]}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY patient_id ) AS
|
|
|
+ queryResult
|
|
|
+ JOIN biz_patient AS bp ON queryResult.patient_id = bp."id"
|
|
|
<where>
|
|
|
<if test="query.queryCondition != null and query.queryCondition != ''">
|
|
|
- and queryResult.patient_code LIKE concat('%',#{query.queryCondition,jdbcType=VARCHAR},'%')
|
|
|
+ bp.patient_code LIKE concat('%',#{query.queryCondition,jdbcType=VARCHAR},'%')
|
|
|
or bp.name like concat('%',#{query.queryCondition,jdbcType=VARCHAR},'%')
|
|
|
</if>
|
|
|
</where>
|