|
|
|
@ -974,35 +974,16 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectByCmtCol" parameterType="com.emr.entity.Archive_Master_Vo" resultMap="BaseResultMap2">
|
|
|
|
|
select m.id,m.patient_id,m.inp_no,m.visit_id,m.name,m.sex,ISNULL(f.name,m.dept_name) dept_name
|
|
|
|
|
,CONVERT(varchar(10),m.discharge_date_time, 120) discharge_date_time,m.ArchiveState,CONVERT(varchar(10),m.admission_date_time, 120) admission_date_time,ISNULL(d.name,m.dept_admission_to) dept_admission_to
|
|
|
|
|
select m.id,m.patient_id,m.inp_no,m.visit_id,m.name,m.sex,m.dept_name
|
|
|
|
|
,CONVERT(varchar(10),m.discharge_date_time, 120) discharge_date_time,m.ArchiveState,CONVERT(varchar(10),m.admission_date_time, 120) admission_date_time,m.dept_admission_to
|
|
|
|
|
,m.check_doctor,m.checked_datetime,m.checked_doctor,m.LockInfo,m.DOCTOR_IN_CHARGE,m.ID_NO,m.DISCHARGE_DISPOSITION,m.dept_code_lend,m.isscaned,m.is_scanning,
|
|
|
|
|
m.cmt_doctor,m.cmt_nurse,m.doctor_name,m.nurse_name,m.cmt_doctor_date,m.cmt_nurse_date,m.emr_doctor_cmt,m.emr_nure_cmt,m.death_flag,m.bed_number,ISNULL(s.numb, 0) numb
|
|
|
|
|
,ISNULL(sDoctor.numb, 0) faultDoctorNum,ISNULL(sNurse.numb, 0) faultNurseNum,ISNULL(printTable.num, 0) printNum
|
|
|
|
|
m.cmt_doctor,m.cmt_nurse,m.doctor_name,m.nurse_name,m.cmt_doctor_date,m.cmt_nurse_date,m.emr_doctor_cmt,m.emr_nure_cmt,m.death_flag,m.bed_number,
|
|
|
|
|
ISNULL(m.print_flag, 0) printNum
|
|
|
|
|
from archive_master m
|
|
|
|
|
LEFT JOIN (select code,name from emr_dictionary where parent_id=(select id from emr_dictionary where
|
|
|
|
|
typeCode='dept_code' )) d
|
|
|
|
|
on m.dept_admission_to=d.code
|
|
|
|
|
LEFT JOIN(select archive_detail_id,count(*) numb from emr_fault_detail where 1=1 and back_flag in ('1','5') GROUP BY archive_detail_id) sDoctor
|
|
|
|
|
on m.id=sDoctor.archive_detail_id
|
|
|
|
|
LEFT JOIN(select archive_detail_id,count(*) numb from emr_fault_detail where 1=1 and back_flag in ('2','6') GROUP BY archive_detail_id) sNurse
|
|
|
|
|
on m.id=sNurse.archive_detail_id
|
|
|
|
|
LEFT JOIN (select code,name from emr_dictionary where parent_id=(select id from emr_dictionary where
|
|
|
|
|
typeCode='dept_code' )) f
|
|
|
|
|
on m.dept_name=f.code
|
|
|
|
|
LEFT JOIN(select archive_detail_id,count(*) numb from emr_fault_detail where 1=1 and back_flag is not null GROUP BY archive_detail_id) s
|
|
|
|
|
on m.id=s.archive_detail_id
|
|
|
|
|
LEFT JOIN (select MasterID,COUNT(*) num from archive_printInfo group by MasterID) printTable
|
|
|
|
|
on m.id=printTable.MasterID
|
|
|
|
|
where 1=1 and ArchiveState in('提交','主任退回','归档中','复审退回')
|
|
|
|
|
and patindex('%B%',m.inp_no) = 0 and inp_no not like 'LG%' and m.Is_Valid!=1
|
|
|
|
|
<if test="printNum != null and printNum != ''">
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="printNum == 1">
|
|
|
|
|
and printTable.MasterID is not null
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>and printTable.MasterID is null</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
<if test="printNum !=null and printNum !=''">
|
|
|
|
|
AND m.print_flag=#{printNum}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="inpNo != null and inpNo != ''">
|
|
|
|
|
and m.inp_no like '%'+#{inpNo,jdbcType=NCHAR}+'%'
|
|
|
|
@ -2610,4 +2591,34 @@
|
|
|
|
|
<select id="selectChildMasterId" resultType="com.emr.dto.Archive_MasterDto">
|
|
|
|
|
select id,inp_no from Archive_Master where admission_date_time = #{time}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getDoctorDefectNum" resultType="com.emr.entity.Archive_Master_Vo">
|
|
|
|
|
SELECT
|
|
|
|
|
archive_detail_id,
|
|
|
|
|
count(*) faultDoctorNum
|
|
|
|
|
FROM
|
|
|
|
|
emr_fault_detail
|
|
|
|
|
WHERE
|
|
|
|
|
back_flag IN ( '1', '5' )
|
|
|
|
|
and archive_detail_id in
|
|
|
|
|
<foreach item="item" collection="ids.split(',')" open="(" separator="," close=")">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
GROUP BY
|
|
|
|
|
archive_detail_id
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getNurseDefectNum" resultType="com.emr.entity.Archive_Master_Vo">
|
|
|
|
|
SELECT
|
|
|
|
|
archive_detail_id,
|
|
|
|
|
count(*) faultNurseNum
|
|
|
|
|
FROM
|
|
|
|
|
emr_fault_detail
|
|
|
|
|
WHERE
|
|
|
|
|
back_flag IN ( '2', '6' )
|
|
|
|
|
and archive_detail_id in
|
|
|
|
|
<foreach item="item" collection="ids.split(',')" open="(" separator="," close=")">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
GROUP BY
|
|
|
|
|
archive_detail_id
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|