| | |
| | | <result property="medicareType" column="medicare_type"/> |
| | | <result property="carePerson" column="care_person"/> |
| | | <result property="casePersonAge" column="case_person_age"/> |
| | | <result property="reservedPhone" column="reserved_phone"/> |
| | | </resultMap> |
| | | |
| | | |
| | |
| | | <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/> |
| | | <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/> |
| | | <result property="admitdate" column="admitdate"/> |
| | | <result property="reservedPhone" column="reserved_phone"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectPatArchiveVo"> |
| | |
| | | archivetime, |
| | | archiveby, |
| | | telcode, |
| | | reserved_phone, |
| | | relativetelcode, |
| | | idcardtype, |
| | | orgid, |
| | |
| | | <if test="medicareType != null ">and medicare_type = #{medicareType}</if> |
| | | <if test="carePerson != null ">and care_person = #{carePerson}</if> |
| | | <if test="casePersonAge != null ">and case_person_age = #{casePersonAge}</if> |
| | | <if test="reservedPhone != null ">and reserved_phone = #{reservedPhone}</if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | a.income, |
| | | a.medicare_type, |
| | | a.care_person, |
| | | a.reserved_phone, |
| | | a.case_person_age |
| | | from pat_archive a,pat_archivetag b ,base_tag c |
| | | <where> |
| | | a.del_flag=0 and |
| | | a.id = b.patid and b.tagid = c.tagid |
| | | <if test="reservedPhone != null ">and reserved_phone = #{reservedPhone}</if> |
| | | <if test="name != null and name != ''">and a.name like concat('%', #{name}, '%')</if> |
| | | <if test="idcardno != null and idcardno != ''">and idcardno = #{idcardno}</if> |
| | | <if test="telcode != null and telcode != ''">and telcode = #{telcode}</if> |
| | |
| | | <if test="medicareType != null ">medicare_type,</if> |
| | | <if test="carePerson != null ">care_person,</if> |
| | | <if test="casePersonAge != null ">case_person_age,</if> |
| | | <if test="reservedPhone != null ">reserved_phone,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="patientno != null">#{patientno},</if> |
| | |
| | | <if test="medicareType != null ">#{medicareType},</if> |
| | | <if test="carePerson != null ">#{carePerson},</if> |
| | | <if test="casePersonAge != null ">#{casePersonAge},</if> |
| | | <if test="reservedPhone != null ">#{reservedPhone},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | insert into |
| | | pat_archive(name,viptype,sex,idcardno,birthdate,place_of_residence,age,age2,sourcefrom,archivetime,archiveby,telcode,relativetelcode,idcardtype,orgid,openid,dduserid,update_by,update_time |
| | | ,create_by,create_time,isupload,upload_time,pattype,nation,birthplace,native_place,patientno,patid_his,sd_flag,age_unit,age_unit2,notrequired_flag,notrequiredreason,care_facilities,case_path, |
| | | degree_of_education,marital_status,income,medicare_type,care_person,case_person_age) |
| | | degree_of_education,marital_status,income,medicare_type,care_person,case_person_age,reserved_phone) |
| | | values |
| | | <foreach item="item" index="index" collection="list" separator=","> |
| | | (#{item.name},#{item.viptype},#{item.sex},#{item.idcardno},#{item.birthdate},#{item.placeOfResidence},#{item.age},#{item.age2},#{item.sourcefrom},#{item.archivetime},#{item.archiveby} |
| | | ,#{item.telcode},#{item.archiveby},#{item.idcardtype},#{item.orgid},#{item.openid},#{item.dduserid},#{item.updateBy}, |
| | | #{item.updateTime},#{item.createBy},#{item.createTime},#{item.isupload},#{item.uploadTime},#{item.pattype},#{item.nation},#{item.birthplace},#{item.nativePlace},#{item.patientno}, |
| | | #{item.patidHis},#{item.sdFlag},#{item.ageUnit},#{item.ageUnit2},#{item.notrequiredFlag},#{item.notrequiredreason} |
| | | ,#{item.careFacilities},#{item.casePath},#{item.degreeOfEducation},#{item.maritalStatus},#{item.income},#{item.medicareType},#{item.carePerson},#{item.casePersonAge}) |
| | | ,#{item.careFacilities},#{item.casePath},#{item.degreeOfEducation},#{item.maritalStatus},#{item.income},#{item.medicareType},#{item.carePerson},#{item.casePersonAge},#{item.reservedPhone}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | |
| | | <if test="isupload != null">isupload = #{isupload},</if> |
| | | <if test="uploadTime != null">upload_time = #{uploadTime},</if> |
| | | <if test="viptype != null">viptype = #{viptype},</if> |
| | | <if test="viptype != null">patientno = #{patientno},</if> |
| | | <if test="viptype != null">patid_his = #{patidHis},</if> |
| | | <if test="viptype != null">sd_flag = #{sdFlag},</if> |
| | | <if test="patientno != null">patientno = #{patientno},</if> |
| | | <if test="patidHis != null">patid_his = #{patidHis},</if> |
| | | <if test="sdFlag != null">sd_flag = #{sdFlag},</if> |
| | | <if test="ageUnit != null">age_unit = #{ageUnit},</if> |
| | | <if test="ageUnit2 != null">age_unit2 = #{ageUnit2},</if> |
| | | <if test="notrequiredFlag != null ">notrequired_flag = #{notrequiredFlag},</if> |
| | |
| | | <if test="medicareType != null ">medicare_type = #{medicareType},</if> |
| | | <if test="carePerson != null ">care_person = #{carePerson},</if> |
| | | <if test="casePersonAge != null ">case_person_age = #{casePersonAge},</if> |
| | | <if test="reservedPhone != null ">reserved_phone = #{reservedPhone},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | a.upload_time, |
| | | a.viptype, |
| | | a.pattype, |
| | | a.reserved_phone, |
| | | COALESCE(( |
| | | SELECT string_agg(d.tagname, ', ') |
| | | FROM pat_archivetag d |
| | |
| | | LEFT JOIN pat_archivetag b ON a.id = b.patid AND b.del_flag = 0 |
| | | <where> |
| | | a.del_flag = 0 |
| | | <if test="reservedPhone != null ">and a.reserved_phone = #{reservedPhone}</if> |
| | | <if test="name != null and name != ''">and a.name like concat('%', #{name}, '%')</if> |
| | | <if test="tagname != null and tagname != ''">and b.tagname like concat('%', #{tagname}, '%')</if> |
| | | <if test="idcardno != null and idcardno != ''">and a.idcardno = #{idcardno}</if> |
| | |
| | | a.create_by, |
| | | a.create_time, |
| | | a.isupload, |
| | | a.reserved_phone, |
| | | a.upload_time, |
| | | a.pattype, |
| | | d.bed_no, |
| | |
| | | pat_med_inhosp d |
| | | JOIN pat_archive a ON a.id = d.patid |
| | | LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid |
| | | ) t ON t.patid = |
| | | d.patid |
| | | ) t ON t.patid = d.patid |
| | | <where> |
| | | d.del_flag != 1 |
| | | AND a.del_flag != 1 |
| | | <if test="reservedPhone != null ">and a.reserved_phone = #{reservedPhone}</if> |
| | | <if test="name != null and name != ''">and a.name like concat('%', #{name}, '%')</if> |
| | | <if test="tagname != null and tagname != ''">and t.tagname like concat('%', #{tagname}, '%')</if> |
| | | <if test="idcardno != null and idcardno != ''">and a.idcardno = #{idcardno}</if> |
| | |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size()>0"> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size()>0 and deptcodes == null "> |
| | | AND d.hospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | |
| | | <if test="deptcodes != null and deptcodes.size() > 0 and hospitaldistrictcodes == null"> |
| | | AND d.deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," |
| | | close=")"> |
| | |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size()>0 and deptcodes != null "> |
| | | AND (d.hospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="hospitaldistrictcodes != null and deptcodes != null and deptcodes.size() > 0"> |
| | | OR d.deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," |
| | | close="))"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="patids != null"> |
| | | AND a.id NOT IN |
| | |
| | | a.create_time, |
| | | a.isupload, |
| | | a.upload_time, |
| | | d.leavehospitaldistrictcode AS leavehospitaldistrictcode, |
| | | d.leavehospitaldistrictname AS leavehospitaldistrictname, |
| | | a.reserved_phone, |
| | | COALESCE(( |
| | | SELECT string_agg(dd.tagname, ', ') |
| | | FROM pat_archivetag dd |
| | |
| | | <where> |
| | | d.del_flag != 1 |
| | | AND a.del_flag != 1 |
| | | <if test="reservedPhone != null ">and a.reserved_phone = #{reservedPhone}</if> |
| | | <if test="patid != null and patid != ''">and a.id = #{patid}</if> |
| | | <if test="tagname != null and tagname != ''">and t.tagname like concat('%', #{tagname}, '%')</if> |
| | | <if test="name != null and name != ''">and a.name like concat('%', #{name}, '%')</if> |
| | |
| | | a.create_time, |
| | | a.isupload, |
| | | a.upload_time, |
| | | a.reserved_phone, |
| | | COALESCE(( |
| | | SELECT string_agg(dd.tagname, ', ') |
| | | FROM pat_archivetag dd |
| | |
| | | <where> |
| | | d.del_flag != 1 |
| | | AND a.del_flag != 1 |
| | | <if test="reservedPhone != null ">and a.reserved_phone = #{reservedPhone}</if> |
| | | <if test="patid != null and patid != ''">and a.id = #{patid}</if> |
| | | <if test="tagname != null and tagname != ''">and t.tagname like concat('%', #{tagname}, '%')</if> |
| | | <if test="name != null and name != ''">and a.name like concat('%', #{name}, '%')</if> |
| | |
| | | a.isupload, |
| | | a.upload_time, |
| | | a.pattype, |
| | | a.reserved_phone, |
| | | d.bed_no, |
| | | d.starttime, |
| | | d.endtime, |
| | |
| | | <where> |
| | | d.del_flag != 1 |
| | | AND a.del_flag != 1 |
| | | <if test="reservedPhone != null ">and a.reserved_phone = #{reservedPhone}</if> |
| | | <if test="name != null and name != ''">AND a.name LIKE concat('%', #{name}, '%')</if> |
| | | <if test="idcardno != null and idcardno != ''">AND a.idcardno = #{idcardno}</if> |
| | | <if test="tagname != null and tagname != ''"> |
| | |
| | | <if test="deptname != null and deptname != ''">AND d.deptname LIKE concat('%', #{deptname}, '%')</if> |
| | | <if test="drname != null and drname != ''">AND d.drname LIKE concat('%',#{drname}, '%')</if> |
| | | <if test="diagname != null and diagname != ''">AND d.diagname LIKE concat('%',#{diagname}, '%')</if> |
| | | <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0"> |
| | | <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0 and leaveldeptcodes == null"> |
| | | AND d.leavehospitaldistrictcode IN |
| | | <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator="," |
| | | close=")"> |
| | | #{leavehospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0 and leaveldeptcodes != null and leaveldeptcodes.size() > 0"> |
| | | AND (d.leavehospitaldistrictcode IN |
| | | <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator="," |
| | | close=")"> |
| | | #{leavehospitaldistrictcode} |
| | |
| | | </if> |
| | | <if test="leaveldeptcodes != null and leaveldeptcodes.size() > 0 and leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0"> |
| | | OR d.leaveldeptcode IN |
| | | <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," close=")"> |
| | | <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," close="))"> |
| | | #{leaveldeptcode} |
| | | </foreach> |
| | | </if> |
| | |
| | | a.create_by, |
| | | a.create_time, |
| | | a.isupload, |
| | | a.reserved_phone, |
| | | a.upload_time, |
| | | rt.tagname, |
| | | ROW_NUMBER() OVER (PARTITION BY a.idcardno ORDER BY a.update_time DESC) AS rn, |
| | |
| | | AND a.del_flag != 1 |
| | | AND d.admitdate >= CURRENT_DATE - INTERVAL '90 days' <!-- 强烈推荐加时间限制 --> |
| | | <if test="patid != null and patid != ''">AND a.id = #{patid}</if> |
| | | <if test="reservedPhone != null ">and a.reserved_phone = #{reservedPhone}</if> |
| | | <if test="tagname != null and tagname != ''">AND rt.tagname LIKE concat('%', #{tagname}, '%')</if> |
| | | <if test="name != null and name != ''">AND a.name LIKE concat('%', #{name}, '%')</if> |
| | | <if test="idcardno != null and idcardno != ''">AND a.idcardno = #{idcardno}</if> |
| | |
| | | a.create_time, |
| | | a.isupload, |
| | | a.upload_time, |
| | | a.reserved_phone, |
| | | COALESCE(( |
| | | SELECT string_agg(dd.tagname, ', ') |
| | | FROM pat_archivetag dd |
| | |
| | | <where> |
| | | d.del_flag != 1 |
| | | AND a.del_flag != 1 |
| | | <if test="reservedPhone != null ">and a.reserved_phone = #{reservedPhone}</if> |
| | | <if test="patid != null and patid != ''">and a.id = #{patid}</if> |
| | | <if test="tagname != null and tagname != ''">and t.tagname like concat('%', #{tagname}, '%')</if> |
| | | <if test="name != null and name != ''">and a.name like concat('%', #{name}, '%')</if> |