|
@ -7,10 +7,12 @@ import com.yihu.es.entity.RoleVo;
|
|
|
import com.yihu.wlyy.config.es.ElasticFactory;
|
|
|
import com.yihu.wlyy.config.es.ElastricSearchSave;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.DoctorRole;
|
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
|
import com.yihu.wlyy.entity.education.HealthEduArticle;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorRoleDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.service.app.account.DoctorInfoService;
|
|
@ -80,6 +82,8 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
private SignPatientLabelInfoService signPatientLabelInfoService;
|
|
|
@Autowired
|
|
|
private DoctorInfoService doctorInfoService;
|
|
|
@Autowired
|
|
|
private DoctorRoleDao doctorRoleDao;
|
|
|
|
|
|
/**
|
|
|
*
|
|
@ -455,6 +459,84 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
String currentUserRoleLevel) throws Exception {
|
|
|
|
|
|
|
|
|
// String batchNo = UUID.randomUUID().toString();
|
|
|
// List<Patient> patientList = new ArrayList<>();
|
|
|
//
|
|
|
// for (String patient : patientSet) {
|
|
|
// patientList.add(new Patient(patient));
|
|
|
// }
|
|
|
// HealthEduArticlePatient healthEduArticlePatient = new HealthEduArticlePatient();
|
|
|
//
|
|
|
// Doctor doctor = doctorDao.findByCode(sendCode);
|
|
|
// String sendName = doctor.getName();
|
|
|
// //1、普通医生,2、管理员
|
|
|
// if(sendType==2){
|
|
|
// String resultSql ="";
|
|
|
// String whereSql ="";
|
|
|
// switch (currentUserRoleLevel){
|
|
|
// case "1":{resultSql +=" DISTINCT (province_name) as name";
|
|
|
// whereSql+=" and province ='"+currentUserRoleCode+"'";break;}
|
|
|
// case "2":{resultSql +=" DISTINCT (city_name) as name";
|
|
|
// whereSql+=" and city ='"+currentUserRoleCode+"'";break;}
|
|
|
// case "3":{resultSql +=" DISTINCT (town_name) as name";
|
|
|
// whereSql+=" and town ='"+currentUserRoleCode+"'";break;}
|
|
|
// case "4":{resultSql +=" DISTINCT (name) as name";
|
|
|
// whereSql+=" and code ='"+currentUserRoleCode+"'";break;}
|
|
|
// }
|
|
|
// String sql = "select "+resultSql+" from dm_hospital where level=2 "+whereSql ;
|
|
|
// List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
|
|
|
// sendName = returnList.get(0).get("name")+"";
|
|
|
//
|
|
|
// Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(sendCode);
|
|
|
// List<String> roleList = (List<String>)resultMap.get("roleList");
|
|
|
// List<RoleVo> roleVoLists= new ArrayList<>();
|
|
|
// for(String one:roleList){
|
|
|
// RoleVo roleVo = new RoleVo();
|
|
|
// roleVo.setCode(one);
|
|
|
// roleVoLists.add(roleVo);
|
|
|
// }
|
|
|
// healthEduArticlePatient.setRoleList(roleVoLists);
|
|
|
// healthEduArticlePatient.setCurrentUserRoleCode(currentUserRoleCode);
|
|
|
// healthEduArticlePatient.setCurrentUserRoleLevel(currentUserRoleLevel);
|
|
|
// }else{
|
|
|
// healthEduArticlePatient.setCurrentUserRoleCode(doctor.getHospital());
|
|
|
// healthEduArticlePatient.setCurrentUserRoleLevel("4");
|
|
|
// }
|
|
|
// healthEduArticlePatient.setSendType(sendType);
|
|
|
// healthEduArticlePatient.setDoctorCode(sendCode);
|
|
|
// healthEduArticlePatient.setSendName(sendName);
|
|
|
// healthEduArticlePatient.setAdminTeamCode(teamId);
|
|
|
// healthEduArticlePatient.setLeaveWords(leaveWords);
|
|
|
// if (doctor != null) {
|
|
|
// healthEduArticlePatient.setDoctorName(doctor.getName());
|
|
|
// healthEduArticlePatient.setHospital(doctor.getHospital());
|
|
|
// healthEduArticlePatient.setHospitalName(doctor.getHospitalName());
|
|
|
// healthEduArticlePatient.setTown(doctor.getTown());
|
|
|
// healthEduArticlePatient.setTownName(doctor.getTownName());
|
|
|
// healthEduArticlePatient.setSendLevel(doctor.getLevel() != null ? String.valueOf(doctor.getLevel()) : "");
|
|
|
// healthEduArticlePatient.setSendPic(doctor.getPhoto());
|
|
|
// healthEduArticlePatient.setSendSex(doctor.getSex() != null ? String.valueOf(doctor.getSex()) : "");
|
|
|
// }
|
|
|
// healthEduArticlePatient.setBatchNo(batchNo);
|
|
|
// healthEduArticlePatient.setCreateTime(new Date());
|
|
|
//
|
|
|
//
|
|
|
// //通过文章id 获取文章详情
|
|
|
// JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
|
|
|
//
|
|
|
// healthEduArticlePatient.setArticleId(article.get("articleId") + "");
|
|
|
// healthEduArticlePatient.setAttachedTitle(article.get("articleTitle") + "");
|
|
|
// healthEduArticlePatient.setAttachedPic(article.get("articleCover") + "");
|
|
|
// healthEduArticlePatient.setAttachedContent(article.get("articleContent") + "");
|
|
|
// healthEduArticlePatient.setAttachedMessage(sendMessage);
|
|
|
// healthEduArticlePatient.setArticleType(article.get("articleType") + "");
|
|
|
// healthEduArticlePatient.setLevel(article.get("articlelevel") + "");
|
|
|
// healthEduArticlePatient.setLevel1Type(article.get("firstLevelCategoryId") + "");
|
|
|
// healthEduArticlePatient.setLevel2Type(article.get("secondLevelCategoryId") + "");
|
|
|
// healthEduArticlePatient.setType("1");//文章
|
|
|
//// healthEduArticlePatient.setArticleUrl(articleBaseUrl+"JkEduWeb/web/jkEdu/articleDetail.html?behavior=4&articleId="+articleId+"&userId="+);
|
|
|
// healthEduArticlePatient.setPatients(patientList);
|
|
|
|
|
|
|
|
|
List<HealthEduArticleES> healthEduArticleESList = new ArrayList<>();
|
|
|
Doctor doctor = doctorDao.findByCode(sendCode);
|
|
@ -466,34 +548,41 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
Patient one = null;
|
|
|
String batchNo = UUID.randomUUID().toString();
|
|
|
String sendName = "";
|
|
|
List<DoctorRole> roleList = doctorRoleDao.findUserRole(sendCode);
|
|
|
if(sendType==2){
|
|
|
String resultSql ="";
|
|
|
String whereSql ="";
|
|
|
switch (currentUserRoleLevel){
|
|
|
case "1":{resultSql +=" DISTINCT (province_name) as name";
|
|
|
whereSql+=" and province ='"+currentUserRoleCode+"'";break;}
|
|
|
case "2":{resultSql +=" DISTINCT (city_name) as name";
|
|
|
whereSql+=" and city ='"+currentUserRoleCode+"'";break;}
|
|
|
case "3":{resultSql +=" DISTINCT (town_name) as name";
|
|
|
whereSql+=" and town ='"+currentUserRoleCode+"'";break;}
|
|
|
case "4":{resultSql +=" DISTINCT (name) as name";
|
|
|
whereSql+=" and code ='"+currentUserRoleCode+"'";break;}
|
|
|
// String resultSql ="";
|
|
|
// String whereSql ="";
|
|
|
// switch (currentUserRoleLevel){
|
|
|
// case "1":{resultSql +=" DISTINCT (province_name) as name";
|
|
|
// whereSql+=" and province ='"+currentUserRoleCode+"'";break;}
|
|
|
// case "2":{resultSql +=" DISTINCT (city_name) as name";
|
|
|
// whereSql+=" and city ='"+currentUserRoleCode+"'";break;}
|
|
|
// case "3":{resultSql +=" DISTINCT (town_name) as name";
|
|
|
// whereSql+=" and town ='"+currentUserRoleCode+"'";break;}
|
|
|
// case "4":{resultSql +=" DISTINCT (name) as name";
|
|
|
// whereSql+=" and code ='"+currentUserRoleCode+"'";break;}
|
|
|
// }
|
|
|
// String sql = "select "+resultSql+" from dm_hospital where level=2 "+whereSql ;
|
|
|
// List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
|
|
|
// sendName = returnList.get(0).get("name")+"";
|
|
|
//通过当前的登陆角色获取角色名称
|
|
|
for(DoctorRole ones :roleList){
|
|
|
if(ones.getCode().equals(currentUserRoleCode)){
|
|
|
if(currentUserRoleCode.length()==6&&!currentUserRoleCode.endsWith("00")){
|
|
|
sendName = ones.getName()+"卫生和计划生育局";
|
|
|
}else{
|
|
|
sendName = ones.getName();
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
String sql = "select "+resultSql+" from dm_hospital where level=2 "+whereSql ;
|
|
|
List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
|
|
|
sendName = returnList.get(0).get("name")+"";
|
|
|
}
|
|
|
Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(sendCode);
|
|
|
List<RoleVo> roleVoLists= new ArrayList<>();
|
|
|
if(resultMap.containsKey("roleList") && resultMap.get("roleList") != null){
|
|
|
List<String> roleList = (List<String>)resultMap.get("roleList");
|
|
|
for(String temp:roleList){
|
|
|
RoleVo roleVo = new RoleVo();
|
|
|
roleVo.setCode(temp);
|
|
|
roleVoLists.add(roleVo);
|
|
|
}
|
|
|
for(DoctorRole ones :roleList){
|
|
|
RoleVo roleVo = new RoleVo();
|
|
|
roleVo.setCode(ones.getCode());
|
|
|
roleVoLists.add(roleVo);
|
|
|
}
|
|
|
|
|
|
JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
|
|
|
Date createTime = new Date();
|
|
|
for (String patient : patientSet) {
|
|
@ -562,8 +651,6 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
e.setPatientCode(null);
|
|
|
e.setPatientName(null);
|
|
|
elastricSearchSave.save(e, esIndex, esType);
|
|
|
//记录推送量
|
|
|
thirdJkEduArticleService.saveBehavior(articleId,sendCode,7,patientSet.size());
|
|
|
|
|
|
return healthEduArticleESList;
|
|
|
}
|