2025-10-29 17:59:05 +08:00
<?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.czlis.liswork.mapper.LisWorkGermMapper" >
2025-11-18 17:50:48 +08:00
<sql id= "selectLabPatVoWSW" >
select jyrq,yq,ybh,jzbz,jgbz,dybz,brly,brdh,brxm,brxb,nl,nldw,ksdh,jymd,yljg,alarmflag,finish,fslx,autojgbz,lstd,shcs,yblx,sqh,yhdh,ch,zjf,CONVERT(varchar(10), DATEDIFF(day, CONVERT(varchar(10),sqsj,110), CONVERT(varchar(10),isnull(dysj,getdate()),110)))+'天' as cp_pyzq from lab_pat
</sql>
2025-11-05 16:53:46 +08:00
<select id= "getLabResultMedInfo" resultType= "com.czlis.common.core.domain.entity.lis.LabResultMed" >
2025-11-20 17:41:15 +08:00
select a.*,m.ywmc,
2025-11-17 17:36:07 +08:00
case
2025-11-19 15:13:56 +08:00
when isnull(a.mic,'')!='' then isnull(c.micref,d.micref)
when isnull(a.rad,'')!='' then isnull(c.radref,d.radref)
2025-11-17 17:36:07 +08:00
else '' end as ckz,e.bz as cp_bz from lab_resultmed a
join xm_info b on b.yq=a.yq and b.xmdh=a.xmdh
2025-11-20 17:41:15 +08:00
left join xm_med m on m.ywdh=a.ywdh
2025-11-17 17:36:07 +08:00
left join com_dict e on e.zdlb='germclass' and e.zddh=b.germclass
left join xm_meddetail c on b.germclass=c.xmdh and c.ywdh=a.ywdh
left join xm_meddetail d on d.ywzmc = '细菌' and d.yq=a.yq and d.ywdh=a.ywdh
2025-11-20 17:41:15 +08:00
where a.jyrq = #{jyrq} and a.yq = #{yq}
<if test= "ybh != null and ybh !=''" > and a.ybh = #{ybh}</if>
<if test= "xmdh != null and xmdh !=''" > and a.xmdh = #{xmdh}</if>
<if test= "xh != null" > and a.xh = #{xh}</if>
<if test= "ywdh != null and ywdh != ''" > and a.ywdh = #{ywdh}</if>
2025-11-05 16:53:46 +08:00
</select>
2025-11-18 17:50:48 +08:00
<select id= "getSampleListWSW" resultType= "com.czlis.common.core.domain.entity.lis.LabPat" >
<include refid= "selectLabPatVoWSW" > </include>
<where >
<if test= "yq != null and yq !=''" > and yq = #{yq}</if>
<if test= "jyrq != null" > and jyrq = #{jyrq}</if>
</where>
order by yq,jyrq DESC,right(space(20) + ybh,20) DESC
</select>
<select id= "getSampleListday" resultType= "com.czlis.common.core.domain.entity.lis.LabPat" >
<include refid= "selectLabPatVoWSW" > </include>
<where >
<if test= "days != null and days != 0" > and jyrq >=CONVERT(varchar(10),getdate() - ${days},120)</if>
<if test= "yq != null and yq !=''" > and yq = #{yq}</if>
</where>
order by yq,jyrq DESC,right(space(20) + ybh,20) DESC
</select>
2025-11-28 09:51:11 +08:00
<select id= "getBactMedium" resultType= "com.czlis.common.core.domain.entity.lis.BactMedium" >
SELECT * FROM bact_medium
<where >
<if test= "mediumno != null and mediumno !=''" > and mediumno >=#{mediumno}</if>
</where>
</select>
2025-10-29 17:59:05 +08:00
<select id= "getmedium" resultType= "com.czlis.liswork.pojo.DTO.MediumDTO" >
2025-11-28 12:20:27 +08:00
SELECT lab_germsheet_new.gsid,
lab_germsheet_new.jyrq,
2025-10-29 17:59:05 +08:00
lab_germsheet_new.yq,
lab_germsheet_new.ybh,
lab_germsheet_new.mediumno,
lab_germsheet_new.sheetdate,
lab_germsheet_new.sheetuser,
lab_germsheet_new.medium,
bact_medium.mediumname,
bact_medium.watchinterval,
bact_medium.conidtions,
bact_medium.culturehour,
bact_medium.comments
FROM lab_germsheet_new
left join bact_medium on
bact_medium.mediumno=lab_germsheet_new.mediumno
WHERE ( lab_germsheet_new.jyrq = #{jyrq} ) AND
( lab_germsheet_new.yq = #{yq}) AND
( lab_germsheet_new.ybh = #{ybh} )
</select>
<select id= "getmediumno" resultType= "String" >
select max(mediumno) from bact_specimen_medium a join lab_reqdetail b on a.req_itemid=b.sqxmdh where specimencode=#{yblx} and b.sqh=#{sqh};
</select>
<select id= "getmediumnox" resultType= "String" >
select max(mediumno) from bact_specimen_medium where specimencode=#{yblx} and req_itemid='-1';
</select>
<select id= "getBactMediumgroupdet" resultType= "com.czlis.common.core.domain.entity.lis.BactMediumgroupdet" >
SELECT * FROM bact_mediumgroupdet WHERE mediumgroupno = #{mediumno}
</select>
<insert id= "insertmedium" parameterType= "com.czlis.common.core.domain.entity.lis.LabGermsheetNew" >
2025-11-28 12:20:27 +08:00
insert into lab_germsheet_new (jyrq, yq,
ybh, mediumno, sheetdate,
sheetuser, medium, condtions,
smear, dyeing, colonyresult,
colonynum, otherresult)
values (#{jyrq}, #{yq},
#{ybh}, #{mediumno}, #{sheetdate},
#{sheetuser}, #{medium}, #{condtions},
#{smear}, #{dyeing}, #{colonyresult},
#{colonynum}, #{otherresult})
2025-10-29 17:59:05 +08:00
</insert>
2025-11-28 12:20:27 +08:00
<update id= "updatemedium" parameterType= "com.czlis.common.core.domain.entity.lis.LabGermsheetNew" >
update lab_germsheet_new
set jyrq = #{jyrq},
yq = #{yq},
ybh = #{ybh},
mediumno = #{mediumno},
sheetdate = #{sheetdate},
sheetuser = #{sheetuser},
medium = #{medium},
condtions = #{condtions},
smear = #{smear},
dyeing = #{dyeing},
colonyresult = #{colonyresult},
colonynum = #{colonynum},
otherresult = #{otherresult}
where gsid = #{gsid}
</update>
<delete id= "deletemedium" parameterType= "Long" >
delete from lab_germsheet_new where gsid = #{gsid}
</delete>
<delete id= "deletemediums" parameterType= "Long[]" >
DELETE FROM lab_germsheet_new WHERE gsid IN
<foreach collection= "array" item= "gsid" open= "(" separator= "," close= ")" >
#{gsid}
</foreach>
</delete>
2025-11-17 17:36:07 +08:00
<select id= "getXmMedDetail" resultType= "com.czlis.common.core.domain.entity.lis.XmMedDetail" >
SELECT * FROM xm_meddetail
2025-11-24 16:45:44 +08:00
where ywzmc = '细菌' and yq = #{yq} and xmdh = #{xmdh}
2025-11-17 17:36:07 +08:00
<if test= "yq != null and yq != ''" > and yq = #{yq} </if>
<if test= "xmdh != null and xmdh != ''" > and xmdh = #{xmdh}</if>
<if test= "ywdh != null and ywdh != ''" > and ywdh = #{ywdh}</if>
</select>
<select id= "getXmMedDetailNew" resultType= "com.czlis.common.core.domain.entity.lis.XmMedDetail" >
SELECT xm_meddetail.*
FROM xm_meddetail join xm_info on xm_info.germclass=xm_meddetail.xmdh
2025-11-24 16:45:44 +08:00
where xm_meddetail.yq = '_med_'
2025-11-17 17:36:07 +08:00
<if test= "yq != null and yq != ''" > and xm_info.yq = #{yq} </if>
<if test= "xmdh != null and xmdh != ''" > and xm_info.xmdh = #{xmdh}</if>
<if test= "ywdh != null and ywdh != ''" > and xm_meddetail.ywdh = #{ywdh}</if>
</select>
<select id= "getXmMedDetailBZ" resultType= "String" >
SELECT com_dict.bz from xm_info join com_dict
on zdlb = 'germclass' AND zddh =xm_info.germclass
<where >
<if test= "yq != null and yq != ''" > and xm_info.yq = #{yq} </if>
2025-11-24 16:45:44 +08:00
<if test= "xmdh != null and xmdh != ''" > and xm_info.xmdh = #{xmdh}</if>
2025-11-17 17:36:07 +08:00
</where>
2025-11-24 16:45:44 +08:00
</select>
<select id= "getmedgrouplist" resultType= "map" >
SELECT distinct ywzmc FROM xm_medgroup ORDER BY ywzmc
</select>
<select id= "getmedgroup" resultType= "com.czlis.common.core.domain.entity.lis.XmMedgroup" >
select xm_medgroup.*,xm_med.ywmc from xm_medgroup join xm_med on xm_med.ywdh=xm_medgroup.ywdh
2025-11-17 17:36:07 +08:00
<where >
2025-11-24 16:45:44 +08:00
<if test= "ywzmc != null and ywzmc != ''" > and xm_medgroup.ywzmc = #{ywzmc}</if>
2025-11-17 17:36:07 +08:00
</where>
2025-11-24 16:45:44 +08:00
order by xm_medgroup.xh
2025-11-17 17:36:07 +08:00
</select>
2025-10-29 17:59:05 +08:00
</mapper>