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.
		
		
		
		
			
				
					
					
						
							126 lines
						
					
					
						
							5.2 KiB
						
					
					
				
			
		
		
	
	
							126 lines
						
					
					
						
							5.2 KiB
						
					
					
				| 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;
 | |
| 
 | |
| 
 | |
|         List<Doctor> dbDocList = registerDao.selectDocListByCodes(doctorList);
 | |
|         for (Doctor doctorItem : doctorList) {
 | |
|             String doctCode = doctorItem.getDoctCode();
 | |
|             if (ObjectUtils.isEmpty(doctCode)) {
 | |
|                 continue;
 | |
|             }
 | |
|             doctCode = doctCode.trim();
 | |
|             if (!"*".equals(doctCode)) { // 任意医生
 | |
|                 dbDoctor = dbDocList.stream().filter(o -> o.getDoctCode().equals(doctorItem.getDoctCode())).findFirst().orElse(null);
 | |
|                 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.setHeadImg(dbDoctor.getHeadImg());
 | |
|                     doctorItem.setPym(dbDoctor.getPym());
 | |
| 
 | |
|                     Integer skillState = dbDoctor.getSkillState();
 | |
|                     if (skillState == null || skillState == 0) {
 | |
|                         String skill = dbDoctor.getSkill();
 | |
|                         doctorItem.setSkill(ObjectUtils.isEmpty(skill) ? dbDoctor.getMetaSkill() : skill);
 | |
|                     } else {
 | |
|                         String metaSkill = dbDoctor.getMetaSkill();
 | |
|                         if (skillState == 10) { // 锁定微官网显示
 | |
|                             doctorItem.setSkill(dbDoctor.getDescription());
 | |
|                         } else if (skillState == 11) { // 锁定HIS显示
 | |
|                             doctorItem.setSkill(metaSkill);
 | |
|                         } else {
 | |
|                             doctorItem.setSkill(ObjectUtils.isEmpty(metaSkill) ? dbDoctor.getSkill() : metaSkill);
 | |
|                         }
 | |
|                     }
 | |
| 
 | |
|                     Integer descriptionState = dbDoctor.getDescriptionState();
 | |
|                     if (descriptionState == null || descriptionState == 0) { // 微官网为主
 | |
|                         description = dbDoctor.getDescription();
 | |
|                         doctorItem.setDescription(ObjectUtils.isEmpty(description) ? dbDoctor.getMetaDescription() : description);
 | |
|                     } else {
 | |
|                         String metaDescription = dbDoctor.getMetaDescription();
 | |
|                         if (descriptionState == 10) { // 锁定微官网显示
 | |
|                             doctorItem.setDescription(dbDoctor.getDescription());
 | |
|                         } else if (descriptionState == 11) { // 锁定HIS显示
 | |
|                             doctorItem.setDescription(metaDescription);
 | |
|                         } else { // HIS为主 - 1
 | |
|                             doctorItem.setDescription(ObjectUtils.isEmpty(metaDescription) ? dbDoctor.getDescription() : metaDescription);
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             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());
 | |
|     }
 | |
| }
 | |
| 
 |