diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicewaycontent/ServiceWayContentMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicewaycontent/ServiceWayContentMapper.java index 6c04f17a..495cdd3c 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicewaycontent/ServiceWayContentMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/servicewaycontent/ServiceWayContentMapper.java @@ -164,24 +164,6 @@ public interface ServiceWayContentMapper { */ int countByServiceFrequencyDTO(ServiceFrequencyDTO serviceFrequencyDTO); - /** - * 检查除当前记录之外是否存在同名的服务内容 - * - * @param serviceContentId - * @param serviceWayId - * @param serviceContent - * @return - */ - int countByContentExcludingId(@Param("serviceContentId") Long serviceContentId, @Param("serviceWayId") Long serviceWayId, @Param("serviceContent") String serviceContent); - - /** - * 检查除当前记录之外是否存在相同的服务频次 - * - * @param serviceWayContentEditDTO - * @return - */ - int countByServiceFrequencyExcludingId(@Param("serviceWayContentEditDTO") ServiceWayContentEditDTO serviceWayContentEditDTO); - /** * 判断当前服务方式下服务内容是否重复 * @@ -193,6 +175,7 @@ public interface ServiceWayContentMapper { /** * 检查TEXT类型的serviceFrequencyText是否重复 + * * @param serviceWayContentEditDTO * @return */ @@ -200,8 +183,16 @@ public interface ServiceWayContentMapper { /** * 检查DIGIT类型的serviceFrequencyStart和serviceFrequencyEnd是否重复 + * * @param serviceWayContentEditDTO * @return */ boolean isServiceFrequencyDigitDuplicate(@Param("serviceWayContentEditDTO") ServiceWayContentEditDTO serviceWayContentEditDTO); + + /** + * 更新服务频次 + * @param currentFrequency + * @return + */ + int updateServiceFrequency(ServiceWayContent currentFrequency); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/operationInfo/impl/OperationInfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/operationInfo/impl/OperationInfoServiceImpl.java index 208bc3d5..9713445f 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/operationInfo/impl/OperationInfoServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/operationInfo/impl/OperationInfoServiceImpl.java @@ -76,8 +76,7 @@ public class OperationInfoServiceImpl implements IOperationInfoService { @Transactional(rollbackFor = Exception.class) public int updateOperationInfo(OperationInfo operationInfo) { // 检查除当前记录之外是否存在同名的手术名称 - if (!operationInfo.getOperationName().equals(operationInfoMapper.selectOperationInfoById(operationInfo.getId())) - && operationInfoMapper.countByOperationNameExcludingId(operationInfo.getId(), operationInfo.getDepartmentId(), operationInfo.getOperationName()) > 0) { + if (operationInfoMapper.countByOperationNameExcludingId(operationInfo.getId(), operationInfo.getDepartmentId(), operationInfo.getOperationName()) > 0) { throw new ServiceException("手术名称已存在"); } // 设置修改人,修改时间 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 df3d4599..d44a18f2 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 @@ -84,8 +84,7 @@ public class ScriptInfoServiceImpl implements IScriptInfoService { @Transactional(rollbackFor = Exception.class) public int updateScriptInfo(ScriptInfo scriptInfo) { // 检查除当前记录之外是否存在同名的话术名称 - if (!scriptInfo.getCommonScriptName().equals(scriptInfoMapper.selectScriptInfoById(scriptInfo.getId()).getCommonScriptName()) - && scriptInfoMapper.countByScriptNameExcludingId(scriptInfo.getCommonScriptName(), scriptInfo.getDepartmentId(), scriptInfo.getId()) > 0) { + if (scriptInfoMapper.countByScriptNameExcludingId(scriptInfo.getCommonScriptName(), scriptInfo.getDepartmentId(), scriptInfo.getId()) > 0) { // 存在同名的通用话术名称,不能进行更新 throw new ServiceException("通用话术名称已存在,请使用其他名称。"); } else { 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 3a2f534e..124d5656 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 @@ -112,8 +112,7 @@ public class ServicePackageServiceImpl implements IServicePackageService { @Transactional(rollbackFor = Exception.class) public int updateServicePackage(ServicePackageAddDTO servicePackageAddDTO) { // 检查除当前记录之外是否存在同名的服务包名称 - if (!servicePackageAddDTO.getPackageName().equals(servicePackageMapper.selectServicePackagesById(servicePackageAddDTO.getId())) - && servicePackageMapper.countByPackageNameExcludingId(servicePackageAddDTO.getId(), servicePackageAddDTO.getDepartmentId(), servicePackageAddDTO.getPackageName()) > 0) { + if (servicePackageMapper.countByPackageNameExcludingId(servicePackageAddDTO.getId(), servicePackageAddDTO.getDepartmentId(), servicePackageAddDTO.getPackageName()) > 0) { throw new ServiceException("当前科室下服务包名称已存在"); } String username = SecurityUtils.getUsername(); diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/impl/ServiceWayContentServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/impl/ServiceWayContentServiceImpl.java index 3cf8edd7..463c3218 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/impl/ServiceWayContentServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/servicewaycontent/impl/ServiceWayContentServiceImpl.java @@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.Date; import java.util.List; +import java.util.Objects; /** * 服务方式内容Service业务层处理 @@ -167,31 +168,26 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService { currentFrequency.setServiceContentId(newServiceContent.getId()); } } - // 检查服务频次是否改变 - boolean serviceFrequencyChanged = false; - boolean isFrequencyDuplicate = false; + boolean serviceFrequencyChanged = !Objects.equals(currentFrequency.getServiceFrequencyType(), serviceWayContentEditDTO.getServiceFrequencyType()) + || !Objects.equals(currentFrequency.getServiceFrequencyText(), serviceWayContentEditDTO.getServiceFrequencyText()) + || !Objects.equals(currentFrequency.getServiceFrequencyStart(), serviceWayContentEditDTO.getServiceFrequencyStart()) + || !Objects.equals(currentFrequency.getServiceFrequencyEnd(), serviceWayContentEditDTO.getServiceFrequencyEnd()); - if ("TEXT".equals(serviceWayContentEditDTO.getServiceFrequencyType())) { - serviceFrequencyChanged = !currentFrequency.getServiceFrequencyText().equals(serviceWayContentEditDTO.getServiceFrequencyText()); - if (serviceFrequencyChanged) { - // 检查TEXT类型的serviceFrequencyText是否重复 + // 如果服务频次改变了,检查新服务频次的重复性 + if (serviceFrequencyChanged) { + boolean isFrequencyDuplicate = false; + if ("TEXT".equals(serviceWayContentEditDTO.getServiceFrequencyType())) { isFrequencyDuplicate = serviceWayContentMapper.isServiceFrequencyTextDuplicate(serviceWayContentEditDTO); - } - } else if ("DIGIT".equals(serviceWayContentEditDTO.getServiceFrequencyType())) { - serviceFrequencyChanged = !currentFrequency.getServiceFrequencyStart().equals(serviceWayContentEditDTO.getServiceFrequencyStart()) - || !currentFrequency.getServiceFrequencyEnd().equals(serviceWayContentEditDTO.getServiceFrequencyEnd()); - if (serviceFrequencyChanged) { - // 检查DIGIT类型的serviceFrequencyStart和serviceFrequencyEnd是否重复 + } else if ("DIGIT".equals(serviceWayContentEditDTO.getServiceFrequencyType())) { isFrequencyDuplicate = serviceWayContentMapper.isServiceFrequencyDigitDuplicate(serviceWayContentEditDTO); } - } - // 如果服务频次改变了,检查新服务频次的重复性 - if (serviceFrequencyChanged && isFrequencyDuplicate) { - throw new ServiceException("当前服务内容下服务频次已存在"); + if (isFrequencyDuplicate) { + throw new ServiceException("当前服务内容下服务频次已存在"); + } } - // 更新服务频次记录 + // 更新服务频次 currentFrequency.setServiceFrequencyType(serviceWayContentEditDTO.getServiceFrequencyType()); currentFrequency.setServiceFrequencyText(serviceWayContentEditDTO.getServiceFrequencyText()); currentFrequency.setServiceFrequencyStart(serviceWayContentEditDTO.getServiceFrequencyStart()); @@ -199,9 +195,11 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService { currentFrequency.setUpdateBy(username); currentFrequency.setUpdateTime(date); - if (serviceWayContentMapper.updateServiceWayContent(currentFrequency) <= 0) { + // 执行更新操作 + if (serviceWayContentMapper.updateServiceFrequency(currentFrequency) <= 0) { throw new ServiceException("修改服务频次失败"); } + return 1; } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/textmessage/impl/TextMessageServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/textmessage/impl/TextMessageServiceImpl.java index b52ad2b0..6f777863 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/textmessage/impl/TextMessageServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/textmessage/impl/TextMessageServiceImpl.java @@ -159,8 +159,7 @@ public class TextMessageServiceImpl implements ITextMessageService { @Transactional(rollbackFor = Exception.class) public int updateTextMessage(TextMessageTaskDTO textMessageTaskDTO) { // 检查除当前记录之外是否存在同名的短信模板名称 - if (!textMessageTaskDTO.getTextMessageName().equals(textMessageMapper.selectTextMessageById(textMessageTaskDTO.getId())) && - textMessageMapper.countByTextMessageNameExcludingId(textMessageTaskDTO.getId(), textMessageTaskDTO.getDepartmentId(), textMessageTaskDTO.getTextMessageName()) > 0) { + if (textMessageMapper.countByTextMessageNameExcludingId(textMessageTaskDTO.getId(), textMessageTaskDTO.getDepartmentId(), textMessageTaskDTO.getTextMessageName()) > 0) { throw new ServiceException("短信模板名称已存在"); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/wechattemplate/impl/WechatTemplateServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/wechattemplate/impl/WechatTemplateServiceImpl.java index 49371614..9d6216ea 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/wechattemplate/impl/WechatTemplateServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/wechattemplate/impl/WechatTemplateServiceImpl.java @@ -148,8 +148,7 @@ public class WechatTemplateServiceImpl implements IWechatTemplateService { @Transactional(rollbackFor = Exception.class) public int updateWechatTemplate(WechatTemplateTaskDTO wechatTemplateTaskDTO) { // 检查除当前记录之外是否存在同名的微信模板名称 - if (!wechatTemplateTaskDTO.getWechatTemplateName().equals(wechatTemplateMapper.selectWechatTemplateById(wechatTemplateTaskDTO.getId())) && - wechatTemplateMapper.countByWechatTemplateNameExcludingId(wechatTemplateTaskDTO.getId(), wechatTemplateTaskDTO.getDepartmentId(), wechatTemplateTaskDTO.getWechatTemplateName()) > 0) { + if (wechatTemplateMapper.countByWechatTemplateNameExcludingId(wechatTemplateTaskDTO.getId(), wechatTemplateTaskDTO.getDepartmentId(), wechatTemplateTaskDTO.getWechatTemplateName()) > 0) { throw new ServiceException("微信模板名称已存在"); } // 设置修改者和修改时间 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 6476a90a..02393571 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/servicewaycontent/ServiceWayContentMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/servicewaycontent/ServiceWayContentMapper.xml @@ -316,39 +316,6 @@ - - - -