手术名称管理模块:查询手术信息列表,获取手术信息详细信息,新增、修改、删除手术信息

This commit is contained in:
youxilong 2024-02-26 14:38:46 +08:00
parent d4db6a8397
commit 86245219ac
6 changed files with 677 additions and 0 deletions

View File

@ -0,0 +1,101 @@
package com.xinelu.manage.controller.operationInfo;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.operationInfo.OperationInfo;
import com.xinelu.manage.service.operationInfo.IOperationInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 手术信息Controller
*
* @author xinelu
* @date 2024-02-26
*/
@Api(tags = "手术信息控制器")
@RestController
@RequestMapping("/operationInfo/operationInfo")
public class OperationInfoController extends BaseController {
@Resource
private IOperationInfoService operationInfoService;
/**
* 查询手术信息列表
*/
@ApiOperation("查询手术信息列表")
@PreAuthorize("@ss.hasPermi('operationInfo:operationInfo:list')")
@GetMapping("/list")
public TableDataInfo list(OperationInfo operationInfo) {
startPage();
List<OperationInfo> list = operationInfoService.selectOperationInfoList(operationInfo);
return getDataTable(list);
}
/**
* 导出手术信息列表
*/
@ApiOperation("导出手术信息列表")
@PreAuthorize("@ss.hasPermi('operationInfo:operationInfo:export')")
@Log(title = "手术信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, OperationInfo operationInfo) {
List<OperationInfo> list = operationInfoService.selectOperationInfoList(operationInfo);
ExcelUtil<OperationInfo> util = new ExcelUtil<OperationInfo>(OperationInfo.class);
util.exportExcel(response, list, "手术信息数据");
}
/**
* 获取手术信息详细信息
*/
@ApiOperation("获取手术信息详细信息")
@PreAuthorize("@ss.hasPermi('operationInfo:operationInfo:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(operationInfoService.selectOperationInfoById(id));
}
/**
* 新增手术信息
*/
@ApiOperation("新增手术信息")
@PreAuthorize("@ss.hasPermi('operationInfo:operationInfo:add')")
@Log(title = "手术信息", businessType = BusinessType.INSERT)
@PostMapping(value = "/add")
public AjaxResult add(@RequestBody OperationInfo operationInfo) {
return toAjax(operationInfoService.insertOperationInfo(operationInfo));
}
/**
* 修改手术信息
*/
@ApiOperation("修改手术信息")
@PreAuthorize("@ss.hasPermi('operationInfo:operationInfo:edit')")
@Log(title = "手术信息", businessType = BusinessType.UPDATE)
@PutMapping(value = "/edit")
public AjaxResult edit(@RequestBody OperationInfo operationInfo) {
return toAjax(operationInfoService.updateOperationInfo(operationInfo));
}
/**
* 删除手术信息
*/
@ApiOperation("删除手术信息")
@PreAuthorize("@ss.hasPermi('operationInfo:operationInfo:remove')")
@Log(title = "手术信息", businessType = BusinessType.DELETE)
@DeleteMapping("remove/{id}")
public AjaxResult remove(@PathVariable Long id) {
return toAjax(operationInfoService.deleteOperationInfoById(id));
}
}

View File

@ -0,0 +1,100 @@
package com.xinelu.manage.domain.operationInfo;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 手术信息对象 operation_info
*
* @author xinelu
* @date 2024-02-26
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "手术信息对象", description = "operation_info")
public class OperationInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 所属科室id
*/
@ApiModelProperty(value = "所属科室id")
@Excel(name = "所属科室id")
private Long departmentId;
/**
* 所属科室名称
*/
@ApiModelProperty(value = "所属科室名称")
@Excel(name = "所属科室名称")
private String departmentName;
/**
* 手术名称
*/
@ApiModelProperty(value = "手术名称")
@Excel(name = "手术名称")
private String operationName;
/**
* 手术编号
*/
@ApiModelProperty(value = "手术编号")
@Excel(name = "手术编号")
private String operationCode;
/**
* 术式信息
*/
@ApiModelProperty(value = "术式信息")
@Excel(name = "术式信息")
private String operationInfo;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
@Excel(name = "备注")
private String operationRemark;
/**
* 排序
*/
@ApiModelProperty(value = "排序")
@Excel(name = "排序")
private Integer sort;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("departmentId", getDepartmentId())
.append("departmentName", getDepartmentName())
.append("operationName", getOperationName())
.append("operationCode", getOperationCode())
.append("operationInfo", getOperationInfo())
.append("operationRemark", getOperationRemark())
.append("sort", getSort())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,81 @@
package com.xinelu.manage.mapper.operationInfo;
import com.xinelu.manage.domain.operationInfo.OperationInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 手术信息Mapper接口
*
* @author xinelu
* @date 2024-02-26
*/
public interface OperationInfoMapper {
/**
* 查询手术信息
*
* @param id 手术信息主键
* @return 手术信息
*/
public OperationInfo selectOperationInfoById(Long id);
/**
* 查询手术信息列表
*
* @param operationInfo 手术信息
* @return 手术信息集合
*/
public List<OperationInfo> selectOperationInfoList(OperationInfo operationInfo);
/**
* 新增手术信息
*
* @param operationInfo 手术信息
* @return 结果
*/
public int insertOperationInfo(OperationInfo operationInfo);
/**
* 修改手术信息
*
* @param operationInfo 手术信息
* @return 结果
*/
public int updateOperationInfo(OperationInfo operationInfo);
/**
* 删除手术信息
*
* @param id 手术信息主键
* @return 结果
*/
public int deleteOperationInfoById(Long id);
/**
* 批量删除手术信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteOperationInfoByIds(Long[] ids);
/**
* 检查所属科室下手术名称是否重复
*
* @param departmentId
* @param operationName
* @return
*/
int countByDepartmentIdAndOperationName(@Param("departmentId") Long departmentId, @Param("operationName") String operationName);
/**
* 检查所属科室同一手术名称下术式信息是否重复
*
* @param departmentId
* @param operationName
* @param operationInfo
* @return
*/
int countByDepartmentIdAndOperationInfo(@Param("departmentId") Long departmentId, @Param("operationName") String operationName, @Param("operationInfo") String operationInfo);
}

View File

@ -0,0 +1,61 @@
package com.xinelu.manage.service.operationInfo;
import com.xinelu.manage.domain.operationInfo.OperationInfo;
import java.util.List;
/**
* 手术信息Service接口
*
* @author xinelu
* @date 2024-02-26
*/
public interface IOperationInfoService {
/**
* 查询手术信息
*
* @param id 手术信息主键
* @return 手术信息
*/
public OperationInfo selectOperationInfoById(Long id);
/**
* 查询手术信息列表
*
* @param operationInfo 手术信息
* @return 手术信息集合
*/
public List<OperationInfo> selectOperationInfoList(OperationInfo operationInfo);
/**
* 新增手术信息
*
* @param operationInfo 手术信息
* @return 结果
*/
public int insertOperationInfo(OperationInfo operationInfo);
/**
* 修改手术信息
*
* @param operationInfo 手术信息
* @return 结果
*/
public int updateOperationInfo(OperationInfo operationInfo);
/**
* 批量删除手术信息
*
* @param ids 需要删除的手术信息主键集合
* @return 结果
*/
public int deleteOperationInfoByIds(Long[] ids);
/**
* 删除手术信息信息
*
* @param id 手术信息主键
* @return 结果
*/
public int deleteOperationInfoById(Long id);
}

View File

@ -0,0 +1,131 @@
package com.xinelu.manage.service.operationInfo.impl;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.StringUtils;
import com.xinelu.manage.domain.operationInfo.OperationInfo;
import com.xinelu.manage.mapper.operationInfo.OperationInfoMapper;
import com.xinelu.manage.service.operationInfo.IOperationInfoService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 手术信息Service业务层处理
*
* @author xinelu
* @date 2024-02-26
*/
@Service
public class OperationInfoServiceImpl implements IOperationInfoService {
@Resource
private OperationInfoMapper operationInfoMapper;
/**
* 查询手术信息
*
* @param id 手术信息主键
* @return 手术信息
*/
@Override
public OperationInfo selectOperationInfoById(Long id) {
return operationInfoMapper.selectOperationInfoById(id);
}
/**
* 查询手术信息列表
*
* @param operationInfo 手术信息
* @return 手术信息
*/
@Override
public List<OperationInfo> selectOperationInfoList(OperationInfo operationInfo) {
return operationInfoMapper.selectOperationInfoList(operationInfo);
}
/**
* 新增手术信息
*
* @param operationInfo 手术信息
* @return 结果
*/
@Override
public int insertOperationInfo(OperationInfo operationInfo) {
// 检查手术名称是否为空
if (StringUtils.isEmpty(operationInfo.getOperationName())) {
throw new ServiceException("手术名称不能为空");
}
// 检查手术信息是否为空
if (StringUtils.isEmpty(operationInfo.getOperationInfo())) {
throw new ServiceException("术式信息不能为空");
}
// 检查手术名称是否已存在
int existingNameCount = operationInfoMapper.countByDepartmentIdAndOperationName(operationInfo.getDepartmentId(), operationInfo.getOperationName());
if (existingNameCount > 0) {
throw new ServiceException("手术名称已存在");
}
// 检查在所属科室同一手术名称下术式信息是否已存在
int existingInfoCount = operationInfoMapper.countByDepartmentIdAndOperationInfo(operationInfo.getDepartmentId(), operationInfo.getOperationName(), operationInfo.getOperationInfo());
if (existingInfoCount > 0) {
throw new ServiceException("术式信息已存在");
}
// 设置创建人创建时间
operationInfo.setCreateBy(SecurityUtils.getUsername());
operationInfo.setCreateTime(DateUtils.getNowDate());
return operationInfoMapper.insertOperationInfo(operationInfo);
}
/**
* 修改手术信息
*
* @param operationInfo 手术信息
* @return 结果
*/
@Override
public int updateOperationInfo(OperationInfo operationInfo) {
// 检查手术信息是否为空
if (StringUtils.isEmpty(operationInfo.getOperationInfo())) {
throw new ServiceException("术式信息不能为空");
}
// 检查在所属科室同一手术名称下术式信息是否已存在
int existingInfoCount = operationInfoMapper.countByDepartmentIdAndOperationInfo(operationInfo.getDepartmentId(), operationInfo.getOperationName(), operationInfo.getOperationInfo());
if (existingInfoCount > 0) {
throw new ServiceException("术式信息已存在");
}
// 设置修改人修改时间
operationInfo.setUpdateBy(SecurityUtils.getUsername());
operationInfo.setUpdateTime(DateUtils.getNowDate());
return operationInfoMapper.updateOperationInfo(operationInfo);
}
/**
* 批量删除手术信息
*
* @param ids 需要删除的手术信息主键
* @return 结果
*/
@Override
public int deleteOperationInfoByIds(Long[] ids) {
return operationInfoMapper.deleteOperationInfoByIds(ids);
}
/**
* 删除手术信息
*
* @param id 手术信息主键
* @return 结果
*/
@Override
public int deleteOperationInfoById(Long id) {
// 根据id查询手术信息是否存在
OperationInfo operationInfo = operationInfoMapper.selectOperationInfoById(id);
if (ObjectUtils.isEmpty(operationInfo)) {
throw new ServiceException("要删除的手术信息不存在");
}
return operationInfoMapper.deleteOperationInfoById(id);
}
}

View File

@ -0,0 +1,203 @@
<?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.xinelu.manage.mapper.operationInfo.OperationInfoMapper">
<resultMap type="OperationInfo" id="OperationInfoResult">
<result property="id" column="id"/>
<result property="departmentId" column="department_id"/>
<result property="departmentName" column="department_name"/>
<result property="operationName" column="operation_name"/>
<result property="operationCode" column="operation_code"/>
<result property="operationInfo" column="operation_info"/>
<result property="operationRemark" column="operation_remark"/>
<result property="sort" column="sort"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectOperationInfoVo">
select id,
department_id,
department_name,
operation_name,
operation_code,
operation_info,
operation_remark,
sort,
create_by,
create_time,
update_by,
update_time
from operation_info
</sql>
<select id="selectOperationInfoList" parameterType="OperationInfo" resultMap="OperationInfoResult">
<include refid="selectOperationInfoVo"/>
<where>
<if test="departmentId != null ">
and department_id =
#{departmentId}
</if>
<if test="departmentName != null and departmentName != ''">
and department_name like concat('%',
#{departmentName},
'%'
)
</if>
<if test="operationName != null and operationName != ''">
and operation_name like concat('%',
#{operationName},
'%'
)
</if>
<if test="operationCode != null and operationCode != ''">
and operation_code =
#{operationCode}
</if>
<if test="operationInfo != null and operationInfo != ''">
and operation_info =
#{operationInfo}
</if>
<if test="operationRemark != null and operationRemark != ''">
and operation_remark =
#{operationRemark}
</if>
<if test="sort != null ">
and sort =
#{sort}
</if>
</where>
</select>
<select id="selectOperationInfoById" parameterType="Long"
resultMap="OperationInfoResult">
<include refid="selectOperationInfoVo"/>
where id = #{id}
</select>
<select id="countByDepartmentIdAndOperationName" resultType="java.lang.Integer">
select count(*)
from operation_info
where department_id = #{departmentId}
and operation_name = #{operationName}
</select>
<select id="countByDepartmentIdAndOperationInfo" resultType="java.lang.Integer">
select count(*)
from operation_info
where department_id = #{departmentId}
and operation_name = #{operationName}
and operation_info = #{operationInfo}
</select>
<insert id="insertOperationInfo" parameterType="OperationInfo" useGeneratedKeys="true"
keyProperty="id">
insert into operation_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="departmentId != null">department_id,
</if>
<if test="departmentName != null">department_name,
</if>
<if test="operationName != null">operation_name,
</if>
<if test="operationCode != null">operation_code,
</if>
<if test="operationInfo != null">operation_info,
</if>
<if test="operationRemark != null">operation_remark,
</if>
<if test="sort != null">sort,
</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="departmentId != null">#{departmentId},
</if>
<if test="departmentName != null">#{departmentName},
</if>
<if test="operationName != null">#{operationName},
</if>
<if test="operationCode != null">#{operationCode},
</if>
<if test="operationInfo != null">#{operationInfo},
</if>
<if test="operationRemark != null">#{operationRemark},
</if>
<if test="sort != null">#{sort},
</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>
</trim>
</insert>
<update id="updateOperationInfo" parameterType="OperationInfo">
update operation_info
<trim prefix="SET" suffixOverrides=",">
<if test="departmentId != null">department_id =
#{departmentId},
</if>
<if test="departmentName != null">department_name =
#{departmentName},
</if>
<if test="operationName != null">operation_name =
#{operationName},
</if>
<if test="operationCode != null">operation_code =
#{operationCode},
</if>
<if test="operationInfo != null">operation_info =
#{operationInfo},
</if>
<if test="operationRemark != null">operation_remark =
#{operationRemark},
</if>
<if test="sort != null">sort =
#{sort},
</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>
</trim>
where id = #{id}
</update>
<delete id="deleteOperationInfoById" parameterType="Long">
delete
from operation_info
where id = #{id}
</delete>
<delete id="deleteOperationInfoByIds" parameterType="String">
delete from operation_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>