|
@@ -19,32 +19,21 @@
|
|
|
</resultMap>
|
|
</resultMap>
|
|
|
<select id="selectPatientList" resultMap="PatientAndClinicResult">
|
|
<select id="selectPatientList" resultMap="PatientAndClinicResult">
|
|
|
SELECT
|
|
SELECT
|
|
|
- query_result.result_count,
|
|
|
|
|
- bp.ID AS patient_id,
|
|
|
|
|
|
|
+ count(1) as countResult,
|
|
|
|
|
+ bp.id AS patient_id,
|
|
|
bp.patient_code,
|
|
bp.patient_code,
|
|
|
bp.current_clinic_id,
|
|
bp.current_clinic_id,
|
|
|
bcr.patient_name,
|
|
bcr.patient_name,
|
|
|
bcr.patient_age,
|
|
bcr.patient_age,
|
|
|
bcr.patient_gender,
|
|
bcr.patient_gender,
|
|
|
- bp.create_time ,
|
|
|
|
|
|
|
+ bp.create_time,
|
|
|
bp.update_time,
|
|
bp.update_time,
|
|
|
bp.create_by,
|
|
bp.create_by,
|
|
|
bp.update_by
|
|
bp.update_by
|
|
|
FROM
|
|
FROM
|
|
|
- ( SELECT patient_id, COUNT ( 1 ) AS result_count FROM biz_clinic_room
|
|
|
|
|
- <where>
|
|
|
|
|
- and deleted = 0
|
|
|
|
|
- <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 ) query_result
|
|
|
|
|
- JOIN biz_patient AS bp ON query_result.patient_id = bp.ID
|
|
|
|
|
- JOIN biz_clinic_room bcr ON bp.current_clinic_id = bcr.ID
|
|
|
|
|
- JOIN biz_clinic_room_doctor_user bcrmu on bcr.id = bcrmu.clinic_room_id
|
|
|
|
|
|
|
+ biz_patient bp
|
|
|
|
|
+ JOIN biz_clinic_room bcr ON bp.ID = bcr.patient_id
|
|
|
|
|
+ JOIN biz_clinic_room_doctor_user bcrmu ON bcr.ID = bcrmu.clinic_room_id
|
|
|
<where>
|
|
<where>
|
|
|
and bcr.deleted = 0
|
|
and bcr.deleted = 0
|
|
|
and bp.deleted = 0
|
|
and bp.deleted = 0
|
|
@@ -67,31 +56,48 @@
|
|
|
<if test="query.currentUserId != null and query.currentUserId != ''">
|
|
<if test="query.currentUserId != null and query.currentUserId != ''">
|
|
|
AND bcrmu.user_id = #{query.currentUserId,jdbcType=VARCHAR}
|
|
AND bcrmu.user_id = #{query.currentUserId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <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>
|
|
</where>
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ bp.id,
|
|
|
|
|
+ bp.patient_code,
|
|
|
|
|
+ bp.current_clinic_id,
|
|
|
|
|
+ bcr.patient_name,
|
|
|
|
|
+ bcr.patient_age,
|
|
|
|
|
+ bcr.patient_gender,
|
|
|
|
|
+ bp.create_time,
|
|
|
|
|
+ bp.update_time,
|
|
|
|
|
+ bp.create_by,
|
|
|
|
|
+ bp.update_by
|
|
|
</select>
|
|
</select>
|
|
|
<select id="selectPatientByConditionList" resultType="cn.tr.module.smart.common.dto.BizPatientDTO">
|
|
<select id="selectPatientByConditionList" resultType="cn.tr.module.smart.common.dto.BizPatientDTO">
|
|
|
SELECT
|
|
SELECT
|
|
|
- bp.id,
|
|
|
|
|
- bcr.patient_name as name,
|
|
|
|
|
- bcr.patient_age as age,
|
|
|
|
|
- bcr.patient_gender as gender,
|
|
|
|
|
- bcr.clinic_name as clinicName,
|
|
|
|
|
- bcr.clinic_start_time as clinicStartTime,
|
|
|
|
|
- bp.current_clinic_id as currentClinicId,
|
|
|
|
|
- bp.patient_code as patientCode,
|
|
|
|
|
- bp.create_by as create_by,
|
|
|
|
|
- bp.create_time as create_time,
|
|
|
|
|
- bp.update_time as update_time,
|
|
|
|
|
- bp.update_by as update_by
|
|
|
|
|
|
|
+ bp.id,
|
|
|
|
|
+ bcr.patient_name as name,
|
|
|
|
|
+ bcr.patient_age as age,
|
|
|
|
|
+ bcr.patient_gender as gender,
|
|
|
|
|
+ bcr.clinic_name as clinicName,
|
|
|
|
|
+ bcr.clinic_start_time as clinicStartTime,
|
|
|
|
|
+ bp.current_clinic_id as currentClinicId,
|
|
|
|
|
+ bp.patient_code as patientCode,
|
|
|
|
|
+ bp.create_by as create_by,
|
|
|
|
|
+ bp.create_time as create_time,
|
|
|
|
|
+ bp.update_time as update_time,
|
|
|
|
|
+ bp.update_by as update_by
|
|
|
FROM
|
|
FROM
|
|
|
- biz_patient bp
|
|
|
|
|
- LEFT JOIN biz_clinic_room bcr ON bp.current_clinic_id = bcr.ID
|
|
|
|
|
|
|
+ biz_patient bp
|
|
|
|
|
+ LEFT JOIN biz_clinic_room bcr ON bp.current_clinic_id = bcr.ID
|
|
|
<where>
|
|
<where>
|
|
|
and bp.deleted = 0
|
|
and bp.deleted = 0
|
|
|
and bcr.deleted = 0
|
|
and bcr.deleted = 0
|
|
|
and bp.current_clinic_id is not null
|
|
and bp.current_clinic_id is not null
|
|
|
<if test="query.condition != null and query.condition != ''">
|
|
<if test="query.condition != null and query.condition != ''">
|
|
|
- and bcr.patient_name like concat('%',#{query.condition,jdbcType=VARCHAR},'%')
|
|
|
|
|
|
|
+ and bcr.patient_name like concat('%',#{query.condition,jdbcType=VARCHAR},'%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="query.clinicTime != null and query.clinicTime.size() > 0">
|
|
<if test="query.clinicTime != null and query.clinicTime.size() > 0">
|
|
|
and bcr.clinic_start_time >= #{query.clinicTime[0]}
|
|
and bcr.clinic_start_time >= #{query.clinicTime[0]}
|