sinake
2 天以前 34b56683125b210f929b9ef5ea41a4dea009dfcf
ruoyi-project/src/main/resources/mapper/project/ServiceDonationwitnessMapper.xml
@@ -1,65 +1,135 @@
<?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">
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.mapper.ServiceDonationwitnessMapper">
    <resultMap type="ServiceDonationwitness" id="ServiceDonationwitnessResult">
        <result property="id"    column="ID"    />
        <result property="infoid"    column="InfoID"    />
        <result property="donorno"    column="DonorNo"    />
        <result property="gainhospitalno"    column="GainHospitalNo"    />
        <result property="gainhospitalname"    column="GainHospitalName"    />
        <result property="deathtime"    column="DeathTime"    />
        <result property="deathreason"    column="DeathReason"    />
        <result property="deathjudgedocto"    column="DeathJudgeDoctO"    />
        <result property="deathjudgedoctt"    column="DeathJudgeDoctT"    />
        <result property="deathjudgeannex"    column="DeathJudgeAnnex"    />
        <result property="operationbegtime"    column="OperationBegTime"    />
        <result property="operationendtime"    column="OperationEndTime"    />
        <result property="operationdoctor"    column="OperationDoctor"    />
        <result property="isspendremember"    column="IsSpendRemember"    />
        <result property="isrestoreremains"    column="IsRestoreRemains"    />
        <result property="rememberannex"    column="RememberAnnex"    />
        <result property="responsibleuserid"    column="ResponsibleUserID"    />
        <result property="responsibleusername"    column="ResponsibleUserName"    />
        <result property="coordinateduserido"    column="CoordinatedUserIDO"    />
        <result property="coordinatedusernameo"    column="CoordinatedUserNameO"    />
        <result property="coordinateduseridt"    column="CoordinatedUserIDT"    />
        <result property="coordinatedusernamet"    column="CoordinatedUserNameT"    />
        <result property="abdominalaortacannulatime"    column="AbdominalAortaCannulaTime"    />
        <result property="abdominalaortaperfusiontime"    column="AbdominalAortaPerfusionTime"    />
        <result property="portalveincannulatime"    column="PortalVeinCannulaTime"    />
        <result property="portalveinperfusiontime"    column="PortalVeinPerfusionTime"    />
        <result property="pulmonaryarterycannulatime"    column="PulmonaryArteryCannulaTime"    />
        <result property="pulmonaryarteryperfusiontime"    column="PulmonaryArteryPerfusionTime"    />
        <result property="aortacannulatime"    column="AortaCannulaTime"    />
        <result property="aortaperfusiontime"    column="AortaPerfusionTime"    />
        <result property="del_flag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="organdonation"    column="OrganDonation"    />
        <result property="organdonationOther"    column="OrganDonation_Other"    />
        <result property="donationcategory"    column="DonationCategory"    />
    <resultMap type="com.ruoyi.project.domain.ServiceDonationwitness" id="ServiceDonationwitnessResult">
        <result property="id" column="ID"/>
        <result property="infoid" column="InfoID"/>
        <result property="donorno" column="DonorNo"/>
        <result property="gainhospitalno" column="GainHospitalNo"/>
        <result property="gainhospitalname" column="GainHospitalName"/>
        <result property="deathtime" column="DeathTime"/>
        <result property="deathreason" column="DeathReason"/>
        <result property="deathjudgedocto" column="DeathJudgeDoctO"/>
        <result property="deathjudgedoctt" column="DeathJudgeDoctT"/>
        <result property="deathjudgeannex" column="DeathJudgeAnnex"/>
        <result property="operationbegtime" column="OperationBegTime"/>
        <result property="operationendtime" column="OperationEndTime"/>
        <result property="operationdoctor" column="OperationDoctor"/>
        <result property="isspendremember" column="IsSpendRemember"/>
        <result property="isrestoreremains" column="IsRestoreRemains"/>
        <result property="rememberannex" column="RememberAnnex"/>
        <result property="responsibleuserid" column="ResponsibleUserID"/>
        <result property="responsibleusername" column="ResponsibleUserName"/>
        <result property="coordinateduserido" column="CoordinatedUserIDO"/>
        <result property="coordinatedusernameo" column="CoordinatedUserNameO"/>
        <result property="coordinateduseridt" column="CoordinatedUserIDT"/>
        <result property="coordinatedusernamet" column="CoordinatedUserNameT"/>
        <result property="abdominalaortacannulatime" column="AbdominalAortaCannulaTime"/>
        <result property="abdominalaortaperfusiontime" column="AbdominalAortaPerfusionTime"/>
        <result property="portalveincannulatime" column="PortalVeinCannulaTime"/>
        <result property="portalveinperfusiontime" column="PortalVeinPerfusionTime"/>
        <result property="pulmonaryarterycannulatime" column="PulmonaryArteryCannulaTime"/>
        <result property="pulmonaryarteryperfusiontime" column="PulmonaryArteryPerfusionTime"/>
        <result property="aortacannulatime" column="AortaCannulaTime"/>
        <result property="aortaperfusiontime" column="AortaPerfusionTime"/>
        <result property="del_flag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="organdonation" column="OrganDonation"/>
        <result property="organdonationOther" column="OrganDonation_Other"/>
        <result property="donationcategory" column="DonationCategory"/>
        <result property="coordinatorInOperating" column="coordinator_in_operating"/>
        <result property="coordinatorOutOperating" column="coordinator_out_operating"/>
        <result property="coordinatorSign" column="coordinator_sign"/>
        <result property="coordinatorSignTime" column="coordinator_sign_time"/>
        <result property="donateHospital" column="donate_hospital"/>
    </resultMap>
    <sql id="selectServiceDonationwitnessVo">
        select ID, InfoID, DonorNo, GainHospitalNo, GainHospitalName, DeathTime, DeathReason, DeathJudgeDoctO, DeathJudgeDoctT, DeathJudgeAnnex, OperationBegTime, OperationEndTime, OperationDoctor, IsSpendRemember, IsRestoreRemains, RememberAnnex, ResponsibleUserID, ResponsibleUserName, CoordinatedUserIDO, CoordinatedUserNameO, CoordinatedUserIDT, CoordinatedUserNameT, AbdominalAortaCannulaTime, AbdominalAortaPerfusionTime, PortalVeinCannulaTime, PortalVeinPerfusionTime, PulmonaryArteryCannulaTime, PulmonaryArteryPerfusionTime, AortaCannulaTime, AortaPerfusionTime, del_flag, create_by, create_time, update_by, update_time, OrganDonation, OrganDonation_Other, DonationCategory from service_donationwitness
        select ID,
               InfoID,
               donate_hospital,
               coordinator_in_operating,
               coordinator_out_operating,
               coordinator_sign,
               coordinator_sign_time,
               DonorNo,
               GainHospitalNo,
               GainHospitalName,
               DeathTime,
               DeathReason,
               DeathJudgeDoctO,
               DeathJudgeDoctT,
               DeathJudgeAnnex,
               OperationBegTime,
               OperationEndTime,
               OperationDoctor,
               IsSpendRemember,
               IsRestoreRemains,
               RememberAnnex,
               ResponsibleUserID,
               ResponsibleUserName,
               CoordinatedUserIDO,
               CoordinatedUserNameO,
               CoordinatedUserIDT,
               CoordinatedUserNameT,
               AbdominalAortaCannulaTime,
               AbdominalAortaPerfusionTime,
               PortalVeinCannulaTime,
               PortalVeinPerfusionTime,
               PulmonaryArteryCannulaTime,
               PulmonaryArteryPerfusionTime,
               AortaCannulaTime,
               AortaPerfusionTime,
               del_flag,
               create_by,
               create_time,
               update_by,
               update_time,
               OrganDonation,
               OrganDonation_Other,
               DonationCategory
        from service_donationwitness
    </sql>
    <select id="selectServiceDonationwitnessList" parameterType="ServiceDonationwitness" resultMap="ServiceDonationwitnessResult">
    <select id="selectServiceDonationwitnessList" parameterType="com.ruoyi.project.domain.ServiceDonationwitness"
            resultMap="ServiceDonationwitnessResult">
        <include refid="selectServiceDonationwitnessVo"/>
        <where>
            <if test="donorno != null  and donorno != ''"> and DonorNo = #{donorno}</if>
            <if test="gainhospitalname != null  and gainhospitalname != ''"> and GainHospitalName like concat('%', #{gainhospitalname}, '%')</if>
            <if test="operationdoctor != null  and operationdoctor != ''"> and OperationDoctor = #{operationdoctor}</if>
            <if test="donorno != null  and donorno != ''">and DonorNo = #{donorno}</if>
            <if test="donateHospital != null  and donateHospital != ''">and donate_hospital = #{donateHospital}</if>
            <if test="gainhospitalname != null  and gainhospitalname != ''">and GainHospitalName like concat('%',
                #{gainhospitalname}, '%')
            </if>
            <if test="operationdoctor != null  and operationdoctor != ''">and OperationDoctor = #{operationdoctor}</if>
            <if test="infoid != null">and InfoID = #{infoid}</if>
        </where>
    </select>
    <!--
      批量查询「捐献基础ID -> 死亡时间」,供列表页计算年龄使用。
      代替原先在记录循环中按 InfoID 逐条查询的 N+1 写法(首页有 N 条记录就发 N 次 SQL)。
      只返回 InfoID 与 DeathTime 两列;Infoid 与 DeathTime 均为空的行无意义,直接过滤,
      同时避免与 selectServiceDonationwitnessList 返回的行数不一致。
    -->
    <select id="selectDeathTimeByInfoIds" resultMap="ServiceDonationwitnessResult">
        select InfoID, DeathTime from service_donationwitness
        where InfoID is not null and DeathTime is not null
        <if test="infoIds != null and infoIds.size() > 0">
            and InfoID in
            <foreach collection="infoIds" item="infoId" open="(" separator="," close=")">
                #{infoId}
            </foreach>
        </if>
    </select>
    <select id="selectVOList" resultType="com.ruoyi.project.domain.vo.DonationWitnessVO">
    SELECT
        SELECT
        `service_donatebaseinfo`.`ID` AS `ID`,
        `service_donatebaseinfo`.`DonorNo` AS `DonorNo`,
        `service_donatebaseinfo`.`DonationCategory` AS `DonationCategory`,
@@ -78,6 +148,9 @@
        `service_donatebaseinfo`.`ReporterPhone` AS `ReporterPhone`,
        `service_donatebaseinfo`.`ReportTime` AS `ReportTime`,
        `service_donatebaseinfo`.`create_by` AS `basecreateby`,
        `service_donatebaseinfo`.`workflow` AS `workflow`,
        `service_donatebaseinfo`.`termination_case` AS `terminationCase`,
        `service_donatebaseinfo`.`donatetime` AS `donatetime`,
        `service_donationwitness`.`ID` AS `dwID`,
        `service_donationwitness`.`InfoID` AS `InfoID`,
        `service_donationwitness`.`DonorNo` AS `dwDonorNo`,
@@ -115,26 +188,41 @@
        `service_donationwitness`.`create_by` AS `createby`,
        `service_donationwitness`.`create_time` AS `createtime`,
        `service_donationwitness`.`update_by` AS `updateby`,
        `service_donationwitness`.`update_time` AS `updatetime`
    FROM
            `service_donatebaseinfo`
            LEFT JOIN `service_donationwitness` ON
                `service_donatebaseinfo`.`ID` = `service_donationwitness`.`InfoID`
            LEFT JOIN `base_organization` ON
            `base_organization`.`OrganizationID` = `service_donatebaseinfo`.`TreatmentHospitalNo`
        `service_donationwitness`.`update_time` AS `updatetime`,
        `service_donationwitness`.`coordinator_in_operating` AS `coordinatorInOperating`,
        `service_donationwitness`.`coordinator_out_operating` AS `coordinatorOutOperating`,
        `service_donationwitness`.`coordinator_sign` AS `coordinatorSign`,
        `service_donationwitness`.`coordinator_sign_time` AS `coordinatorSignTime`,
        `service_donationwitness`.`donate_hospital` AS `donate_hospital`
        FROM
        `service_donatebaseinfo`
        LEFT JOIN `service_donationwitness` ON
        `service_donatebaseinfo`.`ID` = `service_donationwitness`.`InfoID`
        LEFT JOIN `base_organization` ON
        `base_organization`.`OrganizationID` = `service_donatebaseinfo`.`TreatmentHospitalNo`
        <where>
            <if test="donorno != null  and donorno != ''"> and `service_donatebaseinfo`.`DonorNo` = #{donorno}</if>
            <if test="name != null  and name != ''"> and `service_donatebaseinfo`.`Name` like concat('%', #{name}, '%')</if>
            <if test="idcardno != null  and idcardno != ''"> and `service_donatebaseinfo`.`IDCardNo` = #{idcardno}</if>
            <if test="treatmenthospitalno != null  and treatmenthospitalno != ''"> and `service_donatebaseinfo`.`TreatmentHospitalNo` = #{treatmenthospitalno}</if>
            <if test="recordstate != null  and recordstate != ''"> and `service_donatebaseinfo`.`RecordState` = #{recordstate}</if>
            <if test="basecreateby != null  and basecreateby != ''"> and `service_donatebaseinfo`.`create_by`  = #{basecreateby}</if>
            <if test="starttime != null "> and `service_donationwitness`.OperationBegTime >= #{starttime} </if>
            <if test="endtime != null ">  and `service_donationwitness`.OperationBegTime &lt;= #{endtime}</if>
            <if test="reporterno != null  and reporterno != ''"> and `service_donatebaseinfo`.ReporterNo = #{reporterno}</if>
            <if test="city != null and city != ''"> and `base_organization`.`City` = #{city}</if>
            service_donationwitness.del_flag=0
            and service_donatebaseinfo.del_flag=0
            <if test="donorno != null  and donorno != ''">and `service_donatebaseinfo`.`DonorNo` = #{donorno}</if>
            <if test="name != null  and name != ''">and `service_donatebaseinfo`.`Name` like concat('%', #{name}, '%')
            </if>
            <if test="idcardno != null  and idcardno != ''">and `service_donatebaseinfo`.`IDCardNo` = #{idcardno}</if>
            <if test="treatmenthospitalno != null  and treatmenthospitalno != ''">and
                `service_donatebaseinfo`.`TreatmentHospitalNo` = #{treatmenthospitalno}
            </if>
            <if test="recordstate != null  and recordstate != ''">and `service_donatebaseinfo`.`RecordState` =
                #{recordstate}
            </if>
            <if test="basecreateby != null  and basecreateby != ''">and `service_donatebaseinfo`.`create_by` =
                #{basecreateby}
            </if>
            <if test="starttime != null ">and `service_donationwitness`.OperationBegTime >= #{starttime}</if>
            <if test="endtime != null ">and `service_donationwitness`.OperationBegTime &lt;= #{endtime}</if>
            <if test="reporterno != null  and reporterno != ''">and `service_donatebaseinfo`.ReporterNo =
                #{reporterno}
            </if>
            <if test="city != null and city != ''">and `base_organization`.`City` = #{city}</if>
            <if test="workflow != null ">and `service_donatebaseinfo`.`workflow` = #{workflow}</if>
        </where>
        order by `service_donationwitness`.`create_time` desc
@@ -145,20 +233,20 @@
        inner join service_donatebaseinfo b on w.InfoID = b.id
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where w.DonationCategory = "DBD"
        <if test="starttime != null "> and w.OperationBegTime >= #{starttime} </if>
        <if test="endtime != null ">  and w.OperationBegTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''"> and o.City = #{city} </if>
        <if test="reporterno != null and reporterno != ''"> and b.ReporterNo = #{reporterno}</if>
        <if test="starttime != null ">and w.OperationBegTime >= #{starttime}</if>
        <if test="endtime != null ">and w.OperationBegTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getDCDDonaterNumberThisYear" resultType="java.lang.Integer">
        select count(*) from service_donationwitness w
        inner join service_donatebaseinfo b on w.InfoID = b.id
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where w.DonationCategory = "DCD"
        <if test="starttime != null "> and w.OperationBegTime >= #{starttime} </if>
        <if test="endtime != null ">  and w.OperationBegTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''"> and o.City = #{city} </if>
        <if test="reporterno != null and reporterno != ''"> and b.ReporterNo = #{reporterno}</if>
        <if test="starttime != null ">and w.OperationBegTime >= #{starttime}</if>
        <if test="endtime != null ">and w.OperationBegTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getDBCDDonaterNumberThisYear" resultType="java.lang.Integer">
@@ -166,22 +254,26 @@
        inner join service_donatebaseinfo b on w.InfoID = b.id
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where w.DonationCategory = "DBCD"
        <if test="starttime != null "> and w.OperationBegTime >= #{starttime} </if>
        <if test="endtime != null ">  and w.OperationBegTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''"> and o.City = #{city} </if>
        <if test="reporterno != null and reporterno != ''"> and b.ReporterNo = #{reporterno}</if>
        <if test="starttime != null ">and w.OperationBegTime >= #{starttime}</if>
        <if test="endtime != null ">and w.OperationBegTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getDonationCategoryByInfoId" resultType="java.lang.String">
        select DonationCategory from service_donationwitness
        select DonationCategory
        from service_donationwitness
        where InfoID = #{infoId}
          and del_flag = 0
    </select>
    <select id="countNumber" resultType="java.lang.Integer">
        select count(*) from service_donationwitness
        where OperationBegTime >= #{starttime} and OperationBegTime &lt;= #{endtime}
        select count(*)
        from service_donationwitness
        where OperationBegTime >= #{starttime}
          and OperationBegTime &lt;= #{endtime}
    </select>
    <select id="selectByInfoId" resultType="com.ruoyi.project.domain.ServiceDonationwitness">
        <include refid="selectServiceDonationwitnessVo"/>
        where InfoID = #{infoid}
        where InfoID = #{infoid} and del_flag!=1
    </select>
    <select id="getAllDonatePeople" resultType="com.ruoyi.project.domain.ServiceDonationwitness">
        <include refid="selectServiceDonationwitnessVo"/>
@@ -191,10 +283,13 @@
        inner join service_donatebaseinfo b on w.InfoID = b.id
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        <where>
        <if test="starttime != null "> and w.OperationBegTime >= #{starttime} </if>
        <if test="endtime != null ">  and w.OperationBegTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''"> and o.City = #{city} </if>
        <if test="reporterno != null and reporterno != ''"> and b.ReporterNo = #{reporterno}</if>
            w.del_flag=0
            and b.del_flag=0
            <if test="starttime != null ">and w.OperationBegTime >= #{starttime}</if>
            <if test="donateHospital != null ">and w.donate_hospital >= #{donateHospital}</if>
            <if test="endtime != null ">and w.OperationBegTime &lt;= #{endtime}</if>
            <if test="city != null and city != ''">and o.City = #{city}</if>
            <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
        </where>
    </select>
    <select id="getWitnessList" resultType="com.ruoyi.project.domain.ServiceDonationwitness">
@@ -210,4 +305,4 @@
    </select>
</mapper>
</mapper>