From a52bbd168ec9012e8e0a0747f6132728dd11a425 Mon Sep 17 00:00:00 2001 From: youxilong Date: Mon, 26 Feb 2024 17:54:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=9D=E6=9C=AF=E5=BA=93=E7=AE=A1=E7=90=86?= =?UTF-8?q?=EF=BC=9A=E6=9F=A5=E8=AF=A2=E8=AF=9D=E6=9C=AF=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=AF=9D=E6=9C=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8C=E8=8E=B7=E5=8F=96=E8=AF=9D=E6=9C=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scriptInfo/ScriptInfoController.java | 98 +++++++ .../manage/domain/scriptInfo/ScriptInfo.java | 140 ++++++++++ .../mapper/scriptInfo/ScriptInfoMapper.java | 72 +++++ .../scriptInfo/IScriptInfoService.java | 61 ++++ .../impl/ScriptInfoServiceImpl.java | 120 ++++++++ .../manage/scriptInfo/ScriptInfoMapper.xml | 262 ++++++++++++++++++ 6 files changed, 753 insertions(+) create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/controller/scriptInfo/ScriptInfoController.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/domain/scriptInfo/ScriptInfo.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/mapper/scriptInfo/ScriptInfoMapper.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/scriptInfo/IScriptInfoService.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/scriptInfo/impl/ScriptInfoServiceImpl.java create mode 100644 postdischarge-manage/src/main/resources/mapper/manage/scriptInfo/ScriptInfoMapper.xml diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/scriptInfo/ScriptInfoController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/scriptInfo/ScriptInfoController.java new file mode 100644 index 00000000..519222b1 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/scriptInfo/ScriptInfoController.java @@ -0,0 +1,98 @@ +package com.xinelu.manage.controller.scriptInfo; + +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.scriptInfo.ScriptInfo; +import com.xinelu.manage.service.scriptInfo.IScriptInfoService; +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("/manage/script") +public class ScriptInfoController extends BaseController { + @Resource + private IScriptInfoService scriptInfoService; + + /** + * 查询话术信息列表 + */ + @ApiOperation("查询话术信息列表") + @PreAuthorize("@ss.hasPermi('manage:script:list')") + @GetMapping("/list") + public TableDataInfo list(ScriptInfo scriptInfo) { + startPage(); + List list = scriptInfoService.selectScriptInfoList(scriptInfo); + return getDataTable(list); + } + + /** + * 导出话术信息列表 + */ + @ApiOperation("导出话术信息列表") + @PreAuthorize("@ss.hasPermi('manage:script:export')") + @Log(title = "话术信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ScriptInfo scriptInfo) { + List list = scriptInfoService.selectScriptInfoList(scriptInfo); + ExcelUtil util = new ExcelUtil(ScriptInfo.class); + util.exportExcel(response, list, "话术信息数据"); + } + + /** + * 获取话术信息详细信息 + */ + @ApiOperation("获取话术信息详细信息") + @PreAuthorize("@ss.hasPermi('manage:script:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(scriptInfoService.selectScriptInfoById(id)); + } + + /** + * 新增话术信息 + */ + @ApiOperation("新增话术信息") + @PreAuthorize("@ss.hasPermi('manage:script:add')") + @Log(title = "话术信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ScriptInfo scriptInfo) { + return toAjax(scriptInfoService.insertScriptInfo(scriptInfo)); + } + + /** + * 修改话术信息 + */ + @PreAuthorize("@ss.hasPermi('manage:script:edit')") + @Log(title = "话术信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ScriptInfo scriptInfo) { + return toAjax(scriptInfoService.updateScriptInfo(scriptInfo)); + } + + /** + * 删除话术信息 + */ + @PreAuthorize("@ss.hasPermi('manage:script:remove')") + @Log(title = "话术信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(scriptInfoService.deleteScriptInfoByIds(ids)); + } +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/scriptInfo/ScriptInfo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/scriptInfo/ScriptInfo.java new file mode 100644 index 00000000..159fa138 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/scriptInfo/ScriptInfo.java @@ -0,0 +1,140 @@ +package com.xinelu.manage.domain.scriptInfo; + +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; + +/** + * 话术信息对象 script_info + * + * @author xinelu + * @date 2024-02-26 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "话术信息对象", description = "script_info") +public class ScriptInfo 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; + + /** + * 病种id + */ + @ApiModelProperty(value = "病种id") + @Excel(name = "病种id") + private Long diseaseTypeId; + + /** + * 病种名称 + */ + @ApiModelProperty(value = "病种名称") + @Excel(name = "病种名称") + private String diseaseTypeName; + + /** + * 通用话术名称 + */ + @ApiModelProperty(value = "通用话术名称") + @Excel(name = "通用话术名称") + private String commonScriptName; + + /** + * 话术名称 + */ + @ApiModelProperty(value = "话术名称") + @Excel(name = "话术名称") + private String scriptName; + + /** + * 话术ID + */ + @ApiModelProperty(value = "话术ID") + @Excel(name = "话术ID") + private String scriptId; + + /** + * 平台ID + */ + @ApiModelProperty(value = "平台ID") + @Excel(name = "平台ID") + private String platformId; + + /** + * 话术状态,正常:NORMAL,下架:OFF_SHELF,暂停:SUSPEND + */ + @ApiModelProperty(value = "话术状态,正常:NORMAL,下架:OFF_SHELF,暂停:SUSPEND") + @Excel(name = "话术状态,正常:NORMAL,下架:OFF_SHELF,暂停:SUSPEND") + private String scriptStatus; + + /** + * 话术简介 + */ + @ApiModelProperty(value = "话术简介") + @Excel(name = "话术简介") + private String scriptIntroduction; + + /** + * 话术排序 + */ + @ApiModelProperty(value = "话术排序") + @Excel(name = "话术排序") + private Integer scriptSort; + + /** + * 话术备注 + */ + @ApiModelProperty(value = "话术备注") + @Excel(name = "话术备注") + private String scriptRemark; + + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("departmentId", getDepartmentId()) + .append("departmentName", getDepartmentName()) + .append("diseaseTypeId", getDiseaseTypeId()) + .append("diseaseTypeName", getDiseaseTypeName()) + .append("commonScriptName", getCommonScriptName()) + .append("scriptName", getScriptName()) + .append("scriptId", getScriptId()) + .append("platformId", getPlatformId()) + .append("scriptStatus", getScriptStatus()) + .append("scriptIntroduction", getScriptIntroduction()) + .append("scriptSort", getScriptSort()) + .append("scriptRemark", getScriptRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/scriptInfo/ScriptInfoMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/scriptInfo/ScriptInfoMapper.java new file mode 100644 index 00000000..77248bad --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/scriptInfo/ScriptInfoMapper.java @@ -0,0 +1,72 @@ +package com.xinelu.manage.mapper.scriptInfo; + +import com.xinelu.manage.domain.scriptInfo.ScriptInfo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 话术信息Mapper接口 + * + * @author xinelu + * @date 2024-02-26 + */ +public interface ScriptInfoMapper { + /** + * 查询话术信息 + * + * @param id 话术信息主键 + * @return 话术信息 + */ + public ScriptInfo selectScriptInfoById(Long id); + + /** + * 查询话术信息列表 + * + * @param scriptInfo 话术信息 + * @return 话术信息集合 + */ + public List selectScriptInfoList(ScriptInfo scriptInfo); + + /** + * 新增话术信息 + * + * @param scriptInfo 话术信息 + * @return 结果 + */ + public int insertScriptInfo(ScriptInfo scriptInfo); + + /** + * 修改话术信息 + * + * @param scriptInfo 话术信息 + * @return 结果 + */ + public int updateScriptInfo(ScriptInfo scriptInfo); + + /** + * 删除话术信息 + * + * @param id 话术信息主键 + * @return 结果 + */ + public int deleteScriptInfoById(Long id); + + /** + * 批量删除话术信息 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteScriptInfoByIds(Long[] ids); + + + /** + * 根据通用话术名称和话术ID判断通用话术名称是否存在 + * @param commonScriptName + * @param scriptId + * @return + */ + int countByCommonScriptNameAndScriptId(@Param("commonScriptName") String commonScriptName, @Param("scriptId") String scriptId); + +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/scriptInfo/IScriptInfoService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/scriptInfo/IScriptInfoService.java new file mode 100644 index 00000000..7205d6e4 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/scriptInfo/IScriptInfoService.java @@ -0,0 +1,61 @@ +package com.xinelu.manage.service.scriptInfo; + +import com.xinelu.manage.domain.scriptInfo.ScriptInfo; + +import java.util.List; + +/** + * 话术信息Service接口 + * + * @author xinelu + * @date 2024-02-26 + */ +public interface IScriptInfoService { + /** + * 查询话术信息 + * + * @param id 话术信息主键 + * @return 话术信息 + */ + public ScriptInfo selectScriptInfoById(Long id); + + /** + * 查询话术信息列表 + * + * @param scriptInfo 话术信息 + * @return 话术信息集合 + */ + public List selectScriptInfoList(ScriptInfo scriptInfo); + + /** + * 新增话术信息 + * + * @param scriptInfo 话术信息 + * @return 结果 + */ + public int insertScriptInfo(ScriptInfo scriptInfo); + + /** + * 修改话术信息 + * + * @param scriptInfo 话术信息 + * @return 结果 + */ + public int updateScriptInfo(ScriptInfo scriptInfo); + + /** + * 批量删除话术信息 + * + * @param ids 需要删除的话术信息主键集合 + * @return 结果 + */ + public int deleteScriptInfoByIds(Long[] ids); + + /** + * 删除话术信息信息 + * + * @param id 话术信息主键 + * @return 结果 + */ + public int deleteScriptInfoById(Long id); +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/scriptInfo/impl/ScriptInfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/scriptInfo/impl/ScriptInfoServiceImpl.java new file mode 100644 index 00000000..73a2bd78 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/scriptInfo/impl/ScriptInfoServiceImpl.java @@ -0,0 +1,120 @@ +package com.xinelu.manage.service.scriptInfo.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.scriptInfo.ScriptInfo; +import com.xinelu.manage.mapper.scriptInfo.ScriptInfoMapper; +import com.xinelu.manage.service.scriptInfo.IScriptInfoService; +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 ScriptInfoServiceImpl implements IScriptInfoService { + @Resource + private ScriptInfoMapper scriptInfoMapper; + + /** + * 查询话术信息 + * + * @param id 话术信息主键 + * @return 话术信息 + */ + @Override + public ScriptInfo selectScriptInfoById(Long id) { + return scriptInfoMapper.selectScriptInfoById(id); + } + + /** + * 查询话术信息列表 + * + * @param scriptInfo 话术信息 + * @return 话术信息 + */ + @Override + public List selectScriptInfoList(ScriptInfo scriptInfo) { + return scriptInfoMapper.selectScriptInfoList(scriptInfo); + } + + /** + * 新增话术信息 + * + * @param scriptInfo 话术信息 + * @return 结果 + */ + @Override + public int insertScriptInfo(ScriptInfo scriptInfo) { + // 入参非空性判断 + if (StringUtils.isEmpty(scriptInfo.getCommonScriptName())) { + throw new ServiceException("通用话术名称不能为空"); + } + if (StringUtils.isEmpty(scriptInfo.getScriptName())) { + throw new ServiceException("话术名称不能为空"); + } + if (ObjectUtils.isEmpty(scriptInfo.getScriptId())) { + throw new ServiceException("话术ID不能为空"); + } + if (ObjectUtils.isEmpty(scriptInfo.getPlatformId())) { + throw new ServiceException("平台ID不能为空"); + } + if (StringUtils.isEmpty(scriptInfo.getScriptStatus())) { + throw new ServiceException("话术状态不能为空"); + } + if (StringUtils.isEmpty(scriptInfo.getScriptIntroduction())) { + throw new ServiceException("话术简介不能为空"); + } + // 判断通用话术名称是否存在 + int existingNameCount = scriptInfoMapper.countByCommonScriptNameAndScriptId(scriptInfo.getCommonScriptName(), scriptInfo.getScriptId()); + if (existingNameCount > 0) { + throw new ServiceException("通用话术名称已存在"); + } + // 设置创建人与创建时间 + scriptInfo.setCreateBy(SecurityUtils.getUsername()); + scriptInfo.setCreateTime(DateUtils.getNowDate()); + return scriptInfoMapper.insertScriptInfo(scriptInfo); + } + + /** + * 修改话术信息 + * + * @param scriptInfo 话术信息 + * @return 结果 + */ + @Override + public int updateScriptInfo(ScriptInfo scriptInfo) { + scriptInfo.setUpdateTime(DateUtils.getNowDate()); + return scriptInfoMapper.updateScriptInfo(scriptInfo); + } + + /** + * 批量删除话术信息 + * + * @param ids 需要删除的话术信息主键 + * @return 结果 + */ + @Override + public int deleteScriptInfoByIds(Long[] ids) { + return scriptInfoMapper.deleteScriptInfoByIds(ids); + } + + /** + * 删除话术信息信息 + * + * @param id 话术信息主键 + * @return 结果 + */ + @Override + public int deleteScriptInfoById(Long id) { + return scriptInfoMapper.deleteScriptInfoById(id); + } +} diff --git a/postdischarge-manage/src/main/resources/mapper/manage/scriptInfo/ScriptInfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/scriptInfo/ScriptInfoMapper.xml new file mode 100644 index 00000000..4a0dcb96 --- /dev/null +++ b/postdischarge-manage/src/main/resources/mapper/manage/scriptInfo/ScriptInfoMapper.xml @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select id, + department_id, + department_name, + disease_type_id, + disease_type_name, + common_script_name, + script_name, + script_id, + platform_id, + script_status, + script_introduction, + script_sort, + script_remark, + create_by, + create_time, + update_by, + update_time + from script_info + + + + + + + + + insert into script_info + + department_id, + + department_name, + + disease_type_id, + + disease_type_name, + + common_script_name, + + script_name, + + script_id, + + platform_id, + + script_status, + + script_introduction, + + script_sort, + + script_remark, + + create_by, + + create_time, + + update_by, + + update_time, + + + + #{departmentId}, + + #{departmentName}, + + #{diseaseTypeId}, + + #{diseaseTypeName}, + + #{commonScriptName}, + + #{scriptName}, + + #{scriptId}, + + #{platformId}, + + #{scriptStatus}, + + #{scriptIntroduction}, + + #{scriptSort}, + + #{scriptRemark}, + + #{createBy}, + + #{createTime}, + + #{updateBy}, + + #{updateTime}, + + + + + + update script_info + + department_id = + #{departmentId}, + + department_name = + #{departmentName}, + + disease_type_id = + #{diseaseTypeId}, + + disease_type_name = + #{diseaseTypeName}, + + common_script_name = + #{commonScriptName}, + + script_name = + #{scriptName}, + + script_id = + #{scriptId}, + + platform_id = + #{platformId}, + + script_status = + #{scriptStatus}, + + script_introduction = + #{scriptIntroduction}, + + script_sort = + #{scriptSort}, + + script_remark = + #{scriptRemark}, + + create_by = + #{createBy}, + + create_time = + #{createTime}, + + update_by = + #{updateBy}, + + update_time = + #{updateTime}, + + + where id = #{id} + + + + delete + from script_info + where id = #{id} + + + + delete from script_info where id in + + #{id} + + + \ No newline at end of file