From 221051c3d44c29bed373bf7926aba262980e39b3 Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Tue, 9 Jul 2024 13:40:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=85=B1=E7=9F=A5=E8=AF=86=E5=BA=93?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constant/KnowledgeBaseConstants.java | 4 ++ .../KnowledgeBaseController.java | 19 ++++++- .../domain/operationInfo/OperationInfo.java | 27 ++-------- .../knowledgebase/KnowledgeBaseSaveDto.java | 36 +++++++++++++ .../dto/operationinfo/BaseInfoQueryDto.java | 24 +++++++++ .../dto/operationinfo/OperationInfoDto.java | 6 +++ .../knowlagebase/IKnowlageBaseService.java | 15 ------ .../knowledgebase/IKnowledgeBaseService.java | 22 ++++++++ .../impl/KnowledgeBaseServiceImpl.java} | 50 +++++++++++++++++-- .../operationInfo/OperationInfoMapper.xml | 25 +++++++--- 10 files changed, 178 insertions(+), 50 deletions(-) create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/dto/knowledgebase/KnowledgeBaseSaveDto.java delete mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/knowlagebase/IKnowlageBaseService.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/IKnowledgeBaseService.java rename postdischarge-manage/src/main/java/com/xinelu/manage/service/{knowlagebase/impl/KnowlageBaseServiceImpl.java => knowledgebase/impl/KnowledgeBaseServiceImpl.java} (58%) diff --git a/postdischarge-common/src/main/java/com/xinelu/common/constant/KnowledgeBaseConstants.java b/postdischarge-common/src/main/java/com/xinelu/common/constant/KnowledgeBaseConstants.java index d9ada679..cd2768f3 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/constant/KnowledgeBaseConstants.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/constant/KnowledgeBaseConstants.java @@ -19,4 +19,8 @@ public class KnowledgeBaseConstants { * 微信库 */ public static final String WECHAT = "WECHAT"; + /** + * 短信库 + */ + public static final String MESSAGE = "MESSAGE"; } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/knowledgebase/KnowledgeBaseController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/knowledgebase/KnowledgeBaseController.java index 8704fdfa..db7633c0 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/knowledgebase/KnowledgeBaseController.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/knowledgebase/KnowledgeBaseController.java @@ -1,13 +1,17 @@ package com.xinelu.manage.controller.knowledgebase; +import com.xinelu.common.core.domain.R; import com.xinelu.common.core.page.TableDataInfo; +import com.xinelu.manage.dto.knowledgebase.KnowledgeBaseSaveDto; import com.xinelu.manage.dto.operationinfo.BaseInfoQueryDto; -import com.xinelu.manage.service.knowlagebase.IKnowlageBaseService; +import com.xinelu.manage.service.knowledgebase.IKnowledgeBaseService; import io.swagger.annotations.ApiOperation; import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -22,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController; public class KnowledgeBaseController { @Resource - private IKnowlageBaseService knowlageBaseService; + private IKnowledgeBaseService knowlageBaseService; /** * 知识库复制查询虚拟机构列表 @@ -33,4 +37,15 @@ public class KnowledgeBaseController { public TableDataInfo getBaseInfoList(BaseInfoQueryDto baseInfoQueryDto) { return knowlageBaseService.getBaseInfoList(baseInfoQueryDto); } + + /** + * 新增知识库信息 + */ + @ApiOperation("新增知识库信息") + @PreAuthorize("@ss.hasPermi('operationInfo:operationInfo:add')") + @PostMapping(value = "/copyBaseInfo") + public R copyBaseInfo(@RequestBody KnowledgeBaseSaveDto knowledgeBaseSaveDto) { + knowlageBaseService.copyBaseInfo(knowledgeBaseSaveDto); + return R.ok(); + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/operationInfo/OperationInfo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/operationInfo/OperationInfo.java index 477225df..80a775b3 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/operationInfo/OperationInfo.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/operationInfo/OperationInfo.java @@ -4,14 +4,11 @@ import com.xinelu.common.annotation.Excel; import com.xinelu.common.core.domain.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; 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; - -import javax.validation.constraints.NotBlank; /** * 手术信息对象 operation_info @@ -83,22 +80,8 @@ public class OperationInfo extends BaseEntity { @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(); - } + /** + * 公共库模板id + */ + private Long sourceTemplateId; } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/knowledgebase/KnowledgeBaseSaveDto.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/knowledgebase/KnowledgeBaseSaveDto.java new file mode 100644 index 00000000..03c2a712 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/knowledgebase/KnowledgeBaseSaveDto.java @@ -0,0 +1,36 @@ +package com.xinelu.manage.dto.knowledgebase; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @description: 知识库保存传输对象 + * @author: haown + * @create: 2024-07-09 09:34 + **/ +@Data +public class KnowledgeBaseSaveDto { + /** + * 模板id + */ + @ApiModelProperty(value = "公共库模板id") + private Long sourceTemplateId; + + /** + * 知识库类型 + */ + @ApiModelProperty(value = "知识库类型,OPERATOR:手术,SCRIPT:话术,WECHAT:微信") + private String type; + + /** + * 所属科室id + */ + @ApiModelProperty(value = "所属科室id") + private Long departmentId; + + /** + * 所属科室名称 + */ + @ApiModelProperty(value = "所属科室名称") + private String departmentName; +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/operationinfo/BaseInfoQueryDto.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/operationinfo/BaseInfoQueryDto.java index 651cffe6..1d0c5a21 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/operationinfo/BaseInfoQueryDto.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/operationinfo/BaseInfoQueryDto.java @@ -32,4 +32,28 @@ public class BaseInfoQueryDto { */ @ApiModelProperty(value = "手术名称") private String operationName; + + /** + * 通用话术名称 + */ + @ApiModelProperty(value = "通用话术名称") + private String commonScriptName; + + /** + * 话术名称 + */ + @ApiModelProperty(value = "话术名称") + private String scriptName; + + /** + * 话术状态,正常:NORMAL,下架:OFF_SHELF,暂停:SUSPEND + */ + @ApiModelProperty(value = "话术状态,正常:NORMAL,下架:OFF_SHELF,暂停:SUSPEND") + private String scriptStatus; + + /** + * 微信模板名称 + */ + @ApiModelProperty(value = "微信模板名称") + private String wechatTemplateName; } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/operationinfo/OperationInfoDto.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/operationinfo/OperationInfoDto.java index 48fe948e..dd49ca99 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/operationinfo/OperationInfoDto.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/operationinfo/OperationInfoDto.java @@ -50,4 +50,10 @@ public class OperationInfoDto extends BaseEntity { */ @ApiModelProperty(value = "术式信息") private String operationInfo; + + /** + * 公共库模板id + */ + @ApiModelProperty(value = "公共库模板id") + private Long sourceTemplateId; } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowlagebase/IKnowlageBaseService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowlagebase/IKnowlageBaseService.java deleted file mode 100644 index be80007f..00000000 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowlagebase/IKnowlageBaseService.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.xinelu.manage.service.knowlagebase; - -import com.xinelu.common.core.page.TableDataInfo; -import com.xinelu.manage.dto.operationinfo.BaseInfoQueryDto; - -/** - * 知识库公共Service接口 - * - * @author haown - * @date 2024-07-08 - */ -public interface IKnowlageBaseService { - - TableDataInfo getBaseInfoList(BaseInfoQueryDto baseInfoQueryDto); -} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/IKnowledgeBaseService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/IKnowledgeBaseService.java new file mode 100644 index 00000000..d4e837fa --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/IKnowledgeBaseService.java @@ -0,0 +1,22 @@ +package com.xinelu.manage.service.knowledgebase; + +import com.xinelu.common.core.page.TableDataInfo; +import com.xinelu.manage.dto.knowledgebase.KnowledgeBaseSaveDto; +import com.xinelu.manage.dto.operationinfo.BaseInfoQueryDto; + +/** + * 知识库公共Service接口 + * + * @author haown + * @date 2024-07-08 + */ +public interface IKnowledgeBaseService { + + TableDataInfo getBaseInfoList(BaseInfoQueryDto baseInfoQueryDto); + + /** + * 知识库复制 + * @param knowladgeBaseSaveDto 知识库保存传输对象 + */ + void copyBaseInfo(KnowledgeBaseSaveDto knowladgeBaseSaveDto); +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowlagebase/impl/KnowlageBaseServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/impl/KnowledgeBaseServiceImpl.java similarity index 58% rename from postdischarge-manage/src/main/java/com/xinelu/manage/service/knowlagebase/impl/KnowlageBaseServiceImpl.java rename to postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/impl/KnowledgeBaseServiceImpl.java index 20186467..9172dc54 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowlagebase/impl/KnowlageBaseServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/impl/KnowledgeBaseServiceImpl.java @@ -1,24 +1,32 @@ -package com.xinelu.manage.service.knowlagebase.impl; +package com.xinelu.manage.service.knowledgebase.impl; import com.github.pagehelper.PageInfo; import com.xinelu.common.constant.HttpStatus; import com.xinelu.common.constant.KnowledgeBaseConstants; import com.xinelu.common.core.page.TableDataInfo; +import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.PageUtils; +import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.manage.domain.operationInfo.OperationInfo; import com.xinelu.manage.domain.scriptInfo.ScriptInfo; +import com.xinelu.manage.dto.knowledgebase.KnowledgeBaseSaveDto; import com.xinelu.manage.dto.operationinfo.BaseInfoQueryDto; import com.xinelu.manage.dto.operationinfo.OperationInfoDto; import com.xinelu.manage.dto.script.ScriptInfoDto; +import com.xinelu.manage.dto.textmessage.TextMessageDTO; import com.xinelu.manage.dto.wechattemplate.WechatTemplateDTO; import com.xinelu.manage.mapper.operationInfo.OperationInfoMapper; import com.xinelu.manage.mapper.scriptInfo.ScriptInfoMapper; +import com.xinelu.manage.mapper.textmessage.TextMessageMapper; import com.xinelu.manage.mapper.wechattemplate.WechatTemplateMapper; -import com.xinelu.manage.service.knowlagebase.IKnowlageBaseService; +import com.xinelu.manage.service.knowledgebase.IKnowledgeBaseService; +import com.xinelu.manage.service.operationInfo.IOperationInfoService; +import com.xinelu.manage.vo.textmessage.TextMessageVO; import com.xinelu.manage.vo.wechattemplate.WechatTemplateTaskVO; import java.util.List; import javax.annotation.Resource; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Service; /** @@ -27,14 +35,18 @@ import org.springframework.stereotype.Service; * @create: 2024-07-08 16:25 **/ @Service -public class KnowlageBaseServiceImpl implements IKnowlageBaseService { +public class KnowledgeBaseServiceImpl implements IKnowledgeBaseService { @Resource private OperationInfoMapper operationInfoMapper; @Resource + private IOperationInfoService operationInfoService; + @Resource private ScriptInfoMapper scriptInfoMapper; @Resource private WechatTemplateMapper wechatTemplateMapper; + @Resource + private TextMessageMapper textMessageMapper; @Override public TableDataInfo getBaseInfoList(BaseInfoQueryDto baseInfoQueryDto) { @@ -76,7 +88,39 @@ public class KnowlageBaseServiceImpl implements IKnowlageBaseService { rspData.setPageNum(new PageInfo(wechatTemplateList).getPageNum()); rspData.setTotal(new PageInfo(wechatTemplateList).getTotal()); break; + case KnowledgeBaseConstants.MESSAGE: + TextMessageDTO textMessageDTO = new TextMessageDTO(); + BeanUtils.copyBeanProp(textMessageDTO, baseInfoQueryDto); + PageUtils.startPage(); + List messageList = textMessageMapper.selectTextMessageList(textMessageDTO); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + rspData.setRows(messageList); + // 返回 页码 + rspData.setPageNum(new PageInfo(messageList).getPageNum()); + rspData.setTotal(new PageInfo(messageList).getTotal()); + break; } return rspData; } + + @Override + public void copyBaseInfo(KnowledgeBaseSaveDto knowledgeBaseSaveDto) { + if (StringUtils.isBlank(knowledgeBaseSaveDto.getType())) { + throw new ServiceException("请输入知识库类型"); + } + if (ObjectUtils.isEmpty(knowledgeBaseSaveDto.getDepartmentId())) { + throw new ServiceException("请选择科室"); + } + switch(knowledgeBaseSaveDto.getType()) { + case KnowledgeBaseConstants.OPERATOR: + OperationInfo operationInfo = operationInfoMapper.selectOperationInfoById(knowledgeBaseSaveDto.getSourceTemplateId()); + operationInfo.setId(null); + operationInfo.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId()); + operationInfo.setDepartmentName(knowledgeBaseSaveDto.getDepartmentName()); + operationInfo.setSourceTemplateId(knowledgeBaseSaveDto.getSourceTemplateId()); + operationInfoService.insertOperationInfo(operationInfo); + break; + } + } } diff --git a/postdischarge-manage/src/main/resources/mapper/manage/operationInfo/OperationInfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/operationInfo/OperationInfoMapper.xml index 185ccebe..9b40e87a 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/operationInfo/OperationInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/operationInfo/OperationInfoMapper.xml @@ -13,6 +13,7 @@ + @@ -28,6 +29,7 @@ operation_info, operation_remark, sort, + source_template_id, create_by, create_time, update_by, @@ -43,16 +45,10 @@ #{departmentId} - and department_name like concat('%', - #{departmentName}, - '%' - ) + and department_name like concat('%',#{departmentName},'%') - and operation_name like concat('%', - #{operationName}, - '%' - ) + and operation_name like concat('%',#{operationName},'%') and operation_code = #{operationCode} @@ -66,6 +62,9 @@ and sort = #{sort} + + and source_template_id = #{sourceTemplateId} + order by create_time DESC @@ -104,6 +103,9 @@ and oi.operation_info = #{operationInfo} + + and source_template_id = #{sourceTemplateId} + ${params.dataScope} @@ -150,6 +152,8 @@ sort, + source_template_id, + create_by, create_time, @@ -174,6 +178,8 @@ #{sort}, + #{sourceTemplateId}, + #{createBy}, #{createTime}, @@ -209,6 +215,9 @@ sort = #{sort}, + + source_template_id = #{sourceTemplateId}, + create_by = #{createBy},