修改话术信息接口,话术库图片上传
This commit is contained in:
parent
89dd838af3
commit
22d27660df
@ -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:
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改服务方式
|
||||
*
|
||||
|
||||
@ -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())
|
||||
|
||||
@ -25,6 +25,12 @@ import java.util.List;
|
||||
@ApiModel(value = "服务包新增DTO")
|
||||
public class ServicePackageAddDTO {
|
||||
|
||||
/**
|
||||
* 服务包id
|
||||
*/
|
||||
@ApiModelProperty(value = "服务包id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 科室id
|
||||
*/
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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<ServicePackageContentVO> 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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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<ServicePackageVO> selectServicePackageList(ServicePackage servicePackage) {
|
||||
List<ServicePackageVO> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
/**
|
||||
* 服务内容列表
|
||||
*/
|
||||
|
||||
@ -71,6 +71,7 @@
|
||||
#{sort}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectOperationInfoById" parameterType="Long"
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
<result property="scriptIntroduction" column="script_introduction"/>
|
||||
<result property="scriptSort" column="script_sort"/>
|
||||
<result property="scriptRemark" column="script_remark"/>
|
||||
<result property="scriptFilePath" column="script_file_path"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@ -38,6 +39,7 @@
|
||||
script_introduction,
|
||||
script_sort,
|
||||
script_remark,
|
||||
script_file_path,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
@ -104,7 +106,12 @@
|
||||
and script_remark =
|
||||
#{scriptRemark}
|
||||
</if>
|
||||
<if test="scriptFilePath != null and scriptFilePath != ''">
|
||||
and script_file_path =
|
||||
#{scriptFilePath}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectScriptInfoById" parameterType="Long"
|
||||
@ -121,6 +128,14 @@
|
||||
and common_script_name = #{commonScriptName}
|
||||
</select>
|
||||
|
||||
<select id="countByScriptNameExcludingId" resultType="java.lang.Integer">
|
||||
SELECT COUNT(1)
|
||||
FROM script_info
|
||||
WHERE common_script_name = #{scriptName}
|
||||
and department_id = #{departmentId}
|
||||
and id != #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScriptInfo" parameterType="ScriptInfo" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into script_info
|
||||
@ -149,6 +164,8 @@
|
||||
</if>
|
||||
<if test="scriptRemark != null">script_remark,
|
||||
</if>
|
||||
<if test="scriptFilePath != null">script_file_path,
|
||||
</if>
|
||||
<if test="createBy != null">create_by,
|
||||
</if>
|
||||
<if test="createTime != null">create_time,
|
||||
@ -183,6 +200,8 @@
|
||||
</if>
|
||||
<if test="scriptRemark != null">#{scriptRemark},
|
||||
</if>
|
||||
<if test="scriptFilePath != null">#{scriptFilePath},
|
||||
</if>
|
||||
<if test="createBy != null">#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">#{createTime},
|
||||
@ -233,6 +252,9 @@
|
||||
<if test="scriptRemark != null">script_remark =
|
||||
#{scriptRemark},
|
||||
</if>
|
||||
<if test="scriptFilePath != null"> script_file_path=
|
||||
#{scriptFilePath},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
</if>
|
||||
|
||||
@ -142,12 +142,17 @@
|
||||
<select id="selectServicePackagesById"
|
||||
resultType="com.xinelu.manage.vo.servicepackage.ServicePackageDetailVO">
|
||||
select sp.id,
|
||||
sp.department_id,
|
||||
sp.department_name,
|
||||
sp.disease_type_id,
|
||||
sp.disease_type_name,
|
||||
sp.package_name,
|
||||
sp.package_introduction,
|
||||
sp.package_version,
|
||||
sp.package_term,
|
||||
sp.package_term_unit,
|
||||
sp.package_price,
|
||||
sp.package_remark,
|
||||
sp.hardware_type
|
||||
from service_package sp
|
||||
where sp.id = #{id}
|
||||
@ -205,10 +210,11 @@
|
||||
#{whetherRelease}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time DESC
|
||||
</select>
|
||||
<select id="selectServicePackageVOListById"
|
||||
resultType="com.xinelu.manage.vo.servicepackagecontent.ServicePackageContentVO">
|
||||
select spc1.id ,
|
||||
select spc1.id,
|
||||
spc1.service_way_name,
|
||||
spc2.id AS serviceContentId,
|
||||
spc2.service_content,
|
||||
@ -224,6 +230,13 @@
|
||||
where spc1.service_package_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="existNameCount" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from service_package
|
||||
where department_id = #{departmentId}
|
||||
and package_name = #{packageName}
|
||||
</select>
|
||||
|
||||
<insert id="insertServicePackage" parameterType="ServicePackage" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into service_package
|
||||
@ -359,6 +372,12 @@
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="editReleaseStatus">
|
||||
update service_package
|
||||
set whether_release =#{whetherRelease}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteServicePackageById" parameterType="Long">
|
||||
delete
|
||||
from service_package
|
||||
|
||||
@ -92,6 +92,43 @@
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="countByPackageIdAndServiceWayName" resultType="java.lang.Long">
|
||||
select id
|
||||
from service_package_content
|
||||
where service_package_id = #{id}
|
||||
and service_way_name = #{serviceWayName}
|
||||
</select>
|
||||
|
||||
<select id="countByServiceWayIdAndServiceContent" resultType="java.lang.Long">
|
||||
select id
|
||||
from service_package_content
|
||||
where service_way_id = #{serviceWayId}
|
||||
and service_content = #{serviceContent}
|
||||
</select>
|
||||
|
||||
<select id="countByServiceContentIdAndServiceFrequency" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from service_package_content
|
||||
<where>
|
||||
<if test="serviceContentId != null ">
|
||||
and service_content_id =
|
||||
#{serviceContentId}
|
||||
</if>
|
||||
<if test="vo.serviceFrequencyText != null and vo.serviceFrequencyText != ''">
|
||||
and service_frequency_text =
|
||||
#{vo.serviceFrequencyText}
|
||||
</if>
|
||||
<if test="vo.serviceFrequencyStart != null ">
|
||||
and service_frequency_start =
|
||||
#{vo.serviceFrequencyStart}
|
||||
</if>
|
||||
<if test="vo.serviceFrequencyEnd != null ">
|
||||
and service_frequency_end =
|
||||
#{vo.serviceFrequencyEnd}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertServicePackageContent" parameterType="ServicePackageContent" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into service_package_content
|
||||
@ -218,10 +255,19 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteServicePackageContentByPackageIds">
|
||||
delete from service_package_content where service_package_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteServicePackageContentByPackageId" parameterType="java.lang.Long">
|
||||
delete
|
||||
from service_package_content
|
||||
where service_package_id = #{id}
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -170,6 +170,7 @@
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
order by swc1.create_time DESC,swc2.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectServiceWayContentDetailByFrequencyId"
|
||||
|
||||
@ -137,6 +137,7 @@
|
||||
#{textMessageStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by tm.create_time DESC ,tmst.create_time DESC
|
||||
</select>
|
||||
<select id="countByTextMessageTaskDTO" resultType="java.lang.Integer"
|
||||
parameterType="com.xinelu.manage.dto.textmessage.TextMessageTaskDTO">
|
||||
|
||||
@ -152,6 +152,7 @@
|
||||
#{templateSource}
|
||||
</if>
|
||||
</where>
|
||||
order by wt.create_time DESC,wtst.create_time DESC
|
||||
</select>
|
||||
<select id="selectWechatTemplateDtoById" resultMap="WechatTemplateVOResultMap">
|
||||
select wt.id,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user