|
@ -2,11 +2,14 @@ package com.yihu.jw.base.service.doctor.excelImport;
|
|
|
|
|
|
|
|
|
|
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
|
|
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
|
|
|
|
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDictDao;
|
|
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
|
|
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
|
|
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
|
|
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
|
|
import com.yihu.jw.dict.dao.DictDoctorDutyDao;
|
|
import com.yihu.jw.dict.dao.DictDoctorDutyDao;
|
|
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
|
|
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
|
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
|
|
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
|
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
import com.yihu.jw.org.dao.BaseOrgDao;
|
|
import com.yihu.jw.org.dao.BaseOrgDao;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
@ -16,6 +19,7 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.HashSet;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 医生信息列表-excel解析类
|
|
* 医生信息列表-excel解析类
|
|
@ -33,6 +37,10 @@ public class BaseDoctorExcelDOReader extends AExcelReader {
|
|
private DictJobTitleDao jobTitleDao;
|
|
private DictJobTitleDao jobTitleDao;
|
|
@Autowired
|
|
@Autowired
|
|
private BaseDoctorRoleInfoDao roleInfoDao;
|
|
private BaseDoctorRoleInfoDao roleInfoDao;
|
|
|
|
@Autowired
|
|
|
|
private BaseDoctorRoleDictDao baseDoctorRoleDictDao;
|
|
|
|
@Autowired
|
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void read(Workbook rwb) throws Exception {
|
|
public void read(Workbook rwb) throws Exception {
|
|
@ -51,6 +59,8 @@ public class BaseDoctorExcelDOReader extends AExcelReader {
|
|
getRepeat().put("isFamous", new HashSet<>());
|
|
getRepeat().put("isFamous", new HashSet<>());
|
|
getRepeat().put("expertise", new HashSet<>());
|
|
getRepeat().put("expertise", new HashSet<>());
|
|
getRepeat().put("brief", new HashSet<>());
|
|
getRepeat().put("brief", new HashSet<>());
|
|
|
|
errorLs.clear();
|
|
|
|
correctLs.clear();
|
|
while (sheets.hasNext()){
|
|
while (sheets.hasNext()){
|
|
Sheet sheet = sheets.next();
|
|
Sheet sheet = sheets.next();
|
|
if ((rows = sheet.getLastRowNum()) == 0) {
|
|
if ((rows = sheet.getLastRowNum()) == 0) {
|
|
@ -71,7 +81,7 @@ public class BaseDoctorExcelDOReader extends AExcelReader {
|
|
baseDoctorExcelDO.setBrief(replaceBlank(getCellCont(sheet, i, 10)));
|
|
baseDoctorExcelDO.setBrief(replaceBlank(getCellCont(sheet, i, 10)));
|
|
baseDoctorExcelDO.setExcelSeq(i);
|
|
baseDoctorExcelDO.setExcelSeq(i);
|
|
int rs = baseDoctorExcelDO.validate(repeat);
|
|
int rs = baseDoctorExcelDO.validate(repeat);
|
|
if (rs == 0||validate(baseDoctorExcelDO)== 0) {
|
|
|
|
|
|
if (validate(baseDoctorExcelDO)== 0||rs == 0) {
|
|
errorLs.add(baseDoctorExcelDO);
|
|
errorLs.add(baseDoctorExcelDO);
|
|
} else if (rs == 1) {
|
|
} else if (rs == 1) {
|
|
correctLs.add(baseDoctorExcelDO);
|
|
correctLs.add(baseDoctorExcelDO);
|
|
@ -91,7 +101,23 @@ public class BaseDoctorExcelDOReader extends AExcelReader {
|
|
}
|
|
}
|
|
public int validate(BaseDoctorExcelDO baseDoctorExcelDO) {
|
|
public int validate(BaseDoctorExcelDO baseDoctorExcelDO) {
|
|
int rs = 1;
|
|
int rs = 1;
|
|
if(StringUtils.isNotEmpty(baseDoctorExcelDO.getHospitalInfo())){
|
|
|
|
|
|
if (StringUtils.isNoneBlank(baseDoctorExcelDO.getIdcard())){
|
|
|
|
List<BaseDoctorDO> baseDoctorDO = baseDoctorDao.findByIdcard(baseDoctorExcelDO.getIdcard());
|
|
|
|
System.out.println("当前导入数据的身份证号:"+baseDoctorExcelDO.getIdcard());
|
|
|
|
if (baseDoctorDO!=null&&baseDoctorDO.size()>0){
|
|
|
|
System.out.println("进入身份验证有重复数据"+baseDoctorDO.get(0).getIdcard());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(baseDoctorExcelDO.getMobile())){
|
|
|
|
System.out.println("当前导入数据的电话号:"+baseDoctorExcelDO.getMobile());
|
|
|
|
List<BaseDoctorDO> baseDoctorDO = baseDoctorDao.findByMobile(baseDoctorExcelDO.getMobile());
|
|
|
|
if (baseDoctorDO!=null&&baseDoctorDO.size()>0){
|
|
|
|
System.out.println("进入电话验证有重复数据"+baseDoctorDO.get(0).getMobile());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(StringUtils.isNoneBlank(baseDoctorExcelDO.getHospitalInfo())){
|
|
String[] hospitals = baseDoctorExcelDO.getHospitalInfo().split(";");
|
|
String[] hospitals = baseDoctorExcelDO.getHospitalInfo().split(";");
|
|
for(String hospital:hospitals){
|
|
for(String hospital:hospitals){
|
|
String[] element = hospital.split("/");
|
|
String[] element = hospital.split("/");
|
|
@ -112,20 +138,20 @@ public class BaseDoctorExcelDOReader extends AExcelReader {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(StringUtils.isNotEmpty(baseDoctorExcelDO.getRoleInfo())){
|
|
|
|
|
|
if(StringUtils.isNoneBlank(baseDoctorExcelDO.getRoleInfo())){
|
|
String[] roles = baseDoctorExcelDO.getRoleInfo().split(";");
|
|
String[] roles = baseDoctorExcelDO.getRoleInfo().split(";");
|
|
for(String role:roles){
|
|
for(String role:roles){
|
|
String[] element = role.split(",");
|
|
String[] element = role.split(",");
|
|
String roleCode = element[0];
|
|
String roleCode = element[0];
|
|
if(!roleInfoDao.existsByCode(roleCode)){
|
|
|
|
|
|
if(!baseDoctorRoleDictDao.existsByCode(roleCode)){
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(StringUtils.isEmpty(baseDoctorExcelDO.getIdcard())){
|
|
|
|
|
|
if(StringUtils.isBlank(baseDoctorExcelDO.getIdcard())){
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
if(StringUtils.isEmpty(baseDoctorExcelDO.getMobile())){
|
|
|
|
|
|
if(StringUtils.isBlank(baseDoctorExcelDO.getMobile())){
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
return rs;
|
|
return rs;
|