You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
3.2 KiB
91 lines
3.2 KiB
2 years ago
|
package com.ynxbd.common.service;
|
||
|
|
||
|
import com.ynxbd.common.bean.Doctor;
|
||
|
import com.ynxbd.common.dao.RegisterDao;
|
||
|
import org.apache.commons.lang3.ObjectUtils;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Comparator;
|
||
|
import java.util.List;
|
||
|
import java.util.stream.Collectors;
|
||
|
|
||
|
/**
|
||
|
* @Author wsq
|
||
|
* @Date 2021/7/9 14:48
|
||
|
* @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
|
||
|
*/
|
||
|
public class DoctorService {
|
||
|
|
||
|
/**
|
||
|
* 医生字段空字符串处理、排序
|
||
|
*/
|
||
|
public List<Doctor> doctorHandle(List<Doctor> doctorList) {
|
||
|
RegisterDao registerDao = new RegisterDao();
|
||
|
|
||
|
List<Doctor> resultList = new ArrayList<>();
|
||
|
String title, customTitle; // 职称
|
||
|
String description; // 特长
|
||
|
Doctor dbDoctor; // 数据库中的医生
|
||
|
Boolean isDisabled;
|
||
|
for (Doctor doctorItem : doctorList) {
|
||
|
dbDoctor = registerDao.selectDoctorByCodeOrName(doctorItem.getDoctCode(), doctorItem.getDoctName());
|
||
|
if (dbDoctor != null) {
|
||
|
isDisabled = dbDoctor.getIsDisabled();
|
||
|
if ((isDisabled != null && isDisabled)) { // 禁用 | 移除
|
||
|
continue;
|
||
|
}
|
||
|
customTitle = dbDoctor.getCustomTitle();
|
||
|
if (!ObjectUtils.isEmpty(customTitle)) {
|
||
|
doctorItem.setTitle(customTitle);
|
||
|
} else {
|
||
|
title = dbDoctor.getTitle();
|
||
|
if (!ObjectUtils.isEmpty(title)) {
|
||
|
doctorItem.setTitle(title);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
doctorItem.setSkill(dbDoctor.getSkill());
|
||
|
doctorItem.setHeadImg(dbDoctor.getHeadImg());
|
||
|
doctorItem.setPym(dbDoctor.getPym());
|
||
|
description = dbDoctor.getDescription();
|
||
|
if (description != null && !"".equals(description)) { // 医生特长以wx为主
|
||
|
doctorItem.setDescription(description);
|
||
|
}
|
||
|
}
|
||
|
title = doctorItem.getTitle();
|
||
|
if (title != null && title.length() > 2) {
|
||
|
title = title.substring(0, 2);
|
||
|
switch (title) {
|
||
|
case "主任":
|
||
|
doctorItem.setTitleCode("1");
|
||
|
break;
|
||
|
|
||
|
case "副主":
|
||
|
doctorItem.setTitleCode("2");
|
||
|
break;
|
||
|
|
||
|
case "主治":
|
||
|
doctorItem.setTitleCode("3");
|
||
|
break;
|
||
|
|
||
|
case "住院":
|
||
|
doctorItem.setTitleCode("4");
|
||
|
break;
|
||
|
|
||
|
case "普通":
|
||
|
doctorItem.setTitleCode("5");
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
doctorItem.setTitleCode("98");
|
||
|
break;
|
||
|
}
|
||
|
} else {
|
||
|
doctorItem.setTitleCode("99");
|
||
|
}
|
||
|
resultList.add(doctorItem);
|
||
|
}
|
||
|
return resultList.stream().sorted(Comparator.comparing(Doctor::getTitleCode)).collect(Collectors.toList());
|
||
|
}
|
||
|
}
|