|
@ -58,7 +58,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
private String esIndex;
|
|
|
@Autowired
|
|
|
private AdminTeamService adminTeamService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private ElasticFactory elasticFactory;
|
|
|
@Autowired
|
|
@ -143,10 +143,11 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
HealthEduArticlePatientModel heapm = null;
|
|
|
JSONObject article = null;
|
|
|
Doctor doctor = null;
|
|
|
|
|
|
|
|
|
List<HealthEduArticlePatientModel> resultList = new ArrayList<>();
|
|
|
|
|
|
StringBuffer sql3 = null;
|
|
|
StringBuffer sql4 = null;
|
|
|
for (HealthEduArticleES one : esList) {
|
|
|
|
|
|
|
|
@ -181,29 +182,45 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
heapm.setReadNumber(0L);
|
|
|
}
|
|
|
|
|
|
//备注:因为1.4.1前端的阅读数取值的参数是browseNumber,到1.4.2前端再做调整为ReadNumber
|
|
|
if(!StringUtils.isEmpty(article.getString("browseNumber"))){
|
|
|
heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
|
|
|
}else{
|
|
|
heapm.setBrowseNumbere(0);//文章浏览数
|
|
|
}
|
|
|
// if(num!=null){
|
|
|
// heapm.setBrowseNumbere(Integer.valueOf(num.intValue()));//文章浏览数
|
|
|
// }else{
|
|
|
// heapm.setBrowseNumbere(0);//文章浏览数
|
|
|
// }
|
|
|
sql4 = new StringBuffer();
|
|
|
sql4.append("SELECT COUNT(*) as num FROM "+esType+" WHERE batchNo = '"+one.getBatchNo()+"' AND patientCode is not null AND articleId='"+article.getString("articleId")+"'");
|
|
|
// sql4.append("SELECT COUNT(*) as num FROM "+esType+" WHERE doctorCode='"+one.getDoctorCode()+"' AND patientCode is not null AND articleId='"+article.getString("articleId")+"'");
|
|
|
// System.out.printf("AllCount:"+sql4.toString());
|
|
|
Long num2 = elasticsearchUtil.excuteForLong(sql4.toString(), esType, esIndex);
|
|
|
if(num2!=null){
|
|
|
heapm.setAllCount(num2.intValue());//发送数
|
|
|
}else{
|
|
|
heapm.setAllCount(0);//发送数
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(article.getString("commentNumber"))){
|
|
|
heapm.setCommentNumber(Integer.valueOf(article.getString("commentNumber")));//文章评论数
|
|
|
}else{
|
|
|
heapm.setCommentNumber(0);//文章评论数
|
|
|
}
|
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(article.getString("pointNumber"))){
|
|
|
heapm.setPointNumber(Integer.valueOf(article.getString("pointNumber")));//文章点赞数
|
|
|
}else{
|
|
|
heapm.setPointNumber(0);//文章点赞数
|
|
|
}
|
|
|
|
|
|
if(!StringUtils.isEmpty(article.getString("collectionNumberCount"))){
|
|
|
heapm.setCollectionNumber(Integer.valueOf(article.getString("collectionNumberCount")));//文章点赞数
|
|
|
if(!StringUtils.isEmpty(article.getString("collectionNumber"))){
|
|
|
heapm.setCollectionNumber(Integer.valueOf(article.getString("collectionNumber")));//文章点赞数
|
|
|
}else{
|
|
|
heapm.setCollectionNumber(0);//文章点赞数
|
|
|
}
|
|
|
|
|
|
|
|
|
heapm.setArticleCover(article.getString("articleCover"));//封面
|
|
|
if(article.getString("insertTime")!=null){
|
|
|
heapm.setComputeTime(computeTime(article.getString("insertTime")));
|
|
@ -307,137 +324,6 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
}
|
|
|
|
|
|
|
|
|
// public String fetchUserHighestAuthority(List<Map<String, Object>> resultMap){
|
|
|
// String result = "";
|
|
|
// for(Map<String, Object> one:resultMap){
|
|
|
// String role = one.get("roleCode").toString();
|
|
|
// if(role.length()==6){
|
|
|
// if("00".equals(role.substring(4))){
|
|
|
// return role;
|
|
|
// }else {
|
|
|
// result = role;
|
|
|
// }
|
|
|
// }else{
|
|
|
// if(result.length()==6){
|
|
|
//
|
|
|
// }else{
|
|
|
//
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// /**
|
|
|
// * 保存发送信息
|
|
|
// *
|
|
|
// * @param patientSet 患者set集和
|
|
|
// * @param sendCode 发送人code、
|
|
|
// * @param sendMessage 发送人携带的信息
|
|
|
// * @param teamId 发送人所属团队
|
|
|
// * @param articleId 文章列表
|
|
|
// */
|
|
|
// @Transactional
|
|
|
// public HealthEduArticlePatient saveArticle(Set<String> patientSet,
|
|
|
// String sendCode,
|
|
|
//// String sendName,
|
|
|
// Integer sendType,
|
|
|
// String sendMessage,
|
|
|
// Long teamId,
|
|
|
// String articleId,
|
|
|
// String leaveWords) 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();
|
|
|
// //1、医生,2、卫计委(管理员)
|
|
|
// //如果是卫计委得区别角色
|
|
|
// Doctor doctor = doctorDao.findByCode(sendCode);
|
|
|
// String sendName = doctor.getName();
|
|
|
// //管理员
|
|
|
// Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(sendCode);
|
|
|
// Integer level = (Integer)resultMap.get("level");
|
|
|
// List<String> roleList = (List<String>)resultMap.get("roleList");
|
|
|
// if(doctor.getLevel()==10&&sendType==2){
|
|
|
// String resultSql ="";
|
|
|
// String whereSql ="";
|
|
|
// String temp = "";
|
|
|
// for(String one :roleList){
|
|
|
// temp+=",'"+one+"'";
|
|
|
// }
|
|
|
// if(!StringUtils.isEmpty(temp)){
|
|
|
// temp=temp.substring(1);
|
|
|
// }
|
|
|
// switch (level){
|
|
|
// case 1:{resultSql +=" DISTINCT (province_name) as name";
|
|
|
// whereSql+=" and province in ("+temp+")";break;}
|
|
|
// case 2:{resultSql +=" DISTINCT (city_name) as name";
|
|
|
// whereSql+=" and city in ("+temp+")";break;}
|
|
|
// case 3:{resultSql +=" DISTINCT (town_name) as name";
|
|
|
// whereSql+=" and town in ("+temp+")";break;}
|
|
|
// case 4:{resultSql +=" DISTINCT (name) as name";
|
|
|
// whereSql+=" and code in ("+temp+")";break;}
|
|
|
//
|
|
|
// }
|
|
|
// String sql = "select "+resultSql+" from dm_hospital where level=2 "+whereSql ;
|
|
|
// List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
|
|
|
// temp = "";
|
|
|
// for(Map<String, Object> one :returnList){
|
|
|
// temp +=","+one.get("name");
|
|
|
// }
|
|
|
// sendName = StringUtils.isEmpty(temp)?"":temp.substring(1);
|
|
|
// }
|
|
|
// List<RoleVo> roleVoLists= new ArrayList<>();
|
|
|
// for(String one:roleList){
|
|
|
// RoleVo roleVo = new RoleVo();
|
|
|
// roleVo.setCode(one);
|
|
|
// roleVoLists.add(roleVo);
|
|
|
// }
|
|
|
// healthEduArticlePatient.setRoleList(roleVoLists);
|
|
|
// healthEduArticlePatient.setDoctorCode(sendCode);
|
|
|
// healthEduArticlePatient.setSendName(sendName);
|
|
|
// healthEduArticlePatient.setSendType(2);
|
|
|
// 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);
|
|
|
//
|
|
|
// //保存到ES中
|
|
|
// elastricSearchSave.save(healthEduArticlePatient, esIndex, esType);
|
|
|
// return healthEduArticlePatient;
|
|
|
// }
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 保存PC端发送信息
|
|
@ -461,83 +347,6 @@ 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);
|
|
@ -551,21 +360,6 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
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 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)){
|
|
@ -654,7 +448,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
e.setPatientCode(null);
|
|
|
e.setPatientName(null);
|
|
|
elastricSearchSave.save(e, esIndex, esType);
|
|
|
|
|
|
thirdJkEduArticleService.saveBehavior(articleId,doctor.getCode(),7,patientSet.size());
|
|
|
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 {
|
|
@ -680,61 +474,12 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
*/
|
|
|
public void initPatient(Set<String> patientSet, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode,String currentUserRole, String currentUserRoleLevel) {
|
|
|
//全选的时候前端传0,后台要去数据库再查询一次
|
|
|
// if ("0".equals(labelUnit)) {
|
|
|
// //查找全部的下属单位
|
|
|
//// String sql = "select Group_concat(code) code from dm_hospital where level=2 and town = '350211'";
|
|
|
//// labelUnit = jdbcTemplate.queryForObject(sql, String.class);
|
|
|
// List<DictModel> dictModels = labelService.getUnitLabels(userCode);
|
|
|
// labelUnit ="";
|
|
|
// for(DictModel one:dictModels){
|
|
|
// labelUnit+=","+one.getCode();
|
|
|
// }
|
|
|
//
|
|
|
// labelUnit=labelUnit.substring(1);
|
|
|
// }
|
|
|
// if ("0".equals(labelSex)) {
|
|
|
// //查找全部的性别
|
|
|
// labelSex = "1,2";
|
|
|
// }
|
|
|
// if ("0".equals(labelServe)) {
|
|
|
// //查找全部的服务类型
|
|
|
// String sql = "select Group_concat(s.code) from wlyy_sign_dict s where s.year='2017' order by s.sort asc";
|
|
|
// labelServe = jdbcTemplate.queryForObject(sql, String.class);
|
|
|
// }
|
|
|
// if ("0".equals(labelDisease)) {
|
|
|
// //查找全部的疾病标签
|
|
|
// String sql = "select Group_concat(s.label_code) from wlyy_sign_patient_label s where s.label_type=3 and status=1";
|
|
|
// labelDisease = jdbcTemplate.queryForObject(sql, String.class);
|
|
|
// }
|
|
|
// if ("0".equals(labelHealth)) {
|
|
|
// //查找全部的健康情况
|
|
|
// String sql = "select Group_concat(s.label_code) from wlyy_sign_patient_label s where s.label_type=2 and status=1";
|
|
|
// labelHealth = jdbcTemplate.queryForObject(sql, String.class);
|
|
|
// }
|
|
|
|
|
|
String tableSql = " select p.code from wlyy_sign_family w left join dm_hospital h on w.hospital=h.code ";
|
|
|
String whereSql = " where w.status>0 ";
|
|
|
|
|
|
//通过登录的角色区域权限 限制所属患者条件
|
|
|
|
|
|
// Map<String,Object> resultLevel = labelService.fetchUserHighestAuthority(userCode);
|
|
|
// List<String> list = (List<String>)resultLevel.get("roleList");
|
|
|
// Integer level = (Integer)resultLevel.get("level");
|
|
|
// StringBuilder role = new StringBuilder();
|
|
|
// for(String one :list){
|
|
|
// role.append(",'"+one+"'");
|
|
|
// }
|
|
|
// String roleSql = !StringUtils.isEmpty(role+"")?role.substring(1):"";
|
|
|
// if(StringUtils.isEmpty(roleSql)){
|
|
|
//
|
|
|
// switch (level){
|
|
|
// case 1:{whereSql+=" and h.province in ("+role+")" ;break;}
|
|
|
// case 2:{whereSql+=" and h.city in ("+role+")" ;break;}
|
|
|
// case 3:{whereSql+=" and h.town in ("+role+")" ;break;}
|
|
|
// case 4:{whereSql+=" and h.code in ("+role+")" ;break;}
|
|
|
// }
|
|
|
//
|
|
|
// }
|
|
|
if(!StringUtils.isEmpty(labelUnit)){
|
|
|
switch (currentUserRoleLevel){
|
|
|
case "1":{whereSql+=" and h.city in ("+labelUnit+")" ;break;}
|
|
@ -758,31 +503,21 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
if (!StringUtils.isEmpty(labelHealth) || !StringUtils.isEmpty(labelDisease)) {
|
|
|
tableSql += " left join wlyy_sign_patient_label_info l on w.patient=l.patient ";
|
|
|
whereSql += " and l.status=1 ";
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(labelHealth) && !StringUtils.isEmpty(labelDisease)) {
|
|
|
whereSql += " and ( (l.label_type = 2 AND l.label in (" + labelHealth + ") ) or (l.label_type = 3 AND l.label in (" + labelDisease + ") ))";
|
|
|
}else {
|
|
|
if(!StringUtils.isEmpty(labelHealth)){
|
|
|
whereSql += " and (l.label_type = 2 AND l.label in (" + labelHealth + "))";
|
|
|
}
|
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(labelDisease)){
|
|
|
whereSql += " and (l.label_type = 3 AND l.label in (" + labelDisease + "))";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// if (!StringUtils.isEmpty(labelDisease)) {
|
|
|
// if (!whereSql.endsWith(" and ( ")) {
|
|
|
// whereSql += " or (l.label_type = 3 AND l.label in (" + labelDisease + "))) ";
|
|
|
// } else {
|
|
|
// whereSql += " l.label_type = 3 AND l.label in (" + labelDisease + ")) ";
|
|
|
// }
|
|
|
// }
|
|
|
// if (!StringUtils.isEmpty(labelHealth) || !StringUtils.isEmpty(labelDisease)) {
|
|
|
// whereSql += ")";
|
|
|
// }
|
|
|
|
|
|
|
|
|
tableSql += " left join wlyy_patient p on p.code=w.patient AND p.openid IS NOT NULL and p.openid <>''";
|
|
|
if (!StringUtils.isEmpty(labelSex)) {
|
|
|
whereSql += " and p.sex in (" + labelSex + ") ";
|
|
@ -960,112 +695,10 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
// /**
|
|
|
// * 医生推送文章初始化被推患者信息
|
|
|
// * @param patientSet
|
|
|
// * @param labelType
|
|
|
// * @param condition
|
|
|
// * @param groupType
|
|
|
// * @param teamId
|
|
|
// * @param doctorCode
|
|
|
// */
|
|
|
// public void initPatients(Set<String> patientSet, String labelType, String condition, String groupType,Long teamId,String doctorCode) {
|
|
|
//
|
|
|
// String adminTeamCodetemp = "";
|
|
|
// if(teamId!=null){
|
|
|
// adminTeamCodetemp+=teamId.longValue();
|
|
|
// }else{
|
|
|
// List<AdminTeam> teamList = teamService.getDoctorTeams(doctorCode);
|
|
|
// for(AdminTeam one:teamList){
|
|
|
// adminTeamCodetemp+=","+one.getId();
|
|
|
// }
|
|
|
// adminTeamCodetemp=adminTeamCodetemp.length()>0?adminTeamCodetemp.substring(1):"";
|
|
|
// }
|
|
|
//
|
|
|
// String[] cond = {};
|
|
|
// String[] group = {};
|
|
|
// if (!StringUtils.isEmpty(condition)) {
|
|
|
// cond = condition.split(",");
|
|
|
// }
|
|
|
// StringBuilder whereSql = new StringBuilder();
|
|
|
// String tableSql = "";
|
|
|
// for (String one : cond) {
|
|
|
// if ("1".equals(one)) {//有绑定设备
|
|
|
// tableSql = " LEFT JOIN wlyy_patient_device d on d.user=aa.patient and d.device_id is not null ";
|
|
|
// } else if ("2".equals(one)) {//孕产妇
|
|
|
// whereSql.append(" and tt LIKE '%41%' ");
|
|
|
// } else if ("3".equals(one)) {//65岁以上老年人
|
|
|
// whereSql.append(" and tt LIKE '%13%' ");
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
// if (!StringUtils.isEmpty(groupType)) {
|
|
|
// group = groupType.split(",");
|
|
|
// }
|
|
|
// String sql = "";
|
|
|
// List<String> groupPatient = null;
|
|
|
// List<String> resultList = new ArrayList<>();
|
|
|
// switch (labelType) {
|
|
|
// case "1": {
|
|
|
// for (String one : group) {
|
|
|
// sql = " SELECT DISTINCT(aa.patient) FROM " +
|
|
|
// " ( SELECT a.patient, GROUP_CONCAT( concat(a.label_type, a.label) ) tt " +
|
|
|
// " FROM ( SELECT l.* FROM wlyy_sign_family w, wlyy_sign_patient_label_info l, " +
|
|
|
// " wlyy_sign_family_server q WHERE w. STATUS > 0 AND l. STATUS = 1 AND w.admin_team_code in (" +adminTeamCodetemp+")"+
|
|
|
// " AND w.patient = l.patient " +//AND LEFT (w.hospital, 6) = '350211' " +
|
|
|
// " AND w. CODE = q.sign_code AND q.server_type = 1 ) a " +
|
|
|
// " GROUP BY a.patient HAVING 1 = 1 " + whereSql + " and tt LIKE '%" + labelType + one + "%' ) aa " + tableSql;
|
|
|
// groupPatient = jdbcTemplate.queryForList(sql, String.class);
|
|
|
// resultList.addAll(groupPatient);
|
|
|
// }
|
|
|
// break;
|
|
|
// }
|
|
|
// case "2": {
|
|
|
// for (String one : group) {
|
|
|
// sql = " select DISTINCT(aa.patient) from ( " +
|
|
|
// " SELECT a.patient, GROUP_CONCAT( concat(a.label_type, a.label) ) tt " +
|
|
|
// " FROM ( SELECT l.* FROM wlyy_sign_family w, wlyy_sign_patient_label_info l " +
|
|
|
// " WHERE w. STATUS > 0 and l.status=1 AND w.admin_team_code in ("+adminTeamCodetemp+") AND w.patient = l.patient ) a " +// AND LEFT (w.hospital, 6) = '350211' ) a " +
|
|
|
// " GROUP BY a.patient HAVING 1=1 " + whereSql + " and tt LIKE '%" + labelType + one + "%' ) aa " + tableSql;
|
|
|
// groupPatient = jdbcTemplate.queryForList(sql, String.class);
|
|
|
// resultList.addAll(groupPatient);
|
|
|
//// }
|
|
|
// }
|
|
|
// break;
|
|
|
// }
|
|
|
// case "3": {
|
|
|
// for (String one : group) {
|
|
|
// sql = " select DISTINCT(aa.patient) from ( " +
|
|
|
// " SELECT a.patient, GROUP_CONCAT( concat(a.label_type, a.label) ) tt " +
|
|
|
// " FROM ( SELECT l.* FROM wlyy_sign_family w, wlyy_sign_patient_label_info l " +
|
|
|
// " WHERE w. STATUS > 0 and l.status=1 AND w.admin_team_code in ("+adminTeamCodetemp+") AND w.patient = l.patient ) a " +// AND LEFT (w.hospital, 6) = '350211' ) a " +
|
|
|
// " GROUP BY a.patient HAVING 1=1 " + whereSql + " and tt LIKE '%" + labelType + one + "%') aa " + tableSql;
|
|
|
// groupPatient = jdbcTemplate.queryForList(sql, String.class);
|
|
|
// resultList.addAll(groupPatient);
|
|
|
//// }
|
|
|
// }
|
|
|
// break;
|
|
|
// }
|
|
|
// case "4": {
|
|
|
// for (String one : group) {
|
|
|
// sql = " select DISTINCT(aa.patient) from ( " +
|
|
|
// " SELECT a.patient, GROUP_CONCAT( concat(a.label_type, a.label) ) tt " +
|
|
|
// " FROM ( SELECT l.* FROM wlyy_sign_family w, wlyy_sign_patient_label_info l " +
|
|
|
// " WHERE w. STATUS > 0 and l.status=1 AND w.admin_team_code in ("+adminTeamCodetemp+") AND w.patient = l.patient ) a " +// AND LEFT (w.hospital, 6) = '350211' ) a " +
|
|
|
// " GROUP BY a.patient HAVING 1=1 " + whereSql.toString() + " and tt LIKE '%" + labelType + one + "%') aa " + tableSql;
|
|
|
// groupPatient = jdbcTemplate.queryForList(sql, String.class);
|
|
|
// resultList.addAll(groupPatient);
|
|
|
//// }
|
|
|
// }
|
|
|
// break;
|
|
|
// }
|
|
|
// }
|
|
|
// patientSet.addAll(resultList);
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void readAllArticle(String patient)throws Exception{
|
|
|
|
|
|
|
|
|
// JestClient jestClient = null;
|
|
|
//
|
|
|
// try {
|
|
@ -1107,16 +740,16 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
// for (HealthEduArticlePatient healthEduArticlePatient: esList) {
|
|
|
// healthEduArticlePatient.setIsread("1");
|
|
|
// }
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 一键修改居民推送文章的文章为已读
|
|
|
* @param patient
|
|
|
*/
|
|
|
public void readAllArticleNew(String patient,String firstLevelCategoryId){
|
|
|
JestClient jestClient = null;
|
|
|
|
|
|
|
|
|
try {
|
|
|
jestClient = elasticFactory.getJestClient();
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
@ -1124,7 +757,8 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
new BoolQueryBuilder()
|
|
|
.must(QueryBuilders.matchQuery("patientCode", patient))
|
|
|
.must(QueryBuilders.matchQuery("firstLevelCategoryId", firstLevelCategoryId))
|
|
|
);
|
|
|
.must(QueryBuilders.matchQuery("isRead", "0"))
|
|
|
).size(10000);
|
|
|
Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType).build();
|
|
|
SearchResult result = jestClient.execute(search);
|
|
|
List<HealthEduArticleES> dataList = result.getSourceAsObjectList(HealthEduArticleES.class);
|
|
@ -1151,7 +785,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 居民单条文章增加已读状态
|
|
|
* @param patient
|
|
@ -1159,7 +793,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
*/
|
|
|
public void readPatientArticle(String patient,String articleId){
|
|
|
JestClient jestClient = null;
|
|
|
|
|
|
|
|
|
try {
|
|
|
jestClient = elasticFactory.getJestClient();
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
@ -1194,14 +828,14 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public JSONArray pushArticleLogs(int page, int pagesize, String patientCode,String level1Type) throws Exception {
|
|
|
|
|
|
page = (page - 1) * pagesize;
|
|
|
|
|
|
String sql = "SELECT * FROM " + esType + " where patientCode= '" + patientCode + "' and userType = 1";
|
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(level1Type)){
|
|
|
sql= sql + " and firstLevelCategoryId = '"+level1Type+"' ";
|
|
|
}
|
|
@ -1209,7 +843,7 @@ public class JMJkEduArticleService extends BaseService {
|
|
|
if(pagesize !=0){
|
|
|
sql= sql+ " limit " + page + "," + pagesize;
|
|
|
}
|
|
|
|
|
|
|
|
|
List<HealthEduArticleES> esList = elasticsearchUtil.excute(sql, HealthEduArticleES.class, esIndex, esType);
|
|
|
HealthEduArticlePatientModel heapm = null;
|
|
|
JSONObject article = null;
|