医院删除功能改为逻辑删除

就诊记录增加删除功能,修改获取列表sql逻辑
患者列表获取sql逻辑修改
master
gongzhenkun 2 years ago
parent 5f867093c6
commit e92bdc2a67

@ -39,6 +39,17 @@ public class THospital extends BaseEntity
@Excel(name = "管理员ID")
private Long adminId;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
public void setId(Long id)
{
this.id = id;

@ -9,10 +9,11 @@
<result property="name" column="name" />
<result property="num" column="num" />
<result property="adminId" column="admin_id" />
<result property="delFlag" column="del_flag"/>
</resultMap>
<sql id="selectTHospitalVo">
select id, name, num, admin_id from t_hospital
select id, name, num, admin_id, del_flag from t_hospital
</sql>
<select id="selectTHospitalList" parameterType="THospital" resultMap="THospitalResult">
@ -21,6 +22,7 @@
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="num != null "> and num = #{num}</if>
<if test="adminId != null "> and admin_id = #{adminId}</if>
<if test="delFlag != null and delFlag != ''">and del_flag = #{delFlag}</if>
</where>
order by num asc
</select>
@ -36,11 +38,13 @@
<if test="name != null and name != ''">name,</if>
<if test="num != null">num,</if>
<if test="adminId != null">admin_id,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="num != null">#{num},</if>
<if test="adminId != null">#{adminId},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
@ -50,6 +54,7 @@
<if test="name != null and name != ''">name = #{name},</if>
<if test="num != null">num = #{num},</if>
<if test="adminId != null">admin_id = #{adminId},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
@ -59,7 +64,7 @@
</delete>
<delete id="deleteTHospitalByIds" parameterType="String">
delete from t_hospital where id in
update t_hospital set del_flag = '2' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@ -71,11 +76,13 @@
a.name,
a.num,
a.admin_id as adminId,
a.del_flag as delFlag,
b.user_name as adminName
from t_hospital a left join sys_user b on a.admin_id = b.user_id
<where>
1=1
<if test="name != null and name != ''"> and a.name like concat('%', #{name}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and a.del_flag = #{delFlag}</if>
</where>
order by a.num
</select>

@ -152,7 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sex !=null and sex !=''">and tp.sex = #{sex} </if>
<if test="identifier !=null and identifier != ''">and tp.identifier like concat('%', #{identifier}, '%')</if>
<if test="delFlag == null">
and td.del_flag = '0' and tp.del_flag = '0' and tr.del_flag = '0'
and td.del_flag = '0' and tp.del_flag = '0' and tr.del_flag = '0' and th.del_flag = '0'
</if>
<if test="createTime != null and createTime !='' and createTime != 'all'">
and DATE_FORMAT(tp.create_time,'%Y-%m') = #{createTime}
@ -192,7 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.name
from t_record a LEFT JOIN t_patient b on a.patient_id = b.id
where TO_DAYS(a.create_time) = TO_DAYS(NOW())
and b.del_flag = 0
and b.del_flag = 0 and a.del_flag = 0
<if test="doctorId != null "> and a.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and a.hospital_id = #{hospitalId}</if>
ORDER BY a.create_time desc
@ -220,7 +220,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from t_patient a
inner JOIN t_record b on a.id = b.patient_id
where 1 = 1
and a.del_flag = 0
and a.del_flag = 0 and b.del_flag = 0
<if test="doctorId != null "> and b.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and b.hospital_id = #{hospitalId}</if>
</select>
@ -271,6 +271,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="doctorId != null "> and t.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and t.hospital_id = #{hospitalId}</if>
<if test="status != null and status != ''"> and t.status = #{status}</if>
and t.del_flag = '0'
</where>
order by t.create_time desc
</select>
@ -310,8 +311,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="sex !=null and sex !=''">and tp.sex = #{sex} </if>
<if test="identifier !=null and identifier != ''">and tp.identifier like concat('%', #{identifier}, '%')</if>
<if test="delFlag == null">
and td.del_flag = '0' and tp.del_flag = '0' and tr.del_flag = '0'
<if test="delFlag != null and delFlag != ''">
and tr.del_flag = #{delFlag}
</if>
<if test="createTime != null and createTime !='' and createTime != 'all'">
and DATE_FORMAT(tp.create_time,'%Y-%m') = #{createTime}
@ -345,7 +346,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sex !=null and sex !=''">and tp.sex = #{sex} </if>
<if test="identifier !=null and identifier != ''">and tp.identifier like concat('%', #{identifier}, '%')</if>
<if test="delFlag == null">
and td.del_flag = '0' and tp.del_flag = '0' and tr.del_flag = '0'
and td.del_flag = '0' and tp.del_flag = '0' and tr.del_flag = '0' and th.del_flag = '0'
</if>
<if test="createTime != null and createTime !='' and createTime != 'all'">
and DATE_FORMAT(tp.create_time,'%Y-%m') = #{createTime}
@ -435,7 +436,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteTRecordByIds" parameterType="String">
delete from t_record where id in
update t_record set del_flag = '2',update_time = sysdate() where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

Loading…
Cancel
Save