<?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.lyms.platform.permission.dao.master.MasterMysqlAntexcMapper">
<insert id="saveMysqlAntexc" parameterType="com.lyms.platform.permission.model.MysqlAntexc">
INSERT INTO c_antexc(
cid,
pid,
patientId,
checkTime,
nextCheckTime,
yn,
cDueWeek,
sieveStatus,
checkDoctor,
hospital,
pastHistory,
familyHistory,
personalHistory,
ymjzHistory,
ywgmHistory,
fksxHistory,
ysfyHistory,
cestationInfo,
pregnancyTimes,
prodTime,
delivery,
yinchan,
gongwaiyun,
planedProd,
abortion,
stillbirth,
stillChan,
neoDeath,
neoDeathTodo,
birthDefect,
birthDefectTodo,
height,
weight,
yqWeight,
ssy,
szy,
heart,
lungs,
gonggao,
fuwei,
edema,
quicken,
quickenRemark,
secondaryDiagnosisId,
diagnosis,
treatOpinion,
dirOpinion,
xhdb,
bxbjs,
platelet,
chgOther,
ndb,
nt,
urineKetone,
bld,
ncgOther,
abo,
rh,
bloodSugar,
xqgbzam,
xqgczam,
albumin,
totalBilirubin,
jhBilirubin,
bg,
ygbmky,
ygbmkt,
ygeky,
ygekt,
yghxkt,
ygbmkyValue,
ygbmktValue,
ygekyValue,
ygektValue,
yghxktValue,
xqjq,
xnsd,
syjg,
syjgSelect,
syjgValue,
hivkt,
hivktSelect,
hivktValue,
ydfmw,
ydqjd,
bChao,
created,
modified,
highriskDesc,
screenResult,
resultSupple,
vulva,
vagina,
cervical,
uterus,
fujian,
couponCode,
ft3,
ft4,
tsh,
tpaAb,
taAb,
atshr,
highRisk,
score
) VALUES (
#{cid},
#{pid},
#{patientId},
#{checkTime},
#{nextCheckTime},
#{yn},
#{cDueWeek},
#{sieveStatus},
#{checkDoctor},
#{hospital},
#{pastHistory},
#{familyHistory},
#{personalHistory},
#{ymjzHistory},
#{ywgmHistory},
#{fksxHistory},
#{ysfyHistory},
#{cestationInfo},
#{pregnancyTimes},
#{prodTime},
#{delivery},
#{yinchan},
#{gongwaiyun},
#{planedProd},
#{abortion},
#{stillbirth},
#{stillChan},
#{neoDeath},
#{neoDeathTodo},
#{birthDefect},
#{birthDefectTodo},
#{height},
#{weight},
#{yqWeight},
#{ssy},
#{szy},
#{heart},
#{lungs},
#{gonggao},
#{fuwei},
#{edema},
#{quicken},
#{quickenRemark},
#{secondaryDiagnosisId},
#{diagnosis},
#{treatOpinion},
#{dirOpinion},
#{xhdb},
#{bxbjs},
#{platelet},
#{chgOther},
#{ndb},
#{nt},
#{urineKetone},
#{bld},
#{ncgOther},
#{abo},
#{rh},
#{bloodSugar},
#{xqgbzam},
#{xqgczam},
#{albumin},
#{totalBilirubin},
#{jhBilirubin},
#{bg},
#{ygbmky},
#{ygbmkt},
#{ygeky},
#{ygekt},
#{yghxkt},
#{ygbmkyValue},
#{ygbmktValue},
#{ygekyValue},
#{ygektValue},
#{yghxktValue},
#{xqjq},
#{xnsd},
#{syjg},
#{syjgSelect},
#{syjgValue},
#{hivkt},
#{hivktSelect},
#{hivktValue},
#{ydfmw},
#{ydqjd},
#{bChao},
#{created},
#{modified},
#{highriskDesc},
#{screenResult},
#{resultSupple},
#{vulva},
#{vagina},
#{cervical},
#{uterus},
#{fujian},
#{couponCode},
#{ft3},
#{ft4},
#{tsh},
#{tpaAb},
#{taAb},
#{atshr},
#{highRisk},
#{score}
)
</insert>
<insert id="saveMysqlAntex" parameterType="com.lyms.platform.permission.model.MysqlAntex">
INSERT INTO c_antex(
pid,
patientId,
cid,
checkTime,
nextCheckTime,
yn,
cDueWeek,
sieveStatus,
checkDoctor,
hospital,
chiefComplaint,
weight,
ssy,
szy,
gonggao,
fuwei,
edema,
tireNumber,
quicken,
quickenRemark,
xhdb,
bxbjs,
platelet,
chgOther,
ndb,
nt,
urineKetone,
bld,
ncgOther,
abo,
rh,
bloodSugar,
bloodSugar2,
bloodSugar3,
bloodSugar4,
ttita,
totalThy,
ftita,
freeThy,
thyStim,
antGlan,
tmab,
thyPerAnt,
xqgbzam,
xqgczam,
albumin,
totalBilirubin,
jhBilirubin,
ygbmky,
ygbmkt,
ygeky,
ygekt,
yghxkt,
xqjq,
xnsd,
syjg,
hivkt,
diagnosis,
diagnosisOther,
secondaryDiagnosis,
secondaryDiagnosisId,
treatmentOpinion,
guide,
couponCode,
highRisk,
score,
bChao,
created,
modified,
highriskDesc,
screenResult,
resultSupple
)
VALUES
(
#{pid},
#{patientId},
#{cid},
#{checkTime},
#{nextCheckTime},
#{yn},
#{cDueWeek},
#{sieveStatus},
#{checkDoctor},
#{hospital},
#{chiefComplaint},
#{weight},
#{ssy},
#{szy},
#{gonggao},
#{fuwei},
#{edema},
#{tireNumber},
#{quicken},
#{quickenRemark},
#{xhdb},
#{bxbjs},
#{platelet},
#{chgOther},
#{ndb},
#{nt},
#{urineKetone},
#{bld},
#{ncgOther},
#{abo},
#{rh},
#{bloodSugar},
#{bloodSugar2},
#{bloodSugar3},
#{bloodSugar4},
#{ttita},
#{totalThy},
#{ftita},
#{freeThy},
#{thyStim},
#{antGlan},
#{tmab},
#{thyPerAnt},
#{xqgbzam},
#{xqgczam},
#{albumin},
#{totalBilirubin},
#{jhBilirubin},
#{ygbmky},
#{ygbmkt},
#{ygeky},
#{ygekt},
#{yghxkt},
#{xqjq},
#{xnsd},
#{syjg},
#{hivkt},
#{diagnosis},
#{diagnosisOther},
#{secondaryDiagnosis},
#{secondaryDiagnosisId},
#{treatmentOpinion},
#{guide},
#{couponCode},
#{highRisk},
#{score},
#{bChao},
#{created},
#{modified},
#{highriskDesc},
#{screenResult},
#{resultSupple}
)
</insert>
<delete id="deleteMysqlAntexc" parameterType="com.lyms.platform.permission.model.MysqlAntexc">
DELETE from c_antexc WHERE cid = #{cid}
</delete>
<delete id="deleteMysqlAntex" parameterType="com.lyms.platform.permission.model.MysqlAntex">
DELETE from c_antex WHERE cid = #{cid}
</delete>
<insert id="addTireData" parameterType="com.lyms.platform.permission.model.MysqlTireData">
INSERT INTO tiredata(
cid,
heartRate,
fetalPosition,
fetalPresentation,
vjoin
)VALUES (
#{cid},
#{heartRate},
#{fetalPosition},
#{fetalPresentation},
#{vjoin}
)
</insert>
<delete id="delTireData" parameterType="com.lyms.platform.permission.model.MysqlTireData">
DELETE from tiredata WHERE cid = #{cid}
</delete>
<insert id="saveMysqlMatdeliver" parameterType="com.lyms.platform.permission.model.MysqlMatdeliver">
INSERT INTO matdeliver(
pid,
patientId,
matdeliverId,
deliveryDate,
fmHospital,
deliverDoctor,
gcdfDoctorId,
tireNumber,
placenta,
inHospitalNo,
deliveryMode,
operationCause,
one,
two,
three,
totalProcess,
perinealCondition,
siLielevel,
needleNum,
created,
modified,
yn,
maternalInfo,
deathCause,
ssy,
szy,
ssy2h,
szy2h,
breath,
pulse,
oHloseBloodL,
tHloseBloodL,
rHloseBloodL,
sHloseBloodL,
loseBloodCause,
ocs
)VALUES (
#{pid},
#{patientId},
#{matdeliverId},
#{deliveryDate},
#{fmHospital},
#{deliverDoctor},
#{gcdfDoctorId},
#{tireNumber},
#{placenta},
#{inHospitalNo},
#{deliveryMode},
#{operationCause},
#{one},
#{two},
#{three},
#{totalProcess},
#{perinealCondition},
#{siLielevel},
#{needleNum},
#{created},
#{modified},
#{yn},
#{maternalInfo},
#{deathCause},
#{ssy},
#{szy},
#{ssy2h},
#{szy2h},
#{breath},
#{pulse},
#{oHloseBloodL},
#{tHloseBloodL},
#{rHloseBloodL},
#{sHloseBloodL},
#{loseBloodCause},
#{ocs}
)
</insert>
<delete id="deleteMysqlMatdeliver" parameterType="com.lyms.platform.permission.model.MysqlMatdeliver">
DELETE from matdeliver WHERE matdeliverId = #{matdeliverId}
</delete>
<insert id="saveMysqlMatdeliverBaby" parameterType="com.lyms.platform.permission.model.MysqlMatdeliverBaby">
INSERT INTO matdeliver_baby(
matdeliverId,
dueTime,
pregnancyOut,
deformity,
jxxq,
babyGender,
babyWeight,
babyHeight,
babyHealthy,
apgarScore,
asphyxiaM,
contactStartM,
contactM,
earlySuck
)VALUES (
#{matdeliverId},
#{dueTime},
#{pregnancyOut},
#{deformity},
#{jxxq},
#{babyGender},
#{babyWeight},
#{babyHeight},
#{babyHealthy},
#{apgarScore},
#{asphyxiaM},
#{contactStartM},
#{contactM},
#{earlySuck}
)
</insert>
<delete id="deleteMysqlMatdeliverBaby" parameterType="com.lyms.platform.permission.model.MysqlMatdeliver">
DELETE from matdeliver_baby WHERE matdeliverId = #{matdeliverId}
</delete>
<insert id="saveMysqlMatdeliverPlacentas" parameterType="com.lyms.platform.permission.model.MysqlMatdeliverPlacentas">
INSERT INTO matdeliver_placentas(
matdeliverId,
tpmcType,
mcType,
tpSize,
tpWeight,
umbilicalCordLength,
umbilicalCordEx,
umbilicalCordExType
)VALUES (
#{matdeliverId},
#{tpmcType},
#{mcType},
#{tpSize},
#{tpWeight},
#{umbilicalCordLength},
#{umbilicalCordEx},
#{umbilicalCordExType}
)
</insert>
<delete id="deleteMysqlMatdeliverPlacentas" parameterType="com.lyms.platform.permission.model.MysqlMatdeliver">
DELETE from matdeliver_placentas WHERE matdeliverId = #{matdeliverId}
</delete>
<insert id="saveMysqlMatdeliverTire" parameterType="com.lyms.platform.permission.model.MysqlMatdeliverTire">
INSERT INTO matdeliver_tire(
matdeliverId,
heartRate,
fetalPosition,
fetalPresentation
)VALUES (
#{matdeliverId},
#{heartRate},
#{fetalPosition},
#{fetalPresentation}
)
</insert>
<delete id="deleteMysqlMatdeliverTire" parameterType="com.lyms.platform.permission.model.MysqlMatdeliver">
DELETE from matdeliver_tire WHERE matdeliverId = #{matdeliverId}
</delete>
<insert id="saveMysqlBaby" parameterType="com.lyms.platform.permission.model.MysqlBaby">
INSERT INTO lyms_baby(
babyId,
babyName,
sex,
babyBirthday,
homeAddress,
babyCardNo,
fileCode,
mommyName,
mommyCertificateType,
mommyCertificateNum,
mommyPhone,
mommyBirthday,
mommyLevel,
liveType,
mommyProfessionType,
fatherName,
fatherPhone,
fatherBirthday,
fatherLevel,
fatherProfessionType,
dueWeek,
dueType,
fetusCount,
babyWeight,
babyHeight,
babyHead,
deliverOrg,
malformation,
mommyHighRiskReason,
highRisk,
highRiskInfo,
weakSon,
weakSonInfo,
babyDiagnosis,
diagnose,
apgarScore,
esfs,
txng,
eljy,
kouq,
isBCG,
bCGVaccinDate,
bCGInjectUserName,
isHBV,
hbvVaccinDate,
bCGAndHBVVaccinationDosage,
hbvInjectUserName,
isHBIG,
hBIGInjectDate,
hBIGInjectDosage,
hBIGInjectUserName,
buildDoctor,
buildDate,
vcCardNo,
remark,
couponCode,
hospitalId,
created,
modified
)VALUES (
#{babyId},
#{babyName},
#{sex},
#{babyBirthday},
#{homeAddress},
#{babyCardNo},
#{fileCode},
#{mommyName},
#{mommyCertificateType},
#{mommyCertificateNum},
#{mommyPhone},
#{mommyBirthday},
#{mommyLevel},
#{liveType},
#{mommyProfessionType},
#{fatherName},
#{fatherPhone},
#{fatherBirthday},
#{fatherLevel},
#{fatherProfessionType},
#{dueWeek},
#{dueType},
#{fetusCount},
#{babyWeight},
#{babyHeight},
#{babyHead},
#{deliverOrg},
#{malformation},
#{mommyHighRiskReason},
#{highRisk},
#{highRiskInfo},
#{weakSon},
#{weakSonInfo},
#{babyDiagnosis},
#{diagnose},
#{apgarScore},
#{esfs},
#{txng},
#{eljy},
#{kouq},
#{isBCG},
#{bCGVaccinDate},
#{bCGInjectUserName},
#{isHBV},
#{hbvVaccinDate},
#{bCGAndHBVVaccinationDosage},
#{hbvInjectUserName},
#{isHBIG},
#{hBIGInjectDate},
#{hBIGInjectDosage},
#{hBIGInjectUserName},
#{buildDoctor},
#{buildDate},
#{vcCardNo},
#{remark},
#{couponCode},
#{hospitalId},
#{created},
#{modified}
)
</insert>
<delete id="deleteMysqlBaby" parameterType="com.lyms.platform.permission.model.MysqlBaby">
DELETE from lyms_baby WHERE babyId = #{babyId}
</delete>
<insert id="saveMysqlBabyCheck" parameterType="com.lyms.platform.permission.model.MysqlBabyCheck">
INSERT INTO lyms_babycheck(
checkId,
buildId,
checkDate,
checkDoctor,
checkMonthAge,
checkHospital,
nextCheckDate,
nextCheckMonthAge,
mainFoster,
feedType,
pee,
excrement,
sleep,
activity,
vitaminD,
assistFood,
homeMeasure,
morbidity,
drugGllergic,
temperature,
weight,
height,
head,
chestw,
heightWeight,
growthEvaluate,
weightEvaluate,
heightEvaluate,
headEvaluate,
bilirubin,
bregma,
bregmaValue,
tooth,
faceColor,
skin,
eye,
eyesight,
ear,
hearing,
neck,
chest,
belly,
spineFours,
portaGenitals,
stepStatus,
stoopStatus,
stoopSign,
nerve,
bonez,
hipJoint,
hemoglobin,
hCheckStatus,
whiteCell,
platelet,
otherBlood,
urineProtein,
urineSugar,
urineAcetone,
hematuria,
otherUrine,
checkDiagnose,
handlSuggest,
guideSuggest,
highRisk,
sportsEvaluation,
heartAction,
askOther,
babyCheckOther,
assistCheckOther,
navel,
couponCode,
cnqk,
mtcnNum,
fstj,
xbNum,
dbNum,
dbDayNum,
qdtlTime,
pfhrTime,
wssAd,
douhbqk,
kq,
cyNum,
qcNum,
btt,
xf,
xlClass,
xldq,
nd,
ygbmky,
ygbmkt,
ygeky,
ygekt,
yghxkt,
wlTong,
wlXin,
wlGai,
wlMei,
wlTie,
wlQian,
wlGe,
wlMeng,
ygbmkyNum,
ygbmktNum,
ygekyNum,
ygektNum,
yghxktNum,
xqgbzam,
xqgczam,
albumin,
totalBi,
jhBilir,
bcgYs,
bcgXz,
bcgHbx,
bcgBxb,
bcgSpxb,
bcgZlxb,
bcgDfkl,
bcgZfkl,
bcgJxw,
bcgZwxw,
bcgZbj,
bcgZj,
bcgJsc,
bcgYc,
bcgQw,
wssa,
jcwd,
wsse,
rzfx,
chatSc,
yyfyTest,
zlcp,
gdzsc,
ssfx,
gjzh,
rxnl,
xxbsc,
zlsc,
qtfz,
highRiskInfo,
weakSon,
weakSonInfo,
eyeAppearance,
eyeRedReflex,
eyeDioptroscopy,
eyeAdvice,
eyeAdviceName,
eyeGuideSuggestions,
abnormalSize,
okSize,
exerciseIA,
exerciseDQ,
movementIA,
movementDQ,
adaptationIA,
adaptationDQ,
languageIA,
languageDQ,
socialContactIA,
socialContactDQ,
nextCheckItem,
diseases,
zlcpType,
jcz,
tcType,
slscx
)VALUES (
#{checkId},
#{buildId},
#{checkDate},
#{checkDoctor},
#{checkMonthAge},
#{checkHospital},
#{nextCheckDate},
#{nextCheckMonthAge},
#{mainFoster},
#{feedType},
#{pee},
#{excrement},
#{sleep},
#{activity},
#{vitaminD},
#{assistFood},
#{homeMeasure},
#{morbidity},
#{drugGllergic},
#{temperature},
#{weight},
#{height},
#{head},
#{chestw},
#{heightWeight},
#{growthEvaluate},
#{weightEvaluate},
#{heightEvaluate},
#{headEvaluate},
#{bilirubin},
#{bregma},
#{bregmaValue},
#{tooth},
#{faceColor},
#{skin},
#{eye},
#{eyesight},
#{ear},
#{hearing},
#{neck},
#{chest},
#{belly},
#{spineFours},
#{portaGenitals},
#{stepStatus},
#{stoopStatus},
#{stoopSign},
#{nerve},
#{bonez},
#{hipJoint},
#{hemoglobin},
#{hCheckStatus},
#{whiteCell},
#{platelet},
#{otherBlood},
#{urineProtein},
#{urineSugar},
#{urineAcetone},
#{hematuria},
#{otherUrine},
#{checkDiagnose},
#{handlSuggest},
#{guideSuggest},
#{highRisk},
#{sportsEvaluation},
#{heartAction},
#{askOther},
#{babyCheckOther},
#{assistCheckOther},
#{navel},
#{couponCode},
#{cnqk},
#{mtcnNum},
#{fstj},
#{xbNum},
#{dbNum},
#{dbDayNum},
#{qdtlTime},
#{pfhrTime},
#{wssAd},
#{douhbqk},
#{kq},
#{cyNum},
#{qcNum},
#{btt},
#{xf},
#{xlClass},
#{xldq},
#{nd},
#{ygbmky},
#{ygbmkt},
#{ygeky},
#{ygekt},
#{yghxkt},
#{wlTong},
#{wlXin},
#{wlGai},
#{wlMei},
#{wlTie},
#{wlQian},
#{wlGe},
#{wlMeng},
#{ygbmkyNum},
#{ygbmktNum},
#{ygekyNum},
#{ygektNum},
#{yghxktNum},
#{xqgbzam},
#{xqgczam},
#{albumin},
#{totalBi},
#{jhBilir},
#{bcgYs},
#{bcgXz},
#{bcgHbx},
#{bcgBxb},
#{bcgSpxb},
#{bcgZlxb},
#{bcgDfkl},
#{bcgZfkl},
#{bcgJxw},
#{bcgZwxw},
#{bcgZbj},
#{bcgZj},
#{bcgJsc},
#{bcgYc},
#{bcgQw},
#{wssa},
#{jcwd},
#{wsse},
#{rzfx},
#{chatSc},
#{yyfyTest},
#{zlcp},
#{gdzsc},
#{ssfx},
#{gjzh},
#{rxnl},
#{xxbsc},
#{zlsc},
#{qtfz},
#{highRiskInfo},
#{weakSon},
#{weakSonInfo},
#{eyeAppearance},
#{eyeRedReflex},
#{eyeDioptroscopy},
#{eyeAdvice},
#{eyeAdviceName},
#{eyeGuideSuggestions},
#{abnormalSize},
#{okSize},
#{exerciseIA},
#{exerciseDQ},
#{movementIA},
#{movementDQ},
#{adaptationIA},
#{adaptationDQ},
#{languageIA},
#{languageDQ},
#{socialContactIA},
#{socialContactDQ},
#{nextCheckItem},
#{diseases},
#{zlcpType},
#{jcz},
#{tcType},
#{slscx}
)
</insert>
<delete id="deleteMysqlBabyCheck" parameterType="com.lyms.platform.permission.model.MysqlBabyCheck">
DELETE from lyms_babycheck WHERE checkId = #{checkId}
</delete>
<insert id="addRisk" parameterType="com.lyms.platform.permission.model.MysqlRisk">
INSERT into risk
(
name,
color,
score,
cid,
rid
)
values
(
#{name},
#{color},
#{score},
#{cid},
#{rid}
)
</insert>
<insert id="savePatientsToMysql" parameterType="com.lyms.platform.permission.model.ReportPatients">
INSERT INTO report_patients(
pid,
patientId,
cardNo,
type,
lastMenses,
address,
provinceId,
cityId,
areaId,
streetId,
addressPostRest,
provincePostRestId,
cityPostRestId,
areaPostRestId,
streetPostRestId,
addressRegister,
provinceRegisterId,
cityRegisterId,
areaRegisterId,
streetRegisterId,
hospitalId,
bookbuildingDate,
bookbuildingDoctor,
created,
modified,
birth,
username,
yn,
phone,
pcensusTypeId,
pliveTypeId,
enable,
riskLevelId,
buildType,
isAutoFm
) VALUES (
#{pid},
#{patientId},
#{cardNo},
#{type},
#{lastMenses},
#{address},
#{provinceId},
#{cityId},
#{areaId},
#{streetId},
#{addressPostRest},
#{provincePostRestId},
#{cityPostRestId},
#{areaPostRestId},
#{streetPostRestId},
#{addressRegister},
#{provinceRegisterId},
#{cityRegisterId},
#{areaRegisterId},
#{streetRegisterId},
#{hospitalId},
#{bookbuildingDate},
#{bookbuildingDoctor},
#{created},
#{modified},
#{birth},
#{username},
#{yn},
#{phone},
#{pcensusTypeId},
#{pliveTypeId},
#{enable},
#{riskLevelId},
#{buildType},
#{isAutoFm}
)
</insert>
<delete id="deletePatientsToMysql" parameterType="com.lyms.platform.permission.model.ReportPatients">
DELETE from report_patients WHERE patientId = #{patientId}
</delete>
<insert id="saveAntExChuToMysql" parameterType="com.lyms.platform.permission.model.ReportAntexchu">
INSERT INTO report_antexchu(
cid,
checkTime,
nextCheckTime,
hospitalId,
pid,
parentId,
created,
sourceId,
type,
ygbmky,
hivkt,
syjg
) VALUES (
#{cid},
#{checkTime},
#{nextCheckTime},
#{hospitalId},
#{pid},
#{parentId},
#{created},
#{sourceId},
#{type},
#{ygbmky},
#{hivkt},
#{syjg}
)
</insert>
<delete id="deleteAntExChuToMysql" parameterType="com.lyms.platform.permission.model.ReportAntexchu">
DELETE from report_antexchu WHERE cid = #{cid}
</delete>
<insert id="saveMatdeliverToMysql" parameterType="com.lyms.platform.permission.model.ReportMatdeliver">
INSERT INTO report_matdeliver(
mid,
parentId,
pid,
dueDate1,
created,
fmHospital,
hospitalId,
sourceId,
lastMenses,
fmDoctor
) VALUES (
#{mid},
#{parentId},
#{pid},
#{dueDate1},
#{created},
#{fmHospital},
#{hospitalId},
#{sourceId},
#{lastMenses},
#{fmDoctor}
)
</insert>
<delete id="deleteMatdeliverToMysql" parameterType="com.lyms.platform.permission.model.ReportMatdeliver">
DELETE from report_matdeliver WHERE mid = #{mid}
</delete>
<insert id="saveRiskLevelToMysql" parameterType="com.lyms.platform.permission.model.ReportRiskLevel">
INSERT INTO report_risk_level(
riskLevelId,
riskLevel,
type,
foreignId,
sourceId,
patientId,
hospitalId
) VALUES (
#{riskLevelId},
#{riskLevel},
#{type},
#{foreignId},
#{sourceId},
#{patientId},
#{hospitalId}
)
</insert>
<delete id="deleteRiskLevelToMysql" parameterType="com.lyms.platform.permission.model.ReportRiskLevel">
DELETE from report_risk_level WHERE foreignId = #{foreignId}
</delete>
<select id="getBuildCount" resultType="java.util.Map" parameterType="java.util.Map">
select count(p.patientId) as buildCount,o.id as hospitalId,o.name as hospitalName,o.province_id as provinceId,o.area_id as areaId,o.city_id as cityId from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
GROUP BY o.name
</select>
<select id="getBulidCheckPersonCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(DISTINCT(r.sourceId)) as bulidCheckPersonCount,o.name as hospitalName from report_patients p
INNER JOIN report_antexchu r on p.patientId = r.sourceId
INNER JOIN organization o on p.hospitalId=o.id
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
GROUP BY o.name
</select>
<select id="getBulidCheckNumCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(r.sourceId) as bulidCheckNumCount,o.name as hospitalName from report_patients p
INNER JOIN report_antexchu r on p.patientId = r.sourceId
INNER JOIN organization o on p.hospitalId=o.id
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
GROUP BY o.name
</select>
<select id="getCheckPersonCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(DISTINCT(r.sourceId)) as checkPersonCount,o.name as hospitalName from report_patients p
INNER JOIN report_antexchu r on p.patientId = r.sourceId
INNER JOIN organization o on p.hospitalId=o.id
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and r.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and r.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
GROUP BY o.name
</select>
<select id="getMatDeliverCount" resultType="java.util.Map" parameterType="java.util.Map">
select count(m.sourceId) as matDeliverCount,o.name as hospitalName from report_matdeliver m
INNER JOIN report_patients p on m.sourceId=p.patientId
INNER JOIN organization o on p.hospitalId=o.id
where p.type =3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
GROUP BY o.name
</select>
<select id="getLiveCount" resultType="java.util.Map" parameterType="java.util.Map">
select count(p.patientId) as liveCount,o.name as hospitalName from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
where p.pliveTypeId='57624c5e0cf23d4631523ea2' and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
GROUP BY o.name
</select>
<select id="getOrgCheckPersonCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(r.sourceId)) as orgCheckPersonCount,o.name as hospitalName,o.id as hospitalId from report_patients p
INNER JOIN report_antexchu r on p.patientId=r.sourceId
INNER JOIN organization o on o.id=r.hospitalId
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getOrgCheckNumCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(r.sourceId) as orgCheckNumCount,o.name as hospitalName,o.id as hospitalId from report_patients p
INNER JOIN report_antexchu r on (p.patientId=r.sourceId or p.patientId=r.parentId)
INNER JOIN organization o on o.id=r.hospitalId
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getRiskPersonCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as riskPersonCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel > 1
GROUP BY o.name
</select>
<select id="getColorYellowCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(l.sourceId) as colorYellowCount,o.name as hospitalName,o.id as hospitalId
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel = 2
GROUP BY o.name
</select>
<select id="getColorOrangeCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(l.sourceId) as colorOrangeCount,o.name as hospitalName,o.id as hospitalId
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel = 3
GROUP BY o.name
</select>
<select id="getColorRedCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(l.sourceId) as colorRedCount,o.name as hospitalName,o.id as hospitalId
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel = 4
GROUP BY o.name
</select>
<select id="getColorVioletCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(l.sourceId) as colorVioletCount,o.name as hospitalName,o.id as hospitalId
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel = 5
GROUP BY o.name
</select>
<select id="getColorGreenCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(l.sourceId) as colorGreenCount,o.name as hospitalName,o.id as hospitalId
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel = 1
GROUP BY o.name
</select>
<select id="getOneRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as oneRiskCount,tp.name as hospitalName,tp.id as hospitalId from (select p.patientId,o.id,o.name from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
where p.type=1 and p.enable is NULL and p.hospitalId=#{hospitalId}
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN report_antexchu a
on tp.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t,r.type,r.riskLevel from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=1
) l on l.foreignId = a.cid GROUP BY tp.name
</select>
<select id="getTwoRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as twoRiskCount,tp.name as hospitalName,tp.id as hospitalId from (select p.patientId,o.id,o.name from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
where p.type=1 and p.enable is NULL and p.hospitalId=#{hospitalId}
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN report_antexchu a
on tp.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t,r.type,r.riskLevel from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=2
) l on l.foreignId = a.cid GROUP BY tp.name
</select>
<select id="getThreeRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as threeRiskCount,tp.name as hospitalName,tp.id as hospitalId from (select p.patientId,o.id,o.name from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
where p.type=1 and p.enable is NULL and p.hospitalId=#{hospitalId}
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN report_antexchu a
on tp.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t,r.type,r.riskLevel from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=3
) l on l.foreignId = a.cid GROUP BY tp.name
</select>
<select id="getFourRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as fourRiskCount,tp.name as hospitalName,tp.id as hospitalId from (select p.patientId,o.id,o.name from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
where p.type=1 and p.enable is NULL and p.hospitalId=#{hospitalId}
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN report_antexchu a
on tp.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t,r.type,r.riskLevel from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=3
) l on l.foreignId = a.cid GROUP BY tp.name
</select>
<!-- -->
<select id="getCheckOrgCheckPersonCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(c.sourceId)) as checkOrgCheckPersonCount ,o.name as hospitalName,o.id as hospitalId from report_antexchu c
INNER JOIN report_patients p on c.sourceId = p.patientId
INNER JOIN organization o on c.hospitalId=o.id
where p.type = 1 and p.enable is null
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and c.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and c.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getBeforeBuildCheckPersonCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(c.sourceId)) as beforeBuildCheckPersonCount ,o.name as hospitalName,o.id as hospitalId from report_antexchu c
INNER JOIN report_patients p on c.sourceId = p.patientId
INNER JOIN organization o on c.hospitalId=o.id
where p.type = 1 and p.enable is null
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate <![CDATA[ < ]]> #{startDate}
</if>
<if test="startDate != null">
and c.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and c.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getCheckRiskPersonCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as checkRiskPersonCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN
report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel > 1
<if test="startDate != null">
and l.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and l.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getCheckColorYellowCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as checkColorYellowCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN
report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel = 2
<if test="startDate != null">
and l.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and l.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getCheckColorOrangeCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as checkColorOrangeCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN
report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel = 3
<if test="startDate != null">
and l.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and l.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getCheckColorRedCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as checkColorRedCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN
report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel = 4
<if test="startDate != null">
and l.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and l.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getCheckColorVioletCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as checkColorVioletCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN
report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel = 5
<if test="startDate != null">
and l.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and l.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getCheckColorGreenCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as checkColorGreenCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=1 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN
report_risk_level r on r.foreignId = l.cid
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and l.type=1 and riskLevel = 1
<if test="startDate != null">
and l.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and l.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getCheckOneRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as checkOneRiskCount,o.name as hospitalName,o.id as hospitalId from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
INNER JOIN report_antexchu a
on p.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=1
) l on l.foreignId = a.cid
where p.hospitalId=#{hospitalId} and p.type=1 and p.enable is NULL
<if test="startDate != null">
and a.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and a.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getCheckTwoRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as checkTwoRiskCount,o.name as hospitalName,o.id as hospitalId from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
INNER JOIN report_antexchu a
on p.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=2
) l on l.foreignId = a.cid
where p.hospitalId=#{hospitalId} and p.type=1 and p.enable is NULL
<if test="startDate != null">
and a.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and a.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getCheckThreeRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as checkThreeRiskCount,o.name as hospitalName,o.id as hospitalId from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
INNER JOIN report_antexchu a
on p.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=3
) l on l.foreignId = a.cid
where p.hospitalId=#{hospitalId} and p.type=1 and p.enable is NULL
<if test="startDate != null">
and a.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and a.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getCheckFourRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as checkFourRiskCount,o.name as hospitalName,o.id as hospitalId from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
INNER JOIN report_antexchu a
on p.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=4
) l on l.foreignId = a.cid
where p.hospitalId=#{hospitalId} and p.type=1 and p.enable is NULL
<if test="startDate != null">
and a.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and a.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getMatDeliverOrgCheckPersonCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(f.sourceId) as matDeliverOrgCheckPersonCount,o.name as hospitalName,o.id as hospitalId
from report_matdeliver f
INNER JOIN report_patients p on f.sourceId=p.patientId
INNER JOIN organization o on f.fmHospital=o.id
where p.type=3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.name
</select>
<select id="getMatDeliverRiskPersonCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as matDeliverRiskPersonCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN report_matdeliver m on m.sourceId=tp.patientId
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and r.riskLevel > 1 and l.type=1 GROUP BY o.name
</select>
<select id="getMatDeliverColorYellowCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as matDeliverColorYellowCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN report_matdeliver m on m.sourceId=tp.patientId
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and r.riskLevel = 2 and l.type=1 GROUP BY o.name
</select>
<select id="getMatDeliverColorOrangeCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as matDeliverColorOrangeCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN report_matdeliver m on m.sourceId=tp.patientId
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and r.riskLevel = 3 and l.type=1 GROUP BY o.name
</select>
<select id="getMatDeliverColorRedCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as matDeliverColorRedCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN report_matdeliver m on m.sourceId=tp.patientId
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and r.riskLevel = 4 and l.type=1 GROUP BY o.name
</select>
<select id="getMatDeliverColorVioletCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as matDeliverColorVioletCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN report_matdeliver m on m.sourceId=tp.patientId
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and r.riskLevel = 5 and l.type=1 GROUP BY o.name
</select>
<select id="getMatDeliverColorGreenCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(DISTINCT(l.sourceId))as matDeliverColorGreenCount,o.id as hospitalId,o.name as hospitalName
from (select p.patientId from report_patients p
where p.type=3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN
report_antexchu l on tp.patientId=l.sourceId
INNER JOIN report_risk_level r on r.foreignId = l.cid
INNER JOIN report_matdeliver m on m.sourceId=tp.patientId
INNER JOIN organization o on l.hospitalId=o.id
where r.type = 2 and r.riskLevel = 1 and l.type=1 GROUP BY o.name
</select>
<select id="getMatDeliverOneRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as matDeliverOneRiskCount,tp.name as hospitalName,tp.id as hospitalId from (select p.patientId,o.id,o.name from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
where p.type=3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN report_antexchu a
on tp.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t,r.type,r.riskLevel from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=1
) l on l.foreignId = a.cid GROUP BY tp.name
</select>
<select id="getMatDeliverTwoRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as matDeliverTwoRiskCount,tp.name as hospitalName,tp.id as hospitalId from (select p.patientId,o.id,o.name from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
where p.type=3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN report_antexchu a
on tp.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t,r.type,r.riskLevel from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=2
) l on l.foreignId = a.cid GROUP BY tp.name
</select>
<select id="getMatDeliverThreeRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as matDeliverThreeRiskCount,tp.name as hospitalName,tp.id as hospitalId from (select p.patientId,o.id,o.name from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
where p.type=3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN report_antexchu a
on tp.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t,r.type,r.riskLevel from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=3
) l on l.foreignId = a.cid GROUP BY tp.name
</select>
<select id="getMatDeliverFourRiskCounts" resultType="java.util.Map" parameterType="java.util.Map">
select count(a.sourceId) as matDeliverFourRiskCount,tp.name as hospitalName,tp.id as hospitalId from (select p.patientId,o.id,o.name from report_patients p
INNER JOIN organization o on p.hospitalId=o.id
where p.type=3 and p.enable is NULL
<if test="hospitalId != null and hospitalId != ''">
and p.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and p.bookbuildingDate >= #{startDate}
</if>
<if test="endDate != null">
and p.bookbuildingDate <![CDATA[ <= ]]> #{endDate}
</if>
) tp
INNER JOIN report_antexchu a
on tp.patientId=a.sourceId
INNER JOIN
(
SELECT r.foreignId,count(r.foreignId) as t,r.type,r.riskLevel from report_risk_level r
where r.type = 2 and r.riskLevel >1 group by r.foreignId having t=4
) l on l.foreignId = a.cid GROUP BY tp.name
</select>
<select id="getOrganizations" resultType="com.lyms.platform.permission.model.Organization" parameterType="java.util.Map">
select o.id,o.name,o.province_id as provinceId,o.city_id as cityId,o.area_id as areaId from organization o where
o.yn=1 and locate('卫生服务站',o.name) = 0 and locate('卫生院',o.name) = 0 and locate('社区卫生服务中心',o.name) = 0
and locate('区卫生和计划生育局',o.name) = 0 and locate('计划生育服务中心',o.name) = 0
<if test="hospitalId != null and hospitalId != ''">
and o.id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
</select>
<select id="getFirstCheckCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(c.id) as firstCheckCount,c.hospitalId from report_antexchu c left JOIN report_patients p
on c.sourceId = p.patientId INNER JOIN organization o
on o.id = c.hospitalId where p.type=1 and c.type=1
<if test="hospitalId != null and hospitalId != ''">
and o.id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and c.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and c.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
<if test="startDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) >= #{startDay}
</if>
<if test="endDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) <![CDATA[ <= ]]> #{endDay}
</if>
GROUP BY o.id
</select>
<select id="getIsHivktCheckCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(c.id) as isHivktCheckCount,c.hospitalId from report_antexchu c left JOIN report_patients p
on c.sourceId = p.patientId INNER JOIN organization o
on o.id = c.hospitalId where c.hivkt is not null and p.type=1 and c.type=1
<if test="hospitalId != null and hospitalId != ''">
and o.id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and c.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and c.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
<if test="startDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) >= #{startDay}
</if>
<if test="endDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) <![CDATA[ <= ]]> #{endDay}
</if>
GROUP BY o.id
</select>
<select id="getHasHivktCheckCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(c.id) as hasHivktCheckCount,c.hospitalId from report_antexchu c left JOIN report_patients p
on c.sourceId = p.patientId INNER JOIN organization o
on o.id = c.hospitalId where c.hivkt='yang' and p.type=1 and c.type=1
<if test="hospitalId != null and hospitalId != ''">
and o.id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and c.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and c.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
<if test="startDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) >= #{startDay}
</if>
<if test="endDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) <![CDATA[ <= ]]> #{endDay}
</if>
GROUP BY o.id
</select>
<select id="getIsSyjgCheckCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(c.id) as isSyjgCheckCount,c.hospitalId from report_antexchu c left JOIN report_patients p
on c.sourceId = p.patientId INNER JOIN organization o
on o.id = c.hospitalId where c.syjg is not null and p.type=1 and c.type=1
<if test="hospitalId != null and hospitalId != ''">
and o.id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and c.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and c.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
<if test="startDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) >= #{startDay}
</if>
<if test="endDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) <![CDATA[ <= ]]> #{endDay}
</if>
GROUP BY o.id
</select>
<select id="getHasSyjgCheckCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(c.id) as hasSyjgCheckCount,c.hospitalId from report_antexchu c left JOIN report_patients p
on c.sourceId = p.patientId INNER JOIN organization o
on o.id = c.hospitalId where c.syjg='yang' and p.type=1 and c.type=1
<if test="hospitalId != null and hospitalId != ''">
and o.id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and c.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and c.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
<if test="startDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) >= #{startDay}
</if>
<if test="endDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) <![CDATA[ <= ]]> #{endDay}
</if>
GROUP BY o.id
</select>
<select id="getIsYgbmkyCheckCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(c.id) as isYgbmkyCheckCount,c.hospitalId from report_antexchu c left JOIN report_patients p
on c.sourceId = p.patientId INNER JOIN organization o
on o.id = c.hospitalId where c.ygbmky is not null and p.type=1 and c.type=1
<if test="hospitalId != null and hospitalId != ''">
and o.id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and c.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and c.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
<if test="startDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) >= #{startDay}
</if>
<if test="endDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) <![CDATA[ <= ]]> #{endDay}
</if>
GROUP BY o.id
</select>
<select id="getHasYgbmkyCheckCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(c.id) as hasYgbmkyCheckCount,c.hospitalId from report_antexchu c left JOIN report_patients p
on c.sourceId = p.patientId INNER JOIN organization o
on o.id = c.hospitalId where c.ygbmky='yang' and p.type=1 and c.type=1
<if test="hospitalId != null and hospitalId != ''">
and o.id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and c.checkTime >= #{startDate}
</if>
<if test="endDate != null">
and c.checkTime <![CDATA[ <= ]]> #{endDate}
</if>
<if test="startDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) >= #{startDay}
</if>
<if test="endDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) <![CDATA[ <= ]]> #{endDay}
</if>
GROUP BY o.id
</select>
<select id="getLisMatdeliverCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(f.id) as matdeliverCount ,o.id as hospitalId from report_matdeliver f INNER JOIN organization o on f.fmHospital = o.id
<if test="hospitalId != null and hospitalId != ''">
and o.id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and f.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and f.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
group by o.id
</select>
<select id="getMatdeliverHivktCheckCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(f.id) as matdeliverHivktCheckCount ,o.id as hospitalId from report_matdeliver f INNER JOIN organization o on f.fmHospital = o.id
INNER JOIN report_antexchu c on c.sourceId= f.sourceId
INNER JOIN report_patients p on c.sourceId = p.patientId
where c.hivkt is not null and c.type =1
<if test="hospitalId != null and hospitalId != ''">
and f.fmHospital = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and f.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and f.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
<if test="startDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) >= #{startDay}
</if>
<if test="endDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) <![CDATA[ <= ]]> #{endDay}
</if>
group by o.id
</select>
<select id="getMatdeliverHivktCheckzqCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(f.id) as matdeliverHivktCheckzqCount ,o.id as hospitalId from report_matdeliver f INNER JOIN organization o on f.fmHospital = o.id
INNER JOIN (select a.sourceId,a.checkTime from report_antexchu a where a.type =1 and a.hivkt is not null
) c on c.sourceId= f.sourceId
where DATEDIFF(c.checkTime,f.lastMenses) <![CDATA[ <= ]]> 83
<if test="hospitalId != null and hospitalId != ''">
and f.fmHospital = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and f.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and f.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.id
</select>
<select id="getHasMatdeliverHivktCheckzqCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(f.id) as hasMatdeliverHivktCheckzqCount ,o.id as hospitalId from report_matdeliver f INNER JOIN organization o on f.fmHospital = o.id
INNER JOIN (select a.sourceId,a.checkTime from report_antexchu a where a.type =1 and a.hivkt ='yang'
) c on c.sourceId= f.sourceId
where DATEDIFF(c.checkTime,f.lastMenses) <![CDATA[ <= ]]> 83
<if test="hospitalId != null and hospitalId != ''">
and f.fmHospital = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and f.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and f.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.id
</select>
<select id="getMatdeliverSyjgCheckCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(f.id) as matdeliverSyjgCheckCount ,o.id as hospitalId from report_matdeliver f INNER JOIN organization o on f.fmHospital = o.id
INNER JOIN report_antexchu c on c.sourceId= f.sourceId
INNER JOIN report_patients p on c.sourceId = p.patientId
where c.syjg is not null and c.type =1
<if test="hospitalId != null and hospitalId != ''">
and f.fmHospital = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and f.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and f.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
<if test="startDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) >= #{startDay}
</if>
<if test="endDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) <![CDATA[ <= ]]> #{endDay}
</if>
group by o.id
</select>
<select id="getMatdeliverSyjgCheckzqCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(f.id) as matdeliverSyjgCheckzqCount ,o.id as hospitalId from report_matdeliver f INNER JOIN organization o on f.fmHospital = o.id
INNER JOIN (select a.sourceId,a.checkTime from report_antexchu a where a.type =1 and a.syjg is not null
) c on c.sourceId= f.sourceId
where DATEDIFF(c.checkTime,f.lastMenses) <![CDATA[ <= ]]> 83
<if test="hospitalId != null and hospitalId != ''">
and f.fmHospital = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and f.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and f.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.id
</select>
<select id="getHasMatdeliverSyjgCheckzqCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(f.id) as hasMatdeliverSyjgCheckzqCount ,o.id as hospitalId from report_matdeliver f INNER JOIN organization o on f.fmHospital = o.id
INNER JOIN (select a.sourceId,a.checkTime from report_antexchu a where a.type =1 and a.syjg='yang'
) c on c.sourceId= f.sourceId
where DATEDIFF(c.checkTime,f.lastMenses) <![CDATA[ <= ]]> 83
<if test="hospitalId != null and hospitalId != ''">
and f.fmHospital = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and f.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and f.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.id
</select>
<select id="getMatdeliverYgbmkyCheckCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(f.id) as matdeliverYgbmkyCheckCount ,o.id as hospitalId from report_matdeliver f INNER JOIN organization o on f.fmHospital = o.id
INNER JOIN report_antexchu c on c.sourceId= f.sourceId
INNER JOIN report_patients p on c.sourceId = p.patientId
where c.syjg is not null and c.type =1
<if test="hospitalId != null and hospitalId != ''">
and f.fmHospital = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and f.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and f.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
<if test="startDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) >= #{startDay}
</if>
<if test="endDay != null">
and DATEDIFF(c.checkTime,p.lastMenses) <![CDATA[ <= ]]> #{endDay}
</if>
group by o.id
</select>
<select id="getMatdeliverYgbmkyCheckzqCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(f.id) as matdeliverYgbmkyCheckzqCount ,o.id as hospitalId from report_matdeliver f INNER JOIN organization o on f.fmHospital = o.id
INNER JOIN (select a.sourceId,a.checkTime from report_antexchu a where a.type =1 and a.syjg is not null
) c on c.sourceId= f.sourceId
where DATEDIFF(c.checkTime,f.lastMenses) <![CDATA[ <= ]]> 83
<if test="hospitalId != null and hospitalId != ''">
and f.fmHospital = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and f.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and f.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.id
</select>
<select id="getHasMatdeliverYgbmkyCheckzqCount" resultType="java.util.Map" parameterType="java.util.Map">
SELECT count(f.id) as hasMatdeliverYgbmkyCheckzqCount ,o.id as hospitalId from report_matdeliver f INNER JOIN organization o on f.fmHospital = o.id
INNER JOIN (select a.sourceId,a.checkTime from report_antexchu a where a.type =1 and a.syjg='yang'
) c on c.sourceId= f.sourceId
where DATEDIFF(c.checkTime,f.lastMenses) <![CDATA[ <= ]]> 83
<if test="hospitalId != null and hospitalId != ''">
and f.fmHospital = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="provinceId != null and provinceId != ''">
and o.province_id = #{provinceId,jdbcType=VARCHAR}
</if>
<if test="cityId != null and cityId != ''">
and o.city_id = #{cityId,jdbcType=VARCHAR}
</if>
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and f.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and f.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
GROUP BY o.id
</select>
<select id="getAllFmCount" resultType="java.lang.Integer" parameterType="java.util.Map">
SELECT count(1) as allFmCount from report_matdeliver m where
<if test="hospitalId != null and hospitalId != ''">
m.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and m.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and m.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
</select>
<select id="getAllBuildCount" resultType="java.lang.Integer" parameterType="java.util.Map">
SELECT count(1) as allBuildCount from report_matdeliver m
INNER JOIN
(select * from report_patients p where p.hospitalId=#{hospitalId,jdbcType=VARCHAR} and p.enable is null) r on m.sourceId = r.patientId where
<if test="hospitalId != null and hospitalId != ''">
m.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and m.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and m.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
</select>
<select id="getNameFmCount" resultType="java.lang.Integer" parameterType="java.util.Map">
select count(m.id) as fmCount from report_matdeliver m INNER JOIN users u on m.fmDoctor = u.id where
<if test="hospitalId != null and hospitalId != ''">
m.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and m.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and m.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
<if test="userId != null">
and u.id= #{userId,jdbcType=INTEGER}
</if>
</select>
<select id="getNameBuildCount" resultType="java.lang.Integer" parameterType="java.util.Map">
select count(m.id) as buildCount from report_matdeliver m INNER JOIN
(select * from report_patients p where p.hospitalId=#{hospitalId,jdbcType=VARCHAR} and p.enable is null) r on m.sourceId = r.patientId INNER JOIN
users u on r.bookbuildingDoctor = u.id where
<if test="hospitalId != null and hospitalId != ''">
m.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and m.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and m.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
<if test="userId != null">
and u.id= #{userId,jdbcType=INTEGER}
</if>
</select>
<select id="getBuildAndFmCount" resultType="java.lang.Integer" parameterType="java.util.Map">
select count(m.id) as buildAndFmCount from report_matdeliver m INNER JOIN
(select * from report_patients p where p.hospitalId= #{hospitalId,jdbcType=VARCHAR} and p.enable is null) r on m.sourceId = r.patientId INNER JOIN
users u on r.bookbuildingDoctor = u.id and m.fmDoctor = r.bookbuildingDoctor where
<if test="hospitalId != null and hospitalId != ''">
m.hospitalId = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="startDate != null">
and m.dueDate1 >= #{startDate}
</if>
<if test="endDate != null">
and m.dueDate1 <![CDATA[ <= ]]> #{endDate}
</if>
<if test="userId != null">
and u.id= #{userId,jdbcType=INTEGER}
</if>
</select>
<select id="getgetLhByFmManage" resultType="java.util.Map" parameterType="java.util.Map">
SELECT
p.username,
f.dueDate1 AS fmDate,
o.NAME AS hospitalName,
u.NAME AS buildDoctorName
FROM
report_matdeliver f
INNER JOIN organization o ON f.fmHospital = o.id
INNER JOIN report_patients p ON p.patientId = f.sourceId
INNER JOIN users u ON u.id = p.bookbuildingDoctor
WHERE
p.ENABLE IS NULL
<if test="hospitalId != null">
and f.fmHospital IN
<foreach item="item" index="index" collection="hospitalId" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="startTime != null">
and f.dueDate1 >= #{startTime}
</if>
<if test="endTime != null">
and f.dueDate1 <![CDATA[ <= ]]> #{endTime}
</if>
<if test="doctorId != null">
and u.id= #{doctorId,jdbcType=INTEGER}
</if>
ORDER BY
o.NAME ASC
</select>
<select id="getLhWyFmManage" resultType="java.util.Map" parameterType="java.util.Map">
SELECT
p.cardNo,
p.username,
f.dueDate1 AS fmDate,
o.NAME AS hospitalName,
uf.NAME AS fmDoctorName,
bo.NAME AS buildHospital
FROM
report_matdeliver f
INNER JOIN organization o ON f.fmHospital = o.id
INNER JOIN report_patients p ON p.patientId = f.sourceId
INNER JOIN users uf ON uf.id = f.fmDoctor
INNER JOIN organization bo ON p.hospitalId = bo.id
WHERE
p.ENABLE IS NULL
<if test="hospitalId != null">
AND f.fmHospital=#{hospitalId,jdbcType=INTEGER}
</if>
<if test="startTime != null">
AND f.dueDate1 >= #{startTime}
</if>
<if test="endTime != null">
AND f.dueDate1 <![CDATA[ <= ]]> #{endTime}
</if>
AND p.bookbuildingDoctor NOT IN (
SELECT
id
FROM
users u
WHERE 1=1
<if test="hospitalId != null">
AND u.org_id=#{hospitalId,jdbcType=INTEGER}
</if>
)
</select>
</mapper>