|
@@ -4,24 +4,131 @@
|
|
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
<resultMap id="BaseResultMap" type="com.diagbot.entity.CheckRecord">
|
|
|
- <id column="id" property="id" />
|
|
|
- <result column="hospital_id" property="hospitalId" />
|
|
|
- <result column="behospital_code" property="behospitalCode" />
|
|
|
- <result column="check_type" property="checkType" />
|
|
|
- <result column="job_creator" property="jobCreator" />
|
|
|
- <result column="job_creator_name" property="jobCreatorName" />
|
|
|
- <result column="job_create_time" property="jobCreateTime" />
|
|
|
- <result column="job_type" property="jobType" />
|
|
|
- <result column="job_distributor" property="jobDistributor" />
|
|
|
- <result column="job_distribution_name" property="jobDistributionName" />
|
|
|
- <result column="job_distribution_time" property="jobDistributionTime" />
|
|
|
- <result column="work_flow_node_id" property="workFlowNodeId" />
|
|
|
- <result column="is_deleted" property="isDeleted" />
|
|
|
- <result column="gmt_create" property="gmtCreate" />
|
|
|
- <result column="gmt_modified" property="gmtModified" />
|
|
|
- <result column="creator" property="creator" />
|
|
|
- <result column="modifier" property="modifier" />
|
|
|
- <result column="remark" property="remark" />
|
|
|
+ <id column="id" property="id"/>
|
|
|
+ <result column="hospital_id" property="hospitalId"/>
|
|
|
+ <result column="behospital_code" property="behospitalCode"/>
|
|
|
+ <result column="check_type" property="checkType"/>
|
|
|
+ <result column="job_creator" property="jobCreator"/>
|
|
|
+ <result column="job_creator_name" property="jobCreatorName"/>
|
|
|
+ <result column="job_create_time" property="jobCreateTime"/>
|
|
|
+ <result column="job_type" property="jobType"/>
|
|
|
+ <result column="job_distributor" property="jobDistributor"/>
|
|
|
+ <result column="job_distribution_name" property="jobDistributionName"/>
|
|
|
+ <result column="job_distribution_time" property="jobDistributionTime"/>
|
|
|
+ <result column="work_flow_node_id" property="workFlowNodeId"/>
|
|
|
+ <result column="is_deleted" property="isDeleted"/>
|
|
|
+ <result column="gmt_create" property="gmtCreate"/>
|
|
|
+ <result column="gmt_modified" property="gmtModified"/>
|
|
|
+ <result column="creator" property="creator"/>
|
|
|
+ <result column="modifier" property="modifier"/>
|
|
|
+ <result column="remark" property="remark"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <select id="getCheckRecordPage" resultType="com.diagbot.dto.GetCheckRecordPageDTO">
|
|
|
+ SELECT
|
|
|
+ t2.* ,
|
|
|
+ mhp.age
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t1.*,
|
|
|
+ mbi.name,
|
|
|
+ mbi.sex,
|
|
|
+ mbi.file_code fileCode,
|
|
|
+ mbi.beh_dept_name behDeptName,
|
|
|
+ mbi.behospital_date behospitalDate,
|
|
|
+ mbi.leave_hospital_date leaveHospitalDate,
|
|
|
+ CASE WHEN ISNULL(mbi.leave_hospital_date) THEN '-' ELSE (SELECT
|
|
|
+ TIMESTAMPDIFF(DAY,mbi.behospital_date,mbi.leave_hospital_date)) END hospitalizationDays,
|
|
|
+ mbi.director_doctor_id directorDoctorId,
|
|
|
+ mbi.director_doctor_name directorDoctorName,
|
|
|
+ mbi.diagnose,
|
|
|
+ mbt.behospital_type behospitalType,
|
|
|
+ mqc.`level`
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ mcr.id,
|
|
|
+ mcr.hospital_id hospitalId,
|
|
|
+ mcr.behospital_code behospitalCode,
|
|
|
+ mcr.check_type checkType,
|
|
|
+ mcr.job_creator jobCreator,
|
|
|
+ mcr.job_creator_name jobCreatorName,
|
|
|
+ mcr.job_create_time jobCreateTime,
|
|
|
+ mcr.job_type jobType,
|
|
|
+ mcr.job_distributor jobDistributor,
|
|
|
+ mcr.job_distribution_name jobDistributionName,
|
|
|
+ mcr.job_distribution_time jobDistributionTime,
|
|
|
+ mcr.work_flow_node_id workFlowNodeId,
|
|
|
+ mcr.job_end_time jobEndTime,
|
|
|
+ mcre.check_record checkRecord,
|
|
|
+ mcre.check_id checkId,
|
|
|
+ mcre.check_name checkName,
|
|
|
+ mcre.check_time checkTime,
|
|
|
+ mcre. STATUS
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT * from
|
|
|
+ med_check_record mc
|
|
|
+ where
|
|
|
+ mc.is_deleted = 'N'
|
|
|
+ <if test="getCheckRecordPagevo.jobDistributionTimeStart != null and getCheckRecordPagevo.jobDistributionTimeStart != ''">
|
|
|
+ <![CDATA[ and mc.job_distribution_time >= #{getCheckRecordPagevo.jobDistributionTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.jobDistributionTimeEnd != null and getCheckRecordPagevo.jobDistributionTimeEnd != ''">
|
|
|
+ <![CDATA[ and mc.job_distribution_time <= #{getCheckRecordPagevo.jobDistributionTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.behospitalCode != null and getCheckRecordPagevo.behospitalCode != ''">
|
|
|
+ AND mc.behospital_code = #{getCheckRecordPagevo.behospitalCode}
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.jobType != null and getCheckRecordPagevo.jobType != ''">
|
|
|
+ AND mc.job_type = #{getCheckRecordPagevo.jobType}
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.userId != null and getCheckRecordPagevo.userId != ''">
|
|
|
+ AND ( mc.job_creator = #{getCheckRecordPagevo.userId} or ISNULL(mc.job_creator) or mc.job_distributor = #{getCheckRecordPagevo.userId})
|
|
|
+ </if>
|
|
|
+ ) mcr
|
|
|
+ LEFT JOIN med_check_record_examine mcre ON mcr.id = mcre.check_record
|
|
|
+ AND mcre.is_deleted = 'N'
|
|
|
+ ) t1 LEFT JOIN med_behospital_info mbi on t1.behospitalCode=mbi.behospital_code
|
|
|
+ and mbi.is_deleted='N'
|
|
|
+ <if test="getCheckRecordPagevo.name != null and getCheckRecordPagevo.name!=''">
|
|
|
+ AND mbi.name like concat('%', #{getCheckRecordPagevo.name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.isPlacefile != null and getCheckRecordPagevo.isPlacefile!=''">
|
|
|
+ AND mbi.is_placefile = #{getCheckRecordPagevo.isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.recordType != null and getCheckRecordPagevo.recordType!=''">
|
|
|
+ AND t1.behospital_type = #{getCheckRecordPagevo.recordType}
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.status != null and getCheckRecordPagevo.status!=''">
|
|
|
+ AND t1.status = #{getCheckRecordPagevo.status}
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.level != null and getCheckRecordPagevo.level!=''">
|
|
|
+ AND t1.level = #{getCheckRecordPagevo.level}
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.deptName != null and getCheckRecordPagevo.deptName != ''">
|
|
|
+ AND t1.beh_dept_name = #{getCheckRecordPagevo.deptName}
|
|
|
+ </if>
|
|
|
+ LEFT JOIN med_behospital_type mbt on t1.behospitalCode=mbt.behospital_code
|
|
|
+ and mbt.is_deleted='N'
|
|
|
+ LEFT JOIN med_qcresult_info mqc on t1.behospitalCode=mqc.behospital_code
|
|
|
+ and mqc.is_deleted='N'
|
|
|
+
|
|
|
+ )t2 LEFT JOIN med_home_page mhp on t2.behospitalCode=mhp.behospital_code
|
|
|
+ <if test="getCheckRecordPagevo.hospitalizationDays != null and getCheckRecordPagevo.hospitalizationDays != ''">
|
|
|
+ <![CDATA[ and t2.days <= #{getCheckRecordPagevo.hospitalizationDays}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.hospitalizationDays != null and getCheckRecordPagevo.hospitalizationDays != ''">
|
|
|
+ <![CDATA[ and t2.days >= #{getCheckRecordPagevo.hospitalizationDays}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.doctorName != null and getCheckRecordPagevo.doctorName != ''">
|
|
|
+ AND t2.directorDoctorName like concat('%', #{getCheckRecordPagevo.doctorName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="getCheckRecordPagevo.diagnoseName != null and getCheckRecordPagevo.diagnoseName != ''">
|
|
|
+ AND t2.diagnose like concat('%', #{getCheckRecordPagevo.diagnoseName}, '%')
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|