|
@@ -7,6 +7,7 @@ import com.diagbot.dto.GetQuestionInfoDTO;
|
|
|
import com.diagbot.dto.QuestionIndexDTO;
|
|
|
import com.diagbot.dto.QuestionPageDTO;
|
|
|
import com.diagbot.entity.CommonParam;
|
|
|
+import com.diagbot.entity.DeptInfo;
|
|
|
import com.diagbot.entity.QuestionDetail;
|
|
|
import com.diagbot.entity.QuestionInfo;
|
|
|
import com.diagbot.entity.QuestionMapping;
|
|
@@ -116,7 +117,6 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 保存映射关系
|
|
|
*
|
|
@@ -136,14 +136,14 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
|
|
|
.set("modifier", person)
|
|
|
.set("is_deleted", IsDeleteEnum.Y.getKey()));
|
|
|
List<QuestionMappingWrapper> questionMappings = questionWrapper.getQuestionMappings();
|
|
|
- if(ListUtil.isNotEmpty(questionMappings)) {
|
|
|
+ if (ListUtil.isNotEmpty(questionMappings)) {
|
|
|
//预处理文字标签,之后统一添加映射关系
|
|
|
Map<String, Long> map = getNameMap(questionMappings, now, person, questionInfo.getType());
|
|
|
List<QuestionMapping> saveMapping = new ArrayList<>();
|
|
|
int i = 1;
|
|
|
- for(QuestionMappingWrapper mapping : questionMappings) {
|
|
|
+ for (QuestionMappingWrapper mapping : questionMappings) {
|
|
|
String text = mapping.getText();
|
|
|
- if(StringUtil.isNotEmpty(text)) {
|
|
|
+ if (StringUtil.isNotEmpty(text)) {
|
|
|
mapping.setSonQuestion(map.get(text));
|
|
|
}
|
|
|
QuestionMapping bean = new QuestionMapping();
|
|
@@ -179,11 +179,11 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
|
|
|
.eq("tag_type", TagTypeEnum.T8.getKey())
|
|
|
.in("name", nameList)
|
|
|
);
|
|
|
- Map<String, Long> map = questionInfos.stream().collect(Collectors.toMap(row -> row.getName(), row -> row.getId(), (k1,k2)->k1));
|
|
|
+ Map<String, Long> map = questionInfos.stream().collect(Collectors.toMap(row -> row.getName(), row -> row.getId(), (k1, k2) -> k1));
|
|
|
List<QuestionInfo> addBatch = new ArrayList<>();
|
|
|
List<String> nameExist = new ArrayList<>();
|
|
|
- for(String s : nameList) {
|
|
|
- if(map.get(s) == null && !nameExist.contains(s)) {
|
|
|
+ for (String s : nameList) {
|
|
|
+ if (map.get(s) == null && !nameExist.contains(s)) {
|
|
|
nameExist.add(s);
|
|
|
QuestionInfo bean = new QuestionInfo();
|
|
|
bean.setModifier(person);
|
|
@@ -199,8 +199,8 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
questionInfoService.saveBatch(addBatch); //批量插入question
|
|
|
- for(QuestionInfo bean : addBatch) {
|
|
|
- if(map.get(bean.getName()) == null) {
|
|
|
+ for (QuestionInfo bean : addBatch) {
|
|
|
+ if (map.get(bean.getName()) == null) {
|
|
|
map.put(bean.getName(), bean.getId());
|
|
|
}
|
|
|
}
|
|
@@ -255,11 +255,11 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
|
|
|
*/
|
|
|
public void saveQuestionInfo(QuestionWrapper questionWrapper, CommonParam param) {
|
|
|
QuestionInfo questionInfo = new QuestionInfo();
|
|
|
- if(questionWrapper.getId() != null) {
|
|
|
+ if (questionWrapper.getId() != null) {
|
|
|
questionInfo = this.getOne(new QueryWrapper<QuestionInfo>()
|
|
|
.eq("id", questionWrapper.getId())
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey()));
|
|
|
- if(questionInfo == null) { //校验
|
|
|
+ if (questionInfo == null) { //校验
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标签不存在");
|
|
|
}
|
|
|
param.setSaveOrUpdate("update");
|
|
@@ -380,55 +380,14 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
|
|
|
public List<GetQuestionInfoDTO> getQuestionUsualByDept(GetQuestionUsualByDeptVO getQuestionUsualByDeptVO) {
|
|
|
//先判断科室是不是已被删除
|
|
|
QueryWrapper<DeptInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
|
|
|
- .eq("id",getQuestionUsualByDeptVO.getDeptId());
|
|
|
+ queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("id", getQuestionUsualByDeptVO.getDeptId());
|
|
|
List<DeptInfo> deptInfoList = deptInfoFacade.list(queryWrapper);
|
|
|
- if(ListUtil.isEmpty(deptInfoList)){
|
|
|
+ if (ListUtil.isEmpty(deptInfoList)) {
|
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS, "科室信息不存在");
|
|
|
}
|
|
|
//获取常用标签信息
|
|
|
List<GetQuestionInfoDTO> getQuestionInfoDTOList = this.getQuestionUsualsByDept(getQuestionUsualByDeptVO);
|
|
|
return getQuestionInfoDTOList;
|
|
|
}
|
|
|
-
|
|
|
- public static void main(String[] args) {
|
|
|
- List<Person> list = new ArrayList<>();
|
|
|
- list.add(new Person(1L,"1d"));
|
|
|
- list.add(new Person(2L,"2d"));
|
|
|
- list.add(new Person(3L,"3d"));
|
|
|
- list.add(new Person(4L,"4d"));
|
|
|
- list.add(new Person(5L,"5d"));
|
|
|
- list.add(new Person(6L,"5d"));
|
|
|
- Map<String, Long> map = list.stream().collect(Collectors.toMap(Person::getText, Person::getId, (k1,k2)->k1));
|
|
|
- System.out.println(map);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-class Person {
|
|
|
- private Long id;
|
|
|
- private String text;
|
|
|
-
|
|
|
- public Person() {
|
|
|
- }
|
|
|
-
|
|
|
- public Person(Long id, String text) {
|
|
|
- this.id = id;
|
|
|
- this.text = text;
|
|
|
- }
|
|
|
-
|
|
|
- public String getText() {
|
|
|
- return text;
|
|
|
- }
|
|
|
-
|
|
|
- public void setText(String text) {
|
|
|
- this.text = text;
|
|
|
- }
|
|
|
-
|
|
|
- public Long getId() {
|
|
|
- return id;
|
|
|
- }
|
|
|
-
|
|
|
- public void setId(Long id) {
|
|
|
- this.id = id;
|
|
|
- }
|
|
|
-}
|
|
|
+}
|