diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/impl/KnowledgeBaseServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/impl/KnowledgeBaseServiceImpl.java index 8e90ca20..a6813aa0 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/impl/KnowledgeBaseServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/knowledgebase/impl/KnowledgeBaseServiceImpl.java @@ -11,6 +11,7 @@ import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.common.utils.codes.GenerateSystemCodeUtil; +import com.xinelu.common.utils.uuid.IdUtils; import com.xinelu.manage.domain.agency.Agency; import com.xinelu.manage.domain.department.Department; import com.xinelu.manage.domain.departmentdiseasetype.DepartmentDiseaseType; @@ -19,8 +20,6 @@ import com.xinelu.manage.domain.propagandainfo.PropagandaInfo; import com.xinelu.manage.domain.propagandamaterials.PropagandaMaterials; import com.xinelu.manage.domain.questioninfo.QuestionInfo; import com.xinelu.manage.domain.scriptInfo.ScriptInfo; -import com.xinelu.manage.domain.servicepackage.ServicePackage; -import com.xinelu.manage.domain.servicepackagecontent.ServicePackageContent; import com.xinelu.manage.domain.specialdiseasenode.SpecialDiseaseNode; import com.xinelu.manage.domain.specialdiseasetriggercondition.SpecialDiseaseTriggerCondition; import com.xinelu.manage.domain.textmessage.TextMessage; @@ -69,6 +68,7 @@ import com.xinelu.manage.service.wechattemplate.IWechatTemplateService; import com.xinelu.manage.vo.questionInfo.QuestionVO; import com.xinelu.manage.vo.questionsubject.QuestionSubjectVO; import com.xinelu.manage.vo.questionsubjectoption.QuestionSubjectOptionVO; +import com.xinelu.manage.vo.servicepackage.ServicePackageDetailVO; import com.xinelu.manage.vo.servicepackage.ServicePackageVO; import com.xinelu.manage.vo.servicepackagecontent.ServicePackageContentVO; import com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO; @@ -326,7 +326,14 @@ public class KnowledgeBaseServiceImpl implements IKnowledgeBaseService { scriptInfo.setDiseaseTypeName(diseaseTypeList.get(0).getDiseaseTypeName()); } } - scriptInfoService.insertScriptInfo(scriptInfo); + if (scriptInfoMapper.countByScriptInfo(scriptInfo) > 0) { + throw new ServiceException("通用话术名称已存在"); + } + // 设置创建人与创建时间 + scriptInfo.setCreateBy(SecurityUtils.getUsername()); + scriptInfo.setCreateTime(LocalDateTime.now()); + scriptInfo.setScriptId(IdUtils.fastUUID()); + scriptInfoMapper.insertScriptInfo(scriptInfo); }); } @@ -459,23 +466,23 @@ public class KnowledgeBaseServiceImpl implements IKnowledgeBaseService { private void saveServicePackage(KnowledgeBaseSaveDto knowledgeBaseSaveDto) { knowledgeBaseSaveDto.getSourceTemplateIds().forEach(sourceId -> { ServicePackageAddDTO servicePackageAddDTO = new ServicePackageAddDTO(); - ServicePackage servicePackage = servicePackageMapper.selectServicePackageById(sourceId); + ServicePackageDetailVO servicePackageDetail = servicePackageService.selectServicePackageById(sourceId); - BeanUtils.copyBeanProp(servicePackageAddDTO, servicePackage); + BeanUtils.copyBeanProp(servicePackageAddDTO, servicePackageDetail); servicePackageAddDTO.setId(null); servicePackageAddDTO.setSourceTemplateId(sourceId); servicePackageAddDTO.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId()); servicePackageAddDTO.setDepartmentName(knowledgeBaseSaveDto.getDepartmentName()); - if (servicePackage.getDiseaseTypeId() != null) { + if (servicePackageDetail.getDiseaseTypeId() != null) { DepartmentDiseaseTypeDto departmentDiseaseType = new DepartmentDiseaseTypeDto(); departmentDiseaseType.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId()); - departmentDiseaseType.setDiseaseTypeName(servicePackage.getDiseaseTypeName()); + departmentDiseaseType.setDiseaseTypeName(servicePackageDetail.getDiseaseTypeName()); List diseaseTypeList = departmentDiseaseTypeService.selectDepartmentDiseaseTypeList(departmentDiseaseType); if (CollectionUtils.isEmpty(diseaseTypeList)) { // 新增病种 DepartmentDiseaseType diseaseTypeSaveObj = new DepartmentDiseaseType(); - diseaseTypeSaveObj.setDiseaseTypeName(servicePackage.getDiseaseTypeName()); + diseaseTypeSaveObj.setDiseaseTypeName(servicePackageDetail.getDiseaseTypeName()); diseaseTypeSaveObj.setDepartmentId(knowledgeBaseSaveDto.getDepartmentId()); diseaseTypeSaveObj.setDepartmentName(knowledgeBaseSaveDto.getDepartmentName()); departmentDiseaseTypeService.insertDepartmentDiseaseType(diseaseTypeSaveObj); @@ -487,15 +494,8 @@ public class KnowledgeBaseServiceImpl implements IKnowledgeBaseService { } } - ServicePackageContent servicePackageContent = new ServicePackageContent(); - servicePackageContent.setServicePackageId(sourceId); - List servicePackageContentList = servicePackageContentMapper.selectServicePackageContentList(servicePackageContent); - List voList = new ArrayList<>(); - servicePackageContentList.forEach(content -> { - ServicePackageContentVO servicePackageContentVO = new ServicePackageContentVO(); - BeanUtils.copyBeanProp(servicePackageContentVO, content); - voList.add(servicePackageContentVO); - }); + List voList = servicePackageDetail.getVoList(); + servicePackageAddDTO.setVoList(voList); servicePackageService.insertServicePackage(servicePackageAddDTO); });