liusheng
2024-07-25 517ecf9879052b2f3fbad25c0469935cc45553a7
ruoyi-project/src/main/resources/mapper/project/ServiceDonatecompletioninfoMapper.xml
@@ -1,46 +1,68 @@
<?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.ServiceDonatecompletioninfoMapper">
    <resultMap type="com.ruoyi.project.domain.ServiceDonatecompletioninfo" id="ServiceDonatecompletioninfoResult">
        <result property="id"    column="ID"    />
        <result property="infoid"    column="InfoID"    />
        <result property="donorno"    column="DonorNo"    />
        <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="isbodydonation"    column="IsBodyDonation"    />
        <result property="receivingunit"    column="ReceivingUnit"    />
        <result property="receivingunitname"    column="ReceivingUnitName"    />
        <result property="completetime"    column="CompleteTime"    />
        <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="assessannex"    column="AssessAnnex"    />
        <result property="donateorgan"    column="DonateOrgan"    />
        <result property="id" column="ID"/>
        <result property="infoid" column="InfoID"/>
        <result property="donorno" column="DonorNo"/>
        <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="isbodydonation" column="IsBodyDonation"/>
        <result property="receivingunit" column="ReceivingUnit"/>
        <result property="receivingunitname" column="ReceivingUnitName"/>
        <result property="completetime" column="CompleteTime"/>
        <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="assessannex" column="AssessAnnex"/>
        <result property="donateorgan" column="DonateOrgan"/>
    </resultMap>
    <sql id="selectServiceDonatecompletioninfoVo">
        select ID, InfoID, DonorNo, del_flag, create_by, create_time, update_by, update_time, IsBodyDonation, ReceivingUnit, ReceivingUnitName, CompleteTime, ResponsibleUserID, ResponsibleUserName, CoordinatedUserIDO, CoordinatedUserNameO, CoordinatedUserIDT, CoordinatedUserNameT, AssessAnnex, DonateOrgan from service_donatecompletioninfo
        select ID,
               InfoID,
               DonorNo,
               del_flag,
               create_by,
               create_time,
               update_by,
               update_time,
               IsBodyDonation,
               ReceivingUnit,
               ReceivingUnitName,
               CompleteTime,
               ResponsibleUserID,
               ResponsibleUserName,
               CoordinatedUserIDO,
               CoordinatedUserNameO,
               CoordinatedUserIDT,
               CoordinatedUserNameT,
               AssessAnnex,
               DonateOrgan
        from service_donatecompletioninfo
    </sql>
    <select id="selectServiceDonatecompletioninfoList" parameterType="com.ruoyi.project.domain.ServiceDonatecompletioninfo" resultMap="ServiceDonatecompletioninfoResult">
    <select id="selectServiceDonatecompletioninfoList"
            parameterType="com.ruoyi.project.domain.ServiceDonatecompletioninfo"
            resultMap="ServiceDonatecompletioninfoResult">
        <include refid="selectServiceDonatecompletioninfoVo"/>
        <where>
            <if test="donorno != null  and donorno != ''"> and DonorNo = #{donorno}</if>
            <if test="isbodydonation != null  and isbodydonation != ''"> and IsBodyDonation = #{isbodydonation}</if>
            <if test="receivingunit != null  and receivingunit != ''"> and ReceivingUnit = #{receivingunit}</if>
            <if test="donorno != null  and donorno != ''">and DonorNo = #{donorno}</if>
            <if test="isbodydonation != null  and isbodydonation != ''">and IsBodyDonation = #{isbodydonation}</if>
            <if test="receivingunit != null  and receivingunit != ''">and ReceivingUnit = #{receivingunit}</if>
        </where>
    </select>
    <select id="selectVOList" resultType="com.ruoyi.project.domain.vo.DonationCompletionVO">
    SELECT
        SELECT
        `service_donatebaseinfo`.`ID` AS `ID`,
        `service_donatebaseinfo`.`DonorNo` AS `DonorNo`,
        `service_donatebaseinfo`.`DonationCategory` AS `DonationCategory`,
@@ -96,48 +118,59 @@
        `service_donatecompletioninfo`.`create_time` AS `createtime`,
        `service_donatecompletioninfo`.`update_by` AS `updateby`,
        `service_donatecompletioninfo`.`update_time` AS `updatetime`
    FROM
              `service_donatebaseinfo`
            LEFT JOIN  (    select * from `service_donatecompletioninfo`  where `del_flag`='0' and  id in (
                select min(id) from `service_donatecompletioninfo` where `del_flag`='0' group by `InfoID`
                )  )`service_donatecompletioninfo` ON
                `service_donatebaseinfo`.`ID` = `service_donatecompletioninfo`.`InfoID`
        FROM
        `service_donatebaseinfo`
        LEFT JOIN `service_donatecompletioninfo` ON
        `service_donatebaseinfo`.`ID` = `service_donatecompletioninfo`.`InfoID`
        LEFT JOIN `base_organization` ON
        `base_organization`.`OrganizationID` = `service_donatebaseinfo`.`TreatmentHospitalNo`
        <where>
            `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_donatecompletioninfo`.CompleteTime >= #{starttime} </if>
            <if test="endtime != null ">  and `service_donatecompletioninfo`.CompleteTime &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="id != null "> and `service_donatebaseinfo`.`ID` = #{id}</if>
            <if test="workflow != null "> and `service_donatebaseinfo`.`workflow` = #{workflow}</if>
    </where>
            and service_donatecompletioninfo.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_donatecompletioninfo`.CompleteTime >= #{starttime}</if>
            <if test="endtime != null ">and `service_donatecompletioninfo`.CompleteTime &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="id != null ">and `service_donatebaseinfo`.`ID` = #{id}</if>
            <if test="workflow != null ">and `service_donatebaseinfo`.`workflow` = #{workflow}</if>
        </where>
        order by `service_donatecompletioninfo`.`create_time` desc
    </select>
    <select id="countNumber" resultType="java.lang.Integer">
        select count(*) from service_donatecompletioninfo
        where CompleteTime >= #{starttime} and CompleteTime &lt;= #{endtime}  AND del_flag=0
        select count(*)
        from service_donatecompletioninfo
        where CompleteTime >= #{starttime}
          and CompleteTime &lt;= #{endtime}
          AND del_flag = 0
    </select>
    <select id="getByInfoId" resultType="com.ruoyi.project.domain.ServiceDonatecompletioninfo">
        <include refid="selectServiceDonatecompletioninfoVo"/>
        where InfoID = #{id}  AND del_flag=0
        where InfoID = #{id} AND del_flag=0
    </select>
    <select id="count" resultType="java.lang.Integer">
        select count(*) from service_donatecompletioninfo
        where del_flag=0 and CompleteTime >= #{starttime} and CompleteTime &lt;= #{endtime}
        select count(*)
        from service_donatecompletioninfo
        where del_flag = 0
          and CompleteTime >= #{starttime}
          and CompleteTime &lt;= #{endtime}
    </select>
    <select id="getCompletionDonatePeopleByTime" resultType="com.ruoyi.project.domain.ServiceDonatecompletioninfo">
        <include refid="selectServiceDonatecompletioninfoVo"/>
@@ -147,7 +180,9 @@
    <update id="delDuplicateDonateCompletioninfo">
        update service_donatecompletioninfo
        set del_flag = 1,create_by= #{createby},update_time=now()
        set del_flag   = 1,
            create_by= #{createby},
            update_time=now()
        where InfoID = #{infoid}
    </update>