Commit 4a0fa139 authored by gaoyingwei's avatar gaoyingwei

新增 危重症人员

parent 4854f366
package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Wzzry;
import com.ruoyi.system.service.IWzzryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 危重症人员Controller
*
* @author ruoyi
* @date 2022-12-02
*/
@RestController
@RequestMapping("/system/wzzry")
public class WzzryController extends BaseController
{
@Autowired
private IWzzryService wzzryService;
/**
* 查询危重症人员列表
*/
@PreAuthorize("@ss.hasPermi('system:wzzry:list')")
@GetMapping("/list")
public TableDataInfo list(Wzzry wzzry)
{
startPage();
List<Wzzry> list = wzzryService.selectWzzryList(wzzry);
return getDataTable(list);
}
/**
* 导出危重症人员列表
*/
@PreAuthorize("@ss.hasPermi('system:wzzry:export')")
@Log(title = "危重症人员", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Wzzry wzzry)
{
List<Wzzry> list = wzzryService.selectWzzryList(wzzry);
ExcelUtil<Wzzry> util = new ExcelUtil<Wzzry>(Wzzry.class);
util.exportExcel(response, list, "危重症人员数据");
}
/**
* 获取危重症人员详细信息
*/
@PreAuthorize("@ss.hasPermi('system:wzzry:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(wzzryService.selectWzzryById(id));
}
/**
* 新增危重症人员
*/
@PreAuthorize("@ss.hasPermi('system:wzzry:add')")
@Log(title = "危重症人员", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Wzzry wzzry)
{
return toAjax(wzzryService.insertWzzry(wzzry));
}
/**
* 修改危重症人员
*/
@PreAuthorize("@ss.hasPermi('system:wzzry:edit')")
@Log(title = "危重症人员", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Wzzry wzzry)
{
return toAjax(wzzryService.updateWzzry(wzzry));
}
/**
* 删除危重症人员
*/
@PreAuthorize("@ss.hasPermi('system:wzzry:remove')")
@Log(title = "危重症人员", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(wzzryService.deleteWzzryByIds(ids));
}
}
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 危重症人员对象 wzzry
*
* @author ruoyi
* @date 2022-12-02
*/
public class Wzzry extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 姓名 */
@Excel(name = "姓名")
private String userName;
/** 身份证号码 */
@Excel(name = "身份证号码")
private String cardNo;
/** 联系方式 */
@Excel(name = "联系方式")
private String phone;
/** 街道/镇 */
@Excel(name = "街道/镇")
private String street;
/** 居委会 */
@Excel(name = "居委会")
private String committee;
/** 小区/村名称 */
@Excel(name = "小区/村名称")
private String community;
/** 楼号 */
@Excel(name = "楼号")
private String building;
/** 单元号 */
@Excel(name = "单元号")
private String unit;
/** 楼层 */
@Excel(name = "楼层")
private String floor;
/** 门牌号 */
@Excel(name = "门牌号")
private String house;
/** 住址 */
@Excel(name = "住址")
private String address;
/** 基础病情况(逗号分割) */
@Excel(name = "基础病情况", readConverterExp = "逗=号分割")
private String basicDisease;
/** 是否有人照顾(0:是,1:否) */
@Excel(name = "是否有人照顾", readConverterExp = "0=:是,1:否")
private String isCare;
/** 同住人数(不包括自己) */
@Excel(name = "同住人数(不包括自己)")
private Long cohabitantsNumber;
/** 状态(0正常 1停用) */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setCardNo(String cardNo)
{
this.cardNo = cardNo;
}
public String getCardNo()
{
return cardNo;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setStreet(String street)
{
this.street = street;
}
public String getStreet()
{
return street;
}
public void setCommittee(String committee)
{
this.committee = committee;
}
public String getCommittee()
{
return committee;
}
public void setCommunity(String community)
{
this.community = community;
}
public String getCommunity()
{
return community;
}
public void setBuilding(String building)
{
this.building = building;
}
public String getBuilding()
{
return building;
}
public void setUnit(String unit)
{
this.unit = unit;
}
public String getUnit()
{
return unit;
}
public void setFloor(String floor)
{
this.floor = floor;
}
public String getFloor()
{
return floor;
}
public void setHouse(String house)
{
this.house = house;
}
public String getHouse()
{
return house;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setBasicDisease(String basicDisease)
{
this.basicDisease = basicDisease;
}
public String getBasicDisease()
{
return basicDisease;
}
public void setIsCare(String isCare)
{
this.isCare = isCare;
}
public String getIsCare()
{
return isCare;
}
public void setCohabitantsNumber(Long cohabitantsNumber)
{
this.cohabitantsNumber = cohabitantsNumber;
}
public Long getCohabitantsNumber()
{
return cohabitantsNumber;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userName", getUserName())
.append("cardNo", getCardNo())
.append("phone", getPhone())
.append("street", getStreet())
.append("committee", getCommittee())
.append("community", getCommunity())
.append("building", getBuilding())
.append("unit", getUnit())
.append("floor", getFloor())
.append("house", getHouse())
.append("address", getAddress())
.append("basicDisease", getBasicDisease())
.append("isCare", getIsCare())
.append("cohabitantsNumber", getCohabitantsNumber())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.Wzzry;
/**
* 危重症人员Mapper接口
*
* @author ruoyi
* @date 2022-12-02
*/
public interface WzzryMapper
{
/**
* 查询危重症人员
*
* @param id 危重症人员主键
* @return 危重症人员
*/
public Wzzry selectWzzryById(Long id);
/**
* 查询危重症人员列表
*
* @param wzzry 危重症人员
* @return 危重症人员集合
*/
public List<Wzzry> selectWzzryList(Wzzry wzzry);
/**
* 新增危重症人员
*
* @param wzzry 危重症人员
* @return 结果
*/
public int insertWzzry(Wzzry wzzry);
/**
* 修改危重症人员
*
* @param wzzry 危重症人员
* @return 结果
*/
public int updateWzzry(Wzzry wzzry);
/**
* 删除危重症人员
*
* @param id 危重症人员主键
* @return 结果
*/
public int deleteWzzryById(Long id);
/**
* 批量删除危重症人员
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWzzryByIds(Long[] ids);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.Wzzry;
/**
* 危重症人员Service接口
*
* @author ruoyi
* @date 2022-12-02
*/
public interface IWzzryService
{
/**
* 查询危重症人员
*
* @param id 危重症人员主键
* @return 危重症人员
*/
public Wzzry selectWzzryById(Long id);
/**
* 查询危重症人员列表
*
* @param wzzry 危重症人员
* @return 危重症人员集合
*/
public List<Wzzry> selectWzzryList(Wzzry wzzry);
/**
* 新增危重症人员
*
* @param wzzry 危重症人员
* @return 结果
*/
public int insertWzzry(Wzzry wzzry);
/**
* 修改危重症人员
*
* @param wzzry 危重症人员
* @return 结果
*/
public int updateWzzry(Wzzry wzzry);
/**
* 批量删除危重症人员
*
* @param ids 需要删除的危重症人员主键集合
* @return 结果
*/
public int deleteWzzryByIds(Long[] ids);
/**
* 删除危重症人员信息
*
* @param id 危重症人员主键
* @return 结果
*/
public int deleteWzzryById(Long id);
}
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.system.mapper.WzzryMapper;
import com.ruoyi.system.domain.Wzzry;
import com.ruoyi.system.service.IWzzryService;
/**
* 危重症人员Service业务层处理
*
* @author ruoyi
* @date 2022-12-02
*/
@Service
public class WzzryServiceImpl implements IWzzryService
{
@Autowired
private WzzryMapper wzzryMapper;
/**
* 查询危重症人员
*
* @param id 危重症人员主键
* @return 危重症人员
*/
@Override
public Wzzry selectWzzryById(Long id)
{
return wzzryMapper.selectWzzryById(id);
}
/**
* 查询危重症人员列表
*
* @param wzzry 危重症人员
* @return 危重症人员
*/
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<Wzzry> selectWzzryList(Wzzry wzzry)
{
return wzzryMapper.selectWzzryList(wzzry);
}
/**
* 新增危重症人员
*
* @param wzzry 危重症人员
* @return 结果
*/
@Override
public int insertWzzry(Wzzry wzzry)
{
wzzry.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
wzzry.setCreateTime(DateUtils.getNowDate());
return wzzryMapper.insertWzzry(wzzry);
}
/**
* 修改危重症人员
*
* @param wzzry 危重症人员
* @return 结果
*/
@Override
public int updateWzzry(Wzzry wzzry)
{
wzzry.setUpdateTime(DateUtils.getNowDate());
return wzzryMapper.updateWzzry(wzzry);
}
/**
* 批量删除危重症人员
*
* @param ids 需要删除的危重症人员主键
* @return 结果
*/
@Override
public int deleteWzzryByIds(Long[] ids)
{
return wzzryMapper.deleteWzzryByIds(ids);
}
/**
* 删除危重症人员信息
*
* @param id 危重症人员主键
* @return 结果
*/
@Override
public int deleteWzzryById(Long id)
{
return wzzryMapper.deleteWzzryById(id);
}
}
<?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.ruoyi.system.mapper.WzzryMapper">
<resultMap type="Wzzry" id="WzzryResult">
<result property="id" column="id" />
<result property="userName" column="user_name" />
<result property="cardNo" column="card_no" />
<result property="phone" column="phone" />
<result property="street" column="street" />
<result property="committee" column="committee" />
<result property="community" column="community" />
<result property="building" column="building" />
<result property="unit" column="unit" />
<result property="floor" column="floor" />
<result property="house" column="house" />
<result property="address" column="address" />
<result property="basicDisease" column="basic_disease" />
<result property="isCare" column="is_care" />
<result property="cohabitantsNumber" column="cohabitants_number" />
<result property="status" column="status" />
<result property="delFlag" 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="remark" column="remark" />
</resultMap>
<sql id="selectWzzryVo">
select id, user_name, card_no, phone, street, committee, community, building, unit, floor, house, address, basic_disease, is_care, cohabitants_number, status, del_flag, create_by, create_time, update_by, update_time, remark from wzzry
</sql>
<select id="selectWzzryList" parameterType="Wzzry" resultMap="WzzryResult">
select a.id, a.user_name, a.card_no, a.phone, a.street, a.committee, a.community, a.building, a.unit, a.floor, a.house, a.address, a.basic_disease, a.is_care, a.cohabitants_number, a.status, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark from wzzry a
left join sys_user u on u.user_id = a.create_by
left join sys_dept d on u.dept_id = d.dept_id
where a.del_flag = 0
<if test="userName != null and userName != ''"> and a.user_name like concat('%', #{userName}, '%')</if>
<if test="cardNo != null and cardNo != ''"> and a.card_no like concat('%', #{cardNo}, '%')</if>
<if test="phone != null and phone != ''"> and a.phone like concat('%', #{phone}, '%')</if>
<if test="street != null and street != ''"> and a.street = #{street}</if>
<if test="committee != null and committee != ''"> and a.committee = #{committee}</if>
<if test="community != null and community != ''"> and a.community = #{community}</if>
<if test="building != null and building != ''"> and a.building like concat('%', #{building}, '%')</if>
<if test="unit != null and unit != ''"> and a.unit like concat('%', #{unit}, '%')</if>
<if test="floor != null and floor != ''"> and a.floor = #{floor}</if>
<if test="house != null and house != ''"> and a.house like concat('%', #{house}, '%')</if>
<if test="address != null and address != ''"> and a.address like concat('%', #{address}, '%')</if>
<if test="basicDisease != null and basicDisease != ''"> and a.basic_disease = #{basicDisease}</if>
<if test="isCare != null and isCare != ''"> and a.is_care = #{isCare}</if>
<if test="cohabitantsNumber != null "> and a.cohabitants_number like concat('%', #{cohabitantsNumber}, '%')</if>
<if test="status != null and status != ''"> and a.status = #{status}</if>
${params.dataScope}
</select>
<select id="selectWzzryById" parameterType="Long" resultMap="WzzryResult">
<include refid="selectWzzryVo"/>
where id = #{id}
</select>
<insert id="insertWzzry" parameterType="Wzzry" useGeneratedKeys="true" keyProperty="id">
insert into wzzry
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userName != null">user_name,</if>
<if test="cardNo != null">card_no,</if>
<if test="phone != null">phone,</if>
<if test="street != null">street,</if>
<if test="committee != null">committee,</if>
<if test="community != null">community,</if>
<if test="building != null">building,</if>
<if test="unit != null">unit,</if>
<if test="floor != null">floor,</if>
<if test="house != null">house,</if>
<if test="address != null">address,</if>
<if test="basicDisease != null">basic_disease,</if>
<if test="isCare != null">is_care,</if>
<if test="cohabitantsNumber != null">cohabitants_number,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null">#{userName},</if>
<if test="cardNo != null">#{cardNo},</if>
<if test="phone != null">#{phone},</if>
<if test="street != null">#{street},</if>
<if test="committee != null">#{committee},</if>
<if test="community != null">#{community},</if>
<if test="building != null">#{building},</if>
<if test="unit != null">#{unit},</if>
<if test="floor != null">#{floor},</if>
<if test="house != null">#{house},</if>
<if test="address != null">#{address},</if>
<if test="basicDisease != null">#{basicDisease},</if>
<if test="isCare != null">#{isCare},</if>
<if test="cohabitantsNumber != null">#{cohabitantsNumber},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateWzzry" parameterType="Wzzry">
update wzzry
<trim prefix="SET" suffixOverrides=",">
<if test="userName != null">user_name = #{userName},</if>
<if test="cardNo != null">card_no = #{cardNo},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="street != null">street = #{street},</if>
<if test="committee != null">committee = #{committee},</if>
<if test="community != null">community = #{community},</if>
<if test="building != null">building = #{building},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="floor != null">floor = #{floor},</if>
<if test="house != null">house = #{house},</if>
<if test="address != null">address = #{address},</if>
<if test="basicDisease != null">basic_disease = #{basicDisease},</if>
<if test="isCare != null">is_care = #{isCare},</if>
<if test="cohabitantsNumber != null">cohabitants_number = #{cohabitantsNumber},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWzzryById" parameterType="Long">
delete from wzzry where id = #{id}
</delete>
<delete id="deleteWzzryByIds" parameterType="String">
update wzzry set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询危重症人员列表
export function listWzzry(query) {
return request({
url: '/system/wzzry/list',
method: 'get',
params: query
})
}
// 查询危重症人员详细
export function getWzzry(id) {
return request({
url: '/system/wzzry/' + id,
method: 'get'
})
}
// 新增危重症人员
export function addWzzry(data) {
return request({
url: '/system/wzzry',
method: 'post',
data: data
})
}
// 修改危重症人员
export function updateWzzry(data) {
return request({
url: '/system/wzzry',
method: 'put',
data: data
})
}
// 删除危重症人员
export function delWzzry(id) {
return request({
url: '/system/wzzry/' + id,
method: 'delete'
})
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment