|
@@ -17,6 +17,9 @@
|
|
|
SELECT
|
|
|
a.id,
|
|
|
a.behospital_code,
|
|
|
+ a.hospital_id,
|
|
|
+ a.qcresult_detail_id,
|
|
|
+ a.cases_entry_id,
|
|
|
a.qcresult_detail_msg,
|
|
|
a.cases_name,
|
|
|
a.defect_content,
|
|
@@ -27,27 +30,57 @@
|
|
|
b.beh_dept_name,
|
|
|
a.appeal_operation_type
|
|
|
FROM
|
|
|
- med_appeal_info a
|
|
|
- LEFT JOIN med_behospital_info b ON a.behospital_code = b.behospital_code
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ *
|
|
|
+ FROM
|
|
|
+ `med_appeal_info`
|
|
|
WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND a.hospital_id = #{getComplaintRecordVO.hospitalId}
|
|
|
- AND a.hospital_id = b.hospital_id
|
|
|
- AND a.claimant_id = #{getComplaintRecordVO.complaintId}
|
|
|
+ (gmt_create IN (
|
|
|
+ SELECT
|
|
|
+ max(gmt_create)
|
|
|
+ FROM
|
|
|
+ med_appeal_info
|
|
|
+ WHERE
|
|
|
+ cases_entry_id IS NOT NULL
|
|
|
+ GROUP BY
|
|
|
+ hospital_id,
|
|
|
+ behospital_code,
|
|
|
+ cases_entry_id,
|
|
|
+ qcresult_detail_id
|
|
|
+ )
|
|
|
+ OR gmt_create IN (
|
|
|
+ SELECT
|
|
|
+ gmt_create
|
|
|
+ FROM
|
|
|
+ med_appeal_info
|
|
|
+ WHERE
|
|
|
+ cases_entry_id IS NULL
|
|
|
+ GROUP BY
|
|
|
+ appeal_explain
|
|
|
+ )
|
|
|
+ )
|
|
|
+ AND is_deleted = 'N'
|
|
|
+ AND hospital_id = #{getComplaintRecordVO.hospitalId}
|
|
|
+ AND claimant_id = #{getComplaintRecordVO.complaintId}
|
|
|
<if test="getComplaintRecordVO.complaintDateStart != null ">
|
|
|
- <![CDATA[ AND a.gmt_create >= #{getComplaintRecordVO.complaintDateStart}]]>
|
|
|
+ <![CDATA[ AND gmt_create >= #{getComplaintRecordVO.complaintDateStart}]]>
|
|
|
</if>
|
|
|
<if test="getComplaintRecordVO.complaintDateEnd != null ">
|
|
|
- <![CDATA[ AND a.gmt_create <= #{getComplaintRecordVO.complaintDateEnd}]]>
|
|
|
- </if>
|
|
|
- <if test="getComplaintRecordVO.deptName != null and getComplaintRecordVO.deptName != '' ">
|
|
|
- <![CDATA[ AND b.beh_dept_name = #{getComplaintRecordVO.deptName}]]>
|
|
|
+ <![CDATA[ AND gmt_create <= #{getComplaintRecordVO.complaintDateEnd}]]>
|
|
|
</if>
|
|
|
<if test="getComplaintRecordVO.casesName != null and getComplaintRecordVO.casesName != '' ">
|
|
|
- <![CDATA[ AND a.cases_name = #{getComplaintRecordVO.casesName}]]>
|
|
|
+ <![CDATA[ AND cases_name = #{getComplaintRecordVO.casesName}]]>
|
|
|
</if>
|
|
|
<if test="getComplaintRecordVO.operationType != null and getComplaintRecordVO.operationType != '' ">
|
|
|
- <![CDATA[ AND a.appeal_operation_type = #{getComplaintRecordVO.operationType}]]>
|
|
|
+ <![CDATA[ AND appeal_operation_type = #{getComplaintRecordVO.operationType}]]>
|
|
|
+ </if>
|
|
|
+ ) a
|
|
|
+ LEFT JOIN med_behospital_info b ON a.behospital_code = b.behospital_code
|
|
|
+ WHERE
|
|
|
+ a.hospital_id = b.hospital_id
|
|
|
+ <if test="getComplaintRecordVO.deptName != null and getComplaintRecordVO.deptName != '' ">
|
|
|
+ <![CDATA[ AND b.beh_dept_name = #{getComplaintRecordVO.deptName}]]>
|
|
|
</if>
|
|
|
) a
|
|
|
LEFT JOIN med_appeal_examine_info c ON a.id = c.appeal_info_id
|
|
@@ -80,6 +113,9 @@
|
|
|
SELECT
|
|
|
a.id,
|
|
|
a.behospital_code,
|
|
|
+ a.hospital_id,
|
|
|
+ a.qcresult_detail_id,
|
|
|
+ a.cases_entry_id,
|
|
|
a.qcresult_detail_msg,
|
|
|
a.cases_name,
|
|
|
a.defect_content,
|