|
@@ -5,25 +5,25 @@
|
|
|
<mapper namespace="cn.tr.module.smart.common.repository.BizPatientRepository">
|
|
<mapper namespace="cn.tr.module.smart.common.repository.BizPatientRepository">
|
|
|
|
|
|
|
|
<resultMap id="PatientAndClinicResult" type="cn.tr.module.smart.app.controller.vo.WxDoctorPatientVO">
|
|
<resultMap id="PatientAndClinicResult" type="cn.tr.module.smart.app.controller.vo.WxDoctorPatientVO">
|
|
|
|
|
+ <result property="patientId" column="patient_id"/>
|
|
|
|
|
+ <result property="currentClinicId" column="current_clinic_id"/>
|
|
|
<result property="patientCode" column="patient_code"/>
|
|
<result property="patientCode" column="patient_code"/>
|
|
|
- <result property="countResult" column="countResult"/>
|
|
|
|
|
- <result property="patientName" column="name"/>
|
|
|
|
|
- <result property="patientBirthday" column="birthday"/>
|
|
|
|
|
- <result property="patientGender" column="gender"/>
|
|
|
|
|
- <result property="patientCardNo" column="card_no"/>
|
|
|
|
|
|
|
+ <result property="countResult" column="result_count"/>
|
|
|
|
|
+ <result property="patientName" column="patient_name"/>
|
|
|
|
|
+ <result property="patientAge" column="patient_age"/>
|
|
|
|
|
+ <result property="patientGender" column="patient_gender"/>
|
|
|
</resultMap>
|
|
</resultMap>
|
|
|
<select id="selectPatientList" resultMap="PatientAndClinicResult">
|
|
<select id="selectPatientList" resultMap="PatientAndClinicResult">
|
|
|
SELECT
|
|
SELECT
|
|
|
- queryResult.countResult,
|
|
|
|
|
- bp.id,
|
|
|
|
|
- bp.name,
|
|
|
|
|
- bp.birthday,
|
|
|
|
|
- bp.gender,
|
|
|
|
|
|
|
+ query_result.result_count,
|
|
|
|
|
+ bp.ID AS patient_id,
|
|
|
|
|
+ bp.patient_code,
|
|
|
bp.current_clinic_id,
|
|
bp.current_clinic_id,
|
|
|
- bp.card_no,
|
|
|
|
|
- bp.patient_code
|
|
|
|
|
|
|
+ bcr.patient_name,
|
|
|
|
|
+ bcr.patient_age,
|
|
|
|
|
+ bcr.patient_gender
|
|
|
FROM
|
|
FROM
|
|
|
- ( SELECT patient_id, COUNT ( 1 ) AS countResult FROM biz_clinic_room
|
|
|
|
|
|
|
+ ( SELECT patient_id, COUNT ( 1 ) AS result_count FROM biz_clinic_room
|
|
|
<where>
|
|
<where>
|
|
|
<if test="query.queryTime != null and query.queryTime.size() > 0">
|
|
<if test="query.queryTime != null and query.queryTime.size() > 0">
|
|
|
AND clinic_start_time >= #{query.queryTime[0]}
|
|
AND clinic_start_time >= #{query.queryTime[0]}
|
|
@@ -32,9 +32,9 @@
|
|
|
AND clinic_start_time <= #{query.queryTime[1]}
|
|
AND clinic_start_time <= #{query.queryTime[1]}
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
- GROUP BY patient_id ) AS
|
|
|
|
|
- queryResult
|
|
|
|
|
- JOIN biz_patient AS bp ON queryResult.patient_id = bp."id"
|
|
|
|
|
|
|
+ GROUP BY patient_id ) query_result
|
|
|
|
|
+ JOIN biz_patient AS bp ON query_result.patient_id = bp.ID
|
|
|
|
|
+ LEFT JOIN biz_clinic_room bcr ON bp.current_clinic_id = bcr.ID
|
|
|
<where>
|
|
<where>
|
|
|
<if test="query.queryCondition != null and query.queryCondition != ''">
|
|
<if test="query.queryCondition != null and query.queryCondition != ''">
|
|
|
bp.patient_code LIKE concat('%',#{query.queryCondition,jdbcType=VARCHAR},'%')
|
|
bp.patient_code LIKE concat('%',#{query.queryCondition,jdbcType=VARCHAR},'%')
|