From 22d27660df0480f00f4e6fd976546e9897b2f714 Mon Sep 17 00:00:00 2001 From: youxilong Date: Tue, 5 Mar 2024 18:04:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=9D=E6=9C=AF=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=AF=9D=E6=9C=AF=E5=BA=93?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 6 +- .../common/config/SystemBusinessConfig.java | 33 ++-- .../scriptInfo/ScriptInfoController.java | 18 ++ .../ServicePackageController.java | 32 +++- .../ServiceWayContentController.java | 24 +-- .../manage/domain/scriptInfo/ScriptInfo.java | 4 + .../servicepackage/ServicePackageAddDTO.java | 6 + .../mapper/scriptInfo/ScriptInfoMapper.java | 10 ++ .../servicepackage/ServicePackageMapper.java | 21 +++ .../ServicePackageContentMapper.java | 37 +++++ .../scriptInfo/IScriptInfoService.java | 11 ++ .../impl/ScriptInfoServiceImpl.java | 52 +++++- .../IServicePackageService.java | 13 +- .../impl/ServicePackageServiceImpl.java | 157 ++++++++++++++---- .../ServicePackageDetailVO.java | 48 +++++- .../operationInfo/OperationInfoMapper.xml | 1 + .../manage/scriptInfo/ScriptInfoMapper.xml | 22 +++ .../servicepackage/ServicePackageMapper.xml | 21 ++- .../ServicePackageContentMapper.xml | 46 +++++ .../ServiceWayContentMapper.xml | 1 + .../manage/textmessage/TextMessageMapper.xml | 1 + .../wechattemplate/WechatTemplateMapper.xml | 1 + 22 files changed, 487 insertions(+), 78 deletions(-) diff --git a/postdischarge-admin/src/main/resources/application.yml b/postdischarge-admin/src/main/resources/application.yml index 2fbc1ebf..03da4984 100644 --- a/postdischarge-admin/src/main/resources/application.yml +++ b/postdischarge-admin/src/main/resources/application.yml @@ -16,6 +16,8 @@ xinelu: addressEnabled: false # 验证码类型 math 数组计算 char 字符验证 captchaType: math + # 话术图片路径图片上传 + script-file-url: /scriptFileUrl # 开发环境配置 server: @@ -64,13 +66,13 @@ spring: # redis 配置 redis: # 地址 - host: localhost + host: 127.0.0.1 # 端口,默认为6379 port: 6379 # 数据库索引 database: 6 # 密码 - password: + password: xinelu@6990 # 连接超时时间 timeout: 10s lettuce: diff --git a/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java b/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java index 45369b2a..571a422a 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java @@ -46,10 +46,15 @@ public class SystemBusinessConfig { */ private static String captchaType; - /** - * 签约知情书地址 - */ - private String signInformedFileUrl; + /** + * 签约知情书地址 + */ + private String signInformedFileUrl; + + /** + * 话术图片地址 + */ + private String scriptFileUrl; public String getName() { return name; @@ -135,11 +140,19 @@ public class SystemBusinessConfig { return getProfile() + "/upload"; } - public String getSignInformedFileUrl() { - return signInformedFileUrl; - } + public String getSignInformedFileUrl() { + return signInformedFileUrl; + } - public void setSignInformedFileUrl(String signInformedFileUrl) { - this.signInformedFileUrl = signInformedFileUrl; - } + public void setSignInformedFileUrl(String signInformedFileUrl) { + this.signInformedFileUrl = signInformedFileUrl; + } + + public String getScriptFileUrl() { + return scriptFileUrl; + } + + public void setScriptFileUrl(String scriptFileUrl) { + this.scriptFileUrl = scriptFileUrl; + } } 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 index 049e5c63..5ecacc7f 100644 --- 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 @@ -1,6 +1,7 @@ package com.xinelu.manage.controller.scriptInfo; import com.xinelu.common.annotation.Log; +import com.xinelu.common.constant.Constants; import com.xinelu.common.core.controller.BaseController; import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.page.TableDataInfo; @@ -10,12 +11,15 @@ 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.apache.commons.lang3.StringUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.List; +import java.util.Objects; /** * 话术信息Controller @@ -97,4 +101,18 @@ public class ScriptInfoController extends BaseController { public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(scriptInfoService.deleteScriptInfoByIds(ids)); } + + /** + * 话术图片上传 + */ + @PostMapping("/uploadScriptInfo") + public AjaxResult uploadScriptInfo(@RequestParam("file") MultipartFile multipartFile) throws Exception { + if (Objects.isNull(multipartFile) || StringUtils.isBlank(multipartFile.getOriginalFilename())) { + return AjaxResult.error("当前文件不存在,无法上传!"); + } + if (multipartFile.getOriginalFilename().contains(Constants.EMPTY)) { + return AjaxResult.error("当前文件名含有空格,请先去除空格在上传!"); + } + return scriptInfoService.uploadScriptInfo(multipartFile); + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicepackage/ServicePackageController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicepackage/ServicePackageController.java index a62e64a7..a61d84f4 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicepackage/ServicePackageController.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicepackage/ServicePackageController.java @@ -10,6 +10,8 @@ import com.xinelu.manage.domain.servicepackage.ServicePackage; import com.xinelu.manage.dto.servicepackage.ServicePackageAddDTO; import com.xinelu.manage.service.servicepackage.IServicePackageService; import com.xinelu.manage.vo.servicepackage.ServicePackageVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -23,6 +25,7 @@ import java.util.List; * @author xinelu * @date 2024-03-03 */ +@Api(tags = "服务包基础信息控制器") @RestController @RequestMapping("/manage/servicepackage") public class ServicePackageController extends BaseController { @@ -32,6 +35,7 @@ public class ServicePackageController extends BaseController { /** * 查询服务包基础信息列表 */ + @ApiOperation("查询服务包基础信息列表") @PreAuthorize("@ss.hasPermi('manage:servicepackage:list')") @GetMapping("/list") public TableDataInfo list(ServicePackage servicePackage) { @@ -43,6 +47,7 @@ public class ServicePackageController extends BaseController { /** * 导出服务包基础信息列表 */ + @ApiOperation("导出服务包基础信息列表") @PreAuthorize("@ss.hasPermi('manage:servicepackage:export')") @Log(title = "服务包基础信息", businessType = BusinessType.EXPORT) @PostMapping("/export") @@ -55,6 +60,7 @@ public class ServicePackageController extends BaseController { /** * 获取服务包基础信息详细信息 */ + @ApiOperation("获取服务包基础信息详细信息") @PreAuthorize("@ss.hasPermi('manage:servicepackage:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { @@ -64,9 +70,10 @@ public class ServicePackageController extends BaseController { /** * 新增服务包基础信息 */ + @ApiOperation("新增服务包基础信息") @PreAuthorize("@ss.hasPermi('manage:servicepackage:add')") @Log(title = "服务包基础信息", businessType = BusinessType.INSERT) - @PostMapping + @PostMapping("/add") public AjaxResult add(@RequestBody ServicePackageAddDTO servicePackageAddDTO) { return toAjax(servicePackageService.insertServicePackage(servicePackageAddDTO)); } @@ -74,20 +81,35 @@ public class ServicePackageController extends BaseController { /** * 修改服务包基础信息 */ + @ApiOperation("修改服务包基础信息") @PreAuthorize("@ss.hasPermi('manage:servicepackage:edit')") @Log(title = "服务包基础信息", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ServicePackage servicePackage) { - return toAjax(servicePackageService.updateServicePackage(servicePackage)); + @PutMapping("/edit") + public AjaxResult edit(@RequestBody ServicePackageAddDTO servicePackageAddDTO) { + return toAjax(servicePackageService.updateServicePackage(servicePackageAddDTO)); } /** * 删除服务包基础信息 */ + @ApiOperation("删除服务包基础信息") @PreAuthorize("@ss.hasPermi('manage:servicepackage:remove')") @Log(title = "服务包基础信息", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") + @DeleteMapping("/remove/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(servicePackageService.deleteServicePackageByIds(ids)); } + + /** + * 修改服务包发布状态 + * + * @param id + * @param whetherRelease + * @return + */ + @ApiOperation("修改服务包发布状态") + @PutMapping("/editReleaseStatus") + public AjaxResult editReleaseStatus(Long id, Integer whetherRelease) { + return toAjax(servicePackageService.editReleaseStatus(id, whetherRelease)); + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicewaycontent/ServiceWayContentController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicewaycontent/ServiceWayContentController.java index 7e5ce134..1b608f73 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicewaycontent/ServiceWayContentController.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/servicewaycontent/ServiceWayContentController.java @@ -49,18 +49,6 @@ public class ServiceWayContentController extends BaseController { return AjaxResult.success(list); } - /** - * 新增服务方式 - * - * @param serviceWayContent - * @return - */ - @ApiOperation("新增服务方式") - @PostMapping("/addServiceWay") - public AjaxResult addServiceWay(@RequestBody ServiceWayContent serviceWayContent) { - return toAjax(serviceWayContentService.insertServiceWay(serviceWayContent)); - } - /** * 根据服务方式id获取服务方式 * @@ -73,6 +61,18 @@ public class ServiceWayContentController extends BaseController { return AjaxResult.success(serviceWayContentService.selectServiceWayById(id)); } + /** + * 新增服务方式 + * + * @param serviceWayContent + * @return + */ + @ApiOperation("新增服务方式") + @PostMapping("/addServiceWay") + public AjaxResult addServiceWay(@RequestBody ServiceWayContent serviceWayContent) { + return toAjax(serviceWayContentService.insertServiceWay(serviceWayContent)); + } + /** * 修改服务方式 * 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 index e2f27b11..43f55ed3 100644 --- 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 @@ -130,6 +130,9 @@ public class ScriptInfo extends BaseEntity { @Excel(name = "话术备注") private String scriptRemark; + @ApiModelProperty(value = "话术图片文件路径") + private String scriptFilePath; + @Override public String toString() { @@ -147,6 +150,7 @@ public class ScriptInfo extends BaseEntity { .append("scriptIntroduction", getScriptIntroduction()) .append("scriptSort", getScriptSort()) .append("scriptRemark", getScriptRemark()) + .append("scriptFilePath", getScriptFilePath()) .append("createBy", getCreateBy()) .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicepackage/ServicePackageAddDTO.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicepackage/ServicePackageAddDTO.java index c2178c6c..109bf405 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicepackage/ServicePackageAddDTO.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/servicepackage/ServicePackageAddDTO.java @@ -25,6 +25,12 @@ import java.util.List; @ApiModel(value = "服务包新增DTO") public class ServicePackageAddDTO { + /** + * 服务包id + */ + @ApiModelProperty(value = "服务包id") + private Long id; + /** * 科室id */ 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 index 2ac04fea..7ffea3d8 100644 --- 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 @@ -62,8 +62,18 @@ public interface ScriptInfoMapper { /** * 判断通用话术名称是否存在 + * * @param scriptInfo * @return */ int countByScriptInfo(ScriptInfo scriptInfo); + + /** + * 检查是否存在除当前记录之外的同名记录 + * @param scriptName + * @param departmentId + * @param id + * @return + */ + int countByScriptNameExcludingId(@Param("scriptName") String scriptName, @Param("departmentId") Long departmentId, @Param("id") Long id); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicepackage/ServicePackageMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicepackage/ServicePackageMapper.java index bdf986ab..65dd6db5 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicepackage/ServicePackageMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicepackage/ServicePackageMapper.java @@ -4,6 +4,7 @@ import com.xinelu.manage.domain.servicepackage.ServicePackage; import com.xinelu.manage.vo.servicepackage.ServicePackageDetailVO; import com.xinelu.manage.vo.servicepackage.ServicePackageVO; import com.xinelu.manage.vo.servicepackagecontent.ServicePackageContentVO; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -64,6 +65,7 @@ public interface ServicePackageMapper { /** * 根据服务包id查询服务包详情信息 + * * @param id * @return */ @@ -71,6 +73,7 @@ public interface ServicePackageMapper { /** * 查询服务包列表 + * * @param servicePackage * @return */ @@ -78,9 +81,27 @@ public interface ServicePackageMapper { /** * 根据服务包id查询服务包内容 + * * @param id * @return */ List selectServicePackageVOListById(Long id); + /** + * 判断所属科室下 + * + * @param departmentId + * @param packageName + * @return + */ + int existNameCount(@Param("departmentId") Long departmentId, @Param("packageName") String packageName); + + /** + * 修改服务包发布状态 + * + * @param id + * @param whetherRelease + * @return + */ + int editReleaseStatus(@Param("id") Long id, @Param("whetherRelease") Integer whetherRelease); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicepackagecontent/ServicePackageContentMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicepackagecontent/ServicePackageContentMapper.java index d13cef4d..fa911f58 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicepackagecontent/ServicePackageContentMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicepackagecontent/ServicePackageContentMapper.java @@ -1,6 +1,8 @@ package com.xinelu.manage.mapper.servicepackagecontent; import com.xinelu.manage.domain.servicepackagecontent.ServicePackageContent; +import com.xinelu.manage.vo.servicepackagecontent.ServicePackageContentVO; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -61,8 +63,43 @@ public interface ServicePackageContentMapper { /** * 根据服务包id删除服务包内容 + * * @param ids * @return */ int deleteServicePackageContentByPackageIds(Long[] ids); + + /** + * 根据服务包id和服务方式名称查询服务方式是否存在 + * + * @param id + * @param serviceWayName + * @return + */ + Long countByPackageIdAndServiceWayName(@Param("id") Long id, @Param("serviceWayName") String serviceWayName); + + /** + * 根据服务方式id和服务内容查询服务内容是否存在 + * + * @param serviceWayId + * @param serviceContent + * @return + */ + Long countByServiceWayIdAndServiceContent(@Param("serviceWayId") Long serviceWayId, @Param("serviceContent") String serviceContent); + + /** + * 根据服务内容id和服务频次查询服务频次是否存在 + * + * @param serviceContentId + * @param vo + * @return + */ + int countByServiceContentIdAndServiceFrequency(@Param("serviceContentId") Long serviceContentId, @Param("vo") ServicePackageContentVO vo); + + /** + * 根据服务包id删除服务包内容 + * @param id + * @return + */ + int deleteServicePackageContentByPackageId(Long id); } 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 index 7205d6e4..f3a2f7eb 100644 --- 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 @@ -1,6 +1,8 @@ package com.xinelu.manage.service.scriptInfo; +import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.manage.domain.scriptInfo.ScriptInfo; +import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -58,4 +60,13 @@ public interface IScriptInfoService { * @return 结果 */ public int deleteScriptInfoById(Long id); + + /** + * 话术图片上传 + * + * @param multipartFile + * @return + * @throws Exception + */ + AjaxResult uploadScriptInfo(MultipartFile multipartFile) throws Exception; } 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 index fbff96df..d824a318 100644 --- 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 @@ -1,13 +1,19 @@ package com.xinelu.manage.service.scriptInfo.impl; +import com.xinelu.common.config.SystemBusinessConfig; +import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.DateUtils; import com.xinelu.common.utils.SecurityUtils; +import com.xinelu.common.utils.file.FileUploadUtils; +import com.xinelu.common.utils.file.MimeTypeUtils; 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.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.util.List; @@ -23,6 +29,10 @@ public class ScriptInfoServiceImpl implements IScriptInfoService { @Resource private ScriptInfoMapper scriptInfoMapper; + @Resource + private SystemBusinessConfig systemBusinessConfig; + + /** * 查询话术信息 * @@ -73,14 +83,18 @@ public class ScriptInfoServiceImpl implements IScriptInfoService { @Override @Transactional(rollbackFor = Exception.class) public int updateScriptInfo(ScriptInfo scriptInfo) { - // 判断通用话术名称是否存在 - if (scriptInfoMapper.countByScriptInfo(scriptInfo) > 0) { - throw new ServiceException("通用话术名称已存在"); + // 检查除当前记录之外是否存在同名的话术名称 + if (!scriptInfo.getCommonScriptName().equals(scriptInfoMapper.selectScriptInfoById(scriptInfo.getId())) + && scriptInfoMapper.countByScriptNameExcludingId(scriptInfo.getCommonScriptName(), scriptInfo.getDepartmentId(), scriptInfo.getId()) > 0) { + // 存在同名的话术名称,不能进行更新 + throw new ServiceException("通用话术名称已存在,请使用其他名称。"); + } else { + // 不存在同名的话术名称或者名称未改变,设置修改人和修改时间 + scriptInfo.setUpdateBy(SecurityUtils.getUsername()); + scriptInfo.setUpdateTime(DateUtils.getNowDate()); + // 进行更新操作 + return scriptInfoMapper.updateScriptInfo(scriptInfo); } - // 设置修改人和修改时间 - scriptInfo.setUpdateBy(SecurityUtils.getUsername()); - scriptInfo.setUpdateTime(DateUtils.getNowDate()); - return scriptInfoMapper.updateScriptInfo(scriptInfo); } /** @@ -105,4 +119,28 @@ public class ScriptInfoServiceImpl implements IScriptInfoService { public int deleteScriptInfoById(Long id) { return scriptInfoMapper.deleteScriptInfoById(id); } + + /** + * 话术图片上传 + * + * @param multipartFile + * @return + */ + @Override + public AjaxResult uploadScriptInfo(MultipartFile multipartFile) throws Exception { + // 获取文件路径 + String uploadPathUrl = SystemBusinessConfig.getProfile() + systemBusinessConfig.getScriptFileUrl(); + if (StringUtils.isBlank(uploadPathUrl)) { + return AjaxResult.success(); + } + // 上传 + String scriptFilePath = FileUploadUtils.upload(uploadPathUrl, multipartFile, MimeTypeUtils.IMAGE_EXTENSION); + if (StringUtils.isBlank(scriptFilePath)) { + throw new ServiceException("图片上传失败,请联系管理员!"); + } + // 上传成功,返回话术图片url + AjaxResult ajax = AjaxResult.success("上传成功!"); + ajax.put("imgUrl", scriptFilePath); + return ajax; + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicepackage/IServicePackageService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicepackage/IServicePackageService.java index 81d23f4d..fdb2e36e 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicepackage/IServicePackageService.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicepackage/IServicePackageService.java @@ -41,10 +41,10 @@ public interface IServicePackageService { /** * 修改服务包基础信息 * - * @param servicePackage 服务包基础信息 + * @param servicePackageAddDTO 服务包基础信息 * @return 结果 */ - public int updateServicePackage(ServicePackage servicePackage); + public int updateServicePackage(ServicePackageAddDTO servicePackageAddDTO); /** * 批量删除服务包基础信息 @@ -61,4 +61,13 @@ public interface IServicePackageService { * @return 结果 */ public int deleteServicePackageById(Long id); + + /** + * 修改服务包发布状态 + * + * @param id + * @param whetherRelease + * @return + */ + int editReleaseStatus(Long id, Integer whetherRelease); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicepackage/impl/ServicePackageServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicepackage/impl/ServicePackageServiceImpl.java index 881caec1..377f8dc3 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicepackage/impl/ServicePackageServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicepackage/impl/ServicePackageServiceImpl.java @@ -2,7 +2,10 @@ package com.xinelu.manage.service.servicepackage.impl; import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.DateUtils; +import com.xinelu.common.utils.SecurityUtils; +import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.manage.domain.servicepackage.ServicePackage; +import com.xinelu.manage.domain.servicepackagecontent.ServicePackageContent; import com.xinelu.manage.dto.servicepackage.ServicePackageAddDTO; import com.xinelu.manage.mapper.servicepackage.ServicePackageMapper; import com.xinelu.manage.mapper.servicepackagecontent.ServicePackageContentMapper; @@ -11,8 +14,10 @@ import com.xinelu.manage.vo.servicepackage.ServicePackageDetailVO; import com.xinelu.manage.vo.servicepackage.ServicePackageVO; import com.xinelu.manage.vo.servicepackagecontent.ServicePackageContentVO; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -57,6 +62,7 @@ public class ServicePackageServiceImpl implements IServicePackageService { public List selectServicePackageList(ServicePackage servicePackage) { List voList = servicePackageMapper.selectServicePackageLists(servicePackage); return voList.stream().map(vo -> { + // 拼接服务包期限+服务包单位 String packageTermAndUnit = vo.getPackageTerm() + vo.getPackageTermUnit(); vo.setPackageTermAndUnit(packageTermAndUnit); return vo; @@ -70,51 +76,122 @@ public class ServicePackageServiceImpl implements IServicePackageService { * @return 结果 */ @Override + @Transactional(rollbackFor = Exception.class) public int insertServicePackage(ServicePackageAddDTO servicePackageAddDTO) { - // TODO - // 1.判断所属科室下服务包名称是否重复 - // 1.1如果重复,报错:当时科室下服务包名称重复 - - // 1.2如果不重复,初始化ServicePackage,将servicePackageAddDTO赋值给ServicePackage,新增服务包 - - // 2.新增服务内容 - // 2.1根据服务包id,服务方式名称判断服务方式表中有没有存在 - - // 2.1.1 如果存在,返回服务方式id - - // 2.2 根据服务包id,服务方式id,服务内容名称判断服务内容表中有没有存在 - - // 2.2.1 如果存在,返回服务内容id - - // 2.3 根据服务包id,服务内容id,服务频次判断服务频次表中有没有存在 - - // 2.3.1 如果存在,报错:请勿重复添加服务包内容 - - // 2.3.2 如果不存在,新增服务频次 - - // 2.2.2 如果不存在,新增服务内容,新增服务频次 - - // 2.1.2 如果不存在,新增服务方式,服务内容,服务频次 - + // 判断所属科室下服务包名称是否存在 + int existNameCount = servicePackageMapper.existNameCount(servicePackageAddDTO.getDepartmentId(), servicePackageAddDTO.getPackageName()); + if (existNameCount > 0) { + throw new ServiceException("当前科室下服务包名称已存在"); + } + // 初始化ServicePackage,将servicePackageAddDTO赋值给ServicePackage,新增服务包 ServicePackage servicePackage = new ServicePackage(); - servicePackage.setCreateTime(DateUtils.getNowDate()); - return servicePackageMapper.insertServicePackage(servicePackage); + BeanUtils.copyProperties(servicePackageAddDTO, servicePackage); + if (servicePackageMapper.insertServicePackage(servicePackage) <= 0) { + throw new ServiceException("新增服务包失败"); + } + // 新增服务内容 + String username = SecurityUtils.getUsername(); + Date nowDate = DateUtils.getNowDate(); + for (ServicePackageContentVO vo : servicePackageAddDTO.getVoList()) { + Long serviceWayId = createServiceWay(servicePackage, vo, username, nowDate); + Long serviceContentId = createServiceContent(servicePackage, vo, serviceWayId, username, nowDate); + createServiceFrequency(servicePackage, vo, serviceContentId, username, nowDate); + } + return 1; } /** * 修改服务包基础信息 * - * @param servicePackage 服务包基础信息 + * @param servicePackageAddDTO 服务包基础信息 * @return 结果 */ @Override - public int updateServicePackage(ServicePackage servicePackage) { - // 按照全增全删的原则 - // 根据服务包id删除服务包对应的服务包内容 + @Transactional(rollbackFor = Exception.class) + public int updateServicePackage(ServicePackageAddDTO servicePackageAddDTO) { + // 判断所属科室下服务包名称是否存在 + int existNameCount = servicePackageMapper.existNameCount(servicePackageAddDTO.getDepartmentId(), servicePackageAddDTO.getPackageName()); + if (existNameCount > 0) { + throw new ServiceException("当前科室下服务包名称已存在"); + } + // 初始化ServicePackage,将servicePackageAddDTO赋值给ServicePackage,更新服务包 + ServicePackage servicePackage = new ServicePackage(); + BeanUtils.copyProperties(servicePackageAddDTO, servicePackage); + if (servicePackageMapper.updateServicePackage(servicePackage) <= 0) { + throw new ServiceException("修改服务包失败"); + } + // 根据服务包id先删除服务包内容 + if (servicePackageContentMapper.deleteServicePackageContentByPackageId(servicePackageAddDTO.getId()) <= 0) { + throw new ServiceException("删除服务包内容失败"); + } + // 新增服务内容 + String username = SecurityUtils.getUsername(); + Date nowDate = DateUtils.getNowDate(); + for (ServicePackageContentVO vo : servicePackageAddDTO.getVoList()) { + Long serviceWayId = createServiceWay(servicePackage, vo, username, nowDate); + Long serviceContentId = createServiceContent(servicePackage, vo, serviceWayId, username, nowDate); + createServiceFrequency(servicePackage, vo, serviceContentId, username, nowDate); + } + return 1; + } - // 执行新增的操作 - servicePackage.setUpdateTime(DateUtils.getNowDate()); - return servicePackageMapper.updateServicePackage(servicePackage); + /** + * 新增服务包方式 + */ + private Long createServiceWay(ServicePackage servicePackage, ServicePackageContentVO vo, String username, Date nowDate) { + Long serviceWayId = servicePackageContentMapper.countByPackageIdAndServiceWayName(servicePackage.getId(), vo.getServiceWayName()); + if (serviceWayId == null) { + ServicePackageContent serviceWay = new ServicePackageContent(); + serviceWay.setServicePackageId(servicePackage.getId()); + serviceWay.setServiceWayName(vo.getServiceWayName()); + serviceWay.setCreateBy(username); + serviceWay.setCreateTime(nowDate); + if (servicePackageContentMapper.insertServicePackageContent(serviceWay) <= 0) { + throw new ServiceException("新增服务包服务方式失败"); + } + return serviceWay.getId(); + } + return serviceWayId; + } + + /** + * 新增服务包内容 + */ + private Long createServiceContent(ServicePackage servicePackage, ServicePackageContentVO vo, Long serviceWayId, String username, Date nowDate) { + Long serviceContentId = servicePackageContentMapper.countByServiceWayIdAndServiceContent(serviceWayId, vo.getServiceContent()); + if (serviceContentId == null) { + ServicePackageContent serviceContent = new ServicePackageContent(); + serviceContent.setServicePackageId(servicePackage.getId()); + serviceContent.setServiceWayId(serviceWayId); + serviceContent.setServiceContent(vo.getServiceContent()); + serviceContent.setCreateBy(username); + serviceContent.setCreateTime(nowDate); + if (servicePackageContentMapper.insertServicePackageContent(serviceContent) <= 0) { + throw new ServiceException("新增服务包服务内容失败"); + } + return serviceContent.getId(); + } + return serviceContentId; + } + + /** + * 新增服务包频次 + */ + private void createServiceFrequency(ServicePackage servicePackage, ServicePackageContentVO vo, Long serviceContentId, String username, Date nowDate) { + if (servicePackageContentMapper.countByServiceContentIdAndServiceFrequency(serviceContentId, vo) > 0) { + throw new ServiceException("不能重复添加服务包内容"); + } + ServicePackageContent serviceFrequency = new ServicePackageContent(); + serviceFrequency.setServicePackageId(servicePackage.getId()); + serviceFrequency.setServiceContentId(serviceContentId); + serviceFrequency.setServiceFrequencyText(vo.getServiceFrequencyText()); + serviceFrequency.setServiceFrequencyStart(vo.getServiceFrequencyStart()); + serviceFrequency.setServiceFrequencyEnd(vo.getServiceFrequencyEnd()); + serviceFrequency.setCreateBy(username); + serviceFrequency.setCreateTime(nowDate); + if (servicePackageContentMapper.insertServicePackageContent(serviceFrequency) <= 0) { + throw new ServiceException("新增服务包服务频次失败"); + } } /** @@ -147,4 +224,16 @@ public class ServicePackageServiceImpl implements IServicePackageService { public int deleteServicePackageById(Long id) { return servicePackageMapper.deleteServicePackageById(id); } + + /** + * 修改服务包发布状态 + * + * @param id + * @param whetherRelease + * @return + */ + @Override + public int editReleaseStatus(Long id, Integer whetherRelease) { + return servicePackageMapper.editReleaseStatus(id, whetherRelease); + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/servicepackage/ServicePackageDetailVO.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/servicepackage/ServicePackageDetailVO.java index ad21c195..99f51512 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/servicepackage/ServicePackageDetailVO.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/servicepackage/ServicePackageDetailVO.java @@ -3,6 +3,7 @@ package com.xinelu.manage.vo.servicepackage; import com.xinelu.common.annotation.Excel; import com.xinelu.manage.vo.servicepackagecontent.ServicePackageContentVO; import com.xinelu.manage.vo.serviceway.ServiceWayVO; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -27,6 +28,20 @@ public class ServicePackageDetailVO { */ private Long id; + /** + * 所属科室id + */ + @ApiModelProperty(value = "所属科室id") + @Excel(name = "所属科室id") + private Long departmentId; + + /** + * 所属科室名称 + */ + @ApiModelProperty(value = "所属科室名称") + @Excel(name = "所属科室名称") + private String departmentName; + /** * 科室病种信息表id */ @@ -48,6 +63,20 @@ public class ServicePackageDetailVO { @Excel(name = "服务包名称") private String packageName; + /** + * 服务包简介 + */ + @ApiModelProperty(value = "服务包简介") + @Excel(name = "服务包简介") + private String packageIntroduction; + + /** + * 服务包版本号 + */ + @ApiModelProperty(value = "服务包版本号") + @Excel(name = "服务包版本号") + private String packageVersion; + /** * 服务包期限 */ @@ -62,11 +91,7 @@ public class ServicePackageDetailVO { @Excel(name = "服务包期限单位,年,月,日") private String packageTermUnit; - /** - * 服务包期限 + 单位 - */ - @ApiModelProperty(value = "服务期限") - @Excel(name = "服务期限") + @ApiModelProperty(value = "服务期限+单位") private String packageTermAndUnit; /** @@ -76,6 +101,12 @@ public class ServicePackageDetailVO { @Excel(name = "服务包价格,单位为:元") private BigDecimal packagePrice; + /** + * 服务包备注 + */ + @ApiModelProperty(value = "服务包备注") + @Excel(name = "服务包备注") + private String packageRemark; /** * 硬件类型,血压仪:BLOOD_PRESSURE,血糖仪:GLUCOSE_METER,心电仪:ELECTROCARDIOGRA @@ -84,6 +115,13 @@ public class ServicePackageDetailVO { @Excel(name = "硬件类型,血压仪:BLOOD_PRESSURE,血糖仪:GLUCOSE_METER,心电仪:ELECTROCARDIOGRA") private String hardwareType; + /** + * 是否发布,0:否,1:是 + */ + @ApiModelProperty(value = "是否发布,0:否,1:是") + @Excel(name = "是否发布,0:否,1:是") + private Integer whetherRelease; + /** * 服务内容列表 */ 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 dea59650..3941bf6c 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/operationInfo/OperationInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/operationInfo/OperationInfoMapper.xml @@ -71,6 +71,7 @@ #{sort} + order by create_time DESC + SELECT COUNT(1) + FROM script_info + WHERE common_script_name = #{scriptName} + and department_id = #{departmentId} + and id != #{id} + + insert into script_info @@ -149,6 +164,8 @@ script_remark, + script_file_path, + create_by, create_time, @@ -183,6 +200,8 @@ #{scriptRemark}, + #{scriptFilePath}, + #{createBy}, #{createTime}, @@ -233,6 +252,9 @@ script_remark = #{scriptRemark}, + script_file_path= + #{scriptFilePath}, + create_by = #{createBy}, diff --git a/postdischarge-manage/src/main/resources/mapper/manage/servicepackage/ServicePackageMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/servicepackage/ServicePackageMapper.xml index e06eed28..8eb877c6 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/servicepackage/ServicePackageMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/servicepackage/ServicePackageMapper.xml @@ -142,12 +142,17 @@ + + insert into service_package @@ -359,6 +372,12 @@ where id = #{id} + + update service_package + set whether_release =#{whetherRelease} + where id = #{id} + + delete from service_package diff --git a/postdischarge-manage/src/main/resources/mapper/manage/servicepackagecontent/ServicePackageContentMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/servicepackagecontent/ServicePackageContentMapper.xml index 1b3ce5cd..09a4db3f 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/servicepackagecontent/ServicePackageContentMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/servicepackagecontent/ServicePackageContentMapper.xml @@ -92,6 +92,43 @@ where id = #{id} + + + + + + insert into service_package_content @@ -218,10 +255,19 @@ #{id} + delete from service_package_content where service_package_id in #{id} + + + delete + from service_package_content + where service_package_id = #{id} + + + \ No newline at end of file diff --git a/postdischarge-manage/src/main/resources/mapper/manage/servicewaycontent/ServiceWayContentMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/servicewaycontent/ServiceWayContentMapper.xml index e2130f1e..337a1d20 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/servicewaycontent/ServiceWayContentMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/servicewaycontent/ServiceWayContentMapper.xml @@ -170,6 +170,7 @@ ) + order by swc1.create_time DESC,swc2.create_time DESC