You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
4.5 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.mapper.AfCollectTaskMapper">
<select id="listJZHByDate" resultType="string">
select jzh
from docus_medicalrecord.t_basic a
where
a.create_time >=#{date1}
and a.create_time &lt;=#{date2}
and a.jzh is not null
and a.is_archive=0
and a.dis_dept in ('1211','1252')
and jzh not in
(select C3 from af_collect_task where sysflag=22 and state=3)
order by create_time asc
</select>
<select id="selectDisDateIsNull" resultType="com.docus.bgts.entity.TBasic">
select *
from docus_medicalrecord.t_basic
where inpatient_no=#{inPatientNo}
and dis_date is null
</select>
<select id="selectDisDateIsNullJzh" resultType="string">
select t.jzh
from(
select admiss_date,dis_date,jzh
from docus_medicalrecord.t_basic
where inpatient_no=#{inPatientNo} and dis_date is null and ph is null
) t
where date_sub(t.admiss_date, interval 6 hour) &lt;= #{examApplyDate}
</select>
<select id="selectJzh" resultType="string">
select t.jzh
from(
select admiss_date,dis_date,jzh,ph
from docus_medicalrecord.t_basic
where inpatient_no=#{inPatientNo}
) t
where date_sub(t.admiss_date, interval 6 hour) &lt;= #{examApplyDate}
and date_add(t.dis_date, interval 6 hour) &gt;= #{examApplyDate}
and t.ph is null
</select>
<select id="getpatientIdByEmpId" resultType="string">
select patient_id
from docus_medicalrecord.t_basic
where jzh=#{jzh}
</select>
<select id="getAssortIdByAssortId" resultType="string">
select assort_id from zd_assort where assort_id=#{assortId}
</select>
<select id="getAssortIdByAssortName" resultType="string">
select assort_id from zd_assort where assort_name=#{assortName}
</select>
<insert id="insertZdAssort">
insert into zd_assort(assort_id,assort_name,effective) values(#{zdAssort.assortId},#{zdAssort.assortName},#{zdAssort.effective})
</insert>
<delete id="deleteByPatientIdAndCollectorId">
delete from af_downfile where
patient_id=#{patientId} and collectorid=#{collectorId}
</delete>
<delete id="deleteByPatientIdAndAssortId">
delete from t_scan_assort where
patient_id=#{patientId} and assort_id=#{assortId}
</delete>
<delete id="deleteByPatientIdAndSysFlag">
delete from af_collect_task where
patient_id=#{patientId} and sysflag=#{sysFlag}
</delete>
<insert id="insertDoctorState">
insert into docus_medicalrecord.cqc_submit_state(patient_id,doctor_state,nurse_state) values(#{patientId},#{doctorState},#{nurseState})
</insert>
<update id="updateDoctorState">
update docus_medicalrecord.cqc_submit_state
<set>
<if test="doctorState!=null">
doctor_state=#{doctorState},
</if>
<if test="nurseState!=null">
nurse_state=#{nurseState},
</if>
</set>
where patient_id=#{patientId}
</update>
<update id="cacelScanAssort">
update t_scan_assort
set is_del = 1
where patient_id=#{patientId} and source=#{collectorId}
</update>
<select id="selectByPatientId" resultType="com.docus.bgts.entity.CqcSubmitState">
select * from docus_medicalrecord.cqc_submit_state
where patient_id=#{patientId}
</select>
<select id="selectPatientByjzh" resultType="java.lang.String">
select patient_id
from docus_medicalrecord.t_basic_out
where jzh=#{jzh}
</select>
<select id="selectNameByPatientId" resultType="java.lang.String">
select creater_name from docus_medicalrecord.cqc_back_info_log where patient_id=#{patientId} and create_time in
(select max(create_time) from docus_medicalrecord.cqc_back_info_log where patient_id=#{patientId})
</select>
<select id="getPatientIdBysealId" resultType="java.lang.String">
select patient_id from docus_medicalrecord.t_seal where seal_id=#{sealId}
</select>
<select id="getIdNos" resultType="java.lang.String">
select file_column_1
from t_scan_assort
where
patient_id=#{patientId} and source=#{collectorId} and file_column_1 is not null
</select>
</mapper>