|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONPObject;
|
|
import com.alibaba.fastjson.JSONPObject;
|
|
import com.yihu.edu.entity.RoleWithAuthorityCheck;
|
|
import com.yihu.edu.entity.RoleWithAuthorityCheck;
|
|
import com.yihu.es.entity.FollowupContentESDO;
|
|
import com.yihu.es.entity.FollowupContentESDO;
|
|
|
|
import com.yihu.es.entity.HealthEduArticleES;
|
|
import com.yihu.es.entity.HealthEduArticlePatient;
|
|
import com.yihu.es.entity.HealthEduArticlePatient;
|
|
import com.yihu.es.entity.RoleVo;
|
|
import com.yihu.es.entity.RoleVo;
|
|
import com.yihu.wlyy.config.es.ElasticFactory;
|
|
import com.yihu.wlyy.config.es.ElasticFactory;
|
|
@ -14,6 +15,7 @@ import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
import com.yihu.wlyy.entity.education.HealthEduArticle;
|
|
import com.yihu.wlyy.entity.education.HealthEduArticle;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.app.account.DoctorInfoService;
|
|
import com.yihu.wlyy.service.app.account.DoctorInfoService;
|
|
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
|
|
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
|
|
@ -57,6 +59,8 @@ public class JMJkEduArticleService extends BaseService {
|
|
private String esType;
|
|
private String esType;
|
|
@Value("${es.index.HealthEduArticlePatient}")
|
|
@Value("${es.index.HealthEduArticlePatient}")
|
|
private String esIndex;
|
|
private String esIndex;
|
|
|
|
@Autowired
|
|
|
|
private AdminTeamService adminTeamService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ElasticFactory elasticFactory;
|
|
private ElasticFactory elasticFactory;
|
|
@ -69,6 +73,8 @@ public class JMJkEduArticleService extends BaseService {
|
|
@Autowired
|
|
@Autowired
|
|
private DoctorDao doctorDao;
|
|
private DoctorDao doctorDao;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
private PatientDao patientDao;
|
|
|
|
@Autowired
|
|
private ElastricSearchSave elastricSearchSave;
|
|
private ElastricSearchSave elastricSearchSave;
|
|
@Autowired
|
|
@Autowired
|
|
private GcLabelService labelService;
|
|
private GcLabelService labelService;
|
|
@ -415,7 +421,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
* @param articleId 文章列表
|
|
* @param articleId 文章列表
|
|
*/
|
|
*/
|
|
@Transactional
|
|
@Transactional
|
|
public HealthEduArticlePatient savePCPushArticle(Set<String> patientSet,
|
|
|
|
|
|
public List<HealthEduArticleES> savePCPushArticle(Set<String> patientSet,
|
|
String sendCode,
|
|
String sendCode,
|
|
// String sendName,
|
|
// String sendName,
|
|
Integer sendType,
|
|
Integer sendType,
|
|
@ -427,87 +433,169 @@ public class JMJkEduArticleService extends BaseService {
|
|
String currentUserRoleLevel) throws Exception {
|
|
String currentUserRoleLevel) throws Exception {
|
|
|
|
|
|
|
|
|
|
String batchNo = UUID.randomUUID().toString();
|
|
|
|
List<Patient> patientList = new ArrayList<>();
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
for (String patient : patientSet) {
|
|
|
|
patientList.add(new Patient(patient));
|
|
|
|
|
|
|
|
|
|
List<HealthEduArticleES> healthEduArticleESList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
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;}
|
|
}
|
|
}
|
|
HealthEduArticlePatient healthEduArticlePatient = new HealthEduArticlePatient();
|
|
|
|
|
|
String sql = "select "+resultSql+" from dm_hospital where level=2 "+whereSql ;
|
|
|
|
List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
|
|
|
|
String doctorName = returnList.get(0).get("name")+"";
|
|
|
|
|
|
Doctor doctor = doctorDao.findByCode(sendCode);
|
|
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;}
|
|
|
|
|
|
AdminTeam adminTeam = adminTeamService.getTeam(teamId);
|
|
|
|
Patient one = null;
|
|
|
|
String batchNo = UUID.randomUUID().toString();
|
|
|
|
for (String patient : patientSet) {
|
|
|
|
|
|
|
|
one = patientDao.findByCode(patient);
|
|
|
|
HealthEduArticleES healthEduArticleES = new HealthEduArticleES();
|
|
|
|
healthEduArticleES.setBatchNo(batchNo);
|
|
|
|
healthEduArticleES.setPatientCode(patient);
|
|
|
|
healthEduArticleES.setPatientName(one.getName());
|
|
|
|
if(sendType==2){
|
|
|
|
|
|
|
|
healthEduArticleES.setDoctorCode(currentUserRoleCode);
|
|
|
|
healthEduArticleES.setDoctorName(doctorName);
|
|
|
|
healthEduArticleES.setSendLevel("4");
|
|
|
|
|
|
|
|
}else{
|
|
|
|
healthEduArticleES.setSendLevel(doctor.getLevel()+"");
|
|
}
|
|
}
|
|
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")+"";
|
|
|
|
|
|
|
|
|
|
healthEduArticleES.setSendCode(doctor.getCode());
|
|
|
|
healthEduArticleES.setSendName(doctor.getName());
|
|
|
|
healthEduArticleES.setSendPic(doctor.getPhoto());
|
|
|
|
healthEduArticleES.setSendSex(doctor.getSex()+"");
|
|
|
|
healthEduArticleES.setAdminTeamCode(adminTeam.getId());
|
|
|
|
healthEduArticleES.setAdminTeamName(adminTeam.getName());
|
|
|
|
healthEduArticleES.setHospital(doctor.getHospital());
|
|
|
|
healthEduArticleES.setHospitalName(doctor.getHospitalName());
|
|
|
|
healthEduArticleES.setTown(doctor.getTown());
|
|
|
|
healthEduArticleES.setTownName(doctor.getTownName());
|
|
|
|
healthEduArticleES.setCreateTime(new Date());
|
|
|
|
healthEduArticleES.setSendType(sendType);
|
|
|
|
JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
|
|
|
|
healthEduArticleES.setArticleId(article.get("articleId") + "");
|
|
|
|
healthEduArticleES.setArticleTitle(article.get("articleTitle") + "");
|
|
|
|
healthEduArticleES.setArticleCover(article.get("articleCover") + "");
|
|
|
|
healthEduArticleES.setArticleContent(article.get("articleContent") + "");
|
|
|
|
healthEduArticleES.setArticleCategoryId(article.get("articleCategoryId") + "");
|
|
|
|
healthEduArticleES.setFirstLevelCategoryId(article.get("firstLevelCategoryId") + "");
|
|
|
|
healthEduArticleES.setFirstLevelCategoryName(article.get("firstLevelCategoryName") + "");
|
|
|
|
healthEduArticleES.setSecondLevelCategoryId(article.get("secondLevelCategoryId") + "");
|
|
|
|
healthEduArticleES.setSecondLevelCategoryName(article.get("secondLevelCategoryName") + "");
|
|
|
|
healthEduArticleES.setOperatorId(article.get("operatorId") + "");
|
|
|
|
healthEduArticleES.setArticleSource(article.get("articleSource") + "");
|
|
Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(sendCode);
|
|
Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(sendCode);
|
|
List<String> roleList = (List<String>)resultMap.get("roleList");
|
|
List<String> roleList = (List<String>)resultMap.get("roleList");
|
|
List<RoleVo> roleVoLists= new ArrayList<>();
|
|
List<RoleVo> roleVoLists= new ArrayList<>();
|
|
for(String one:roleList){
|
|
|
|
|
|
for(String temp:roleList){
|
|
RoleVo roleVo = new RoleVo();
|
|
RoleVo roleVo = new RoleVo();
|
|
roleVo.setCode(one);
|
|
|
|
|
|
roleVo.setCode(temp);
|
|
roleVoLists.add(roleVo);
|
|
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()) : "");
|
|
|
|
|
|
healthEduArticleES.setRoleList(roleVoLists);
|
|
|
|
healthEduArticleES.setLeaveWords(leaveWords);
|
|
|
|
healthEduArticleES.setCurrentUserRoleCode(currentUserRoleCode);
|
|
|
|
healthEduArticleES.setCurrentUserRoleLevel(currentUserRoleLevel);
|
|
|
|
// healthEduArticleES.setSendSource();
|
|
|
|
healthEduArticleES.setAllCount(patientSet.size());
|
|
|
|
healthEduArticleESList.add(healthEduArticleES);
|
|
}
|
|
}
|
|
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);
|
|
|
|
|
|
|
|
//保存到ES中
|
|
//保存到ES中
|
|
elastricSearchSave.save(healthEduArticlePatient, esIndex, esType);
|
|
|
|
return healthEduArticlePatient;
|
|
|
|
|
|
elastricSearchSave.save(healthEduArticleESList, esIndex, esType);
|
|
|
|
return healthEduArticleESList;
|
|
}
|
|
}
|
|
public JSONObject pushArticleConfirm(String articleId, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode,String currentUserRole, String currentUserRoleLevel) throws Exception {
|
|
public JSONObject pushArticleConfirm(String articleId, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode,String currentUserRole, String currentUserRoleLevel) throws Exception {
|
|
JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
|
|
JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
|