Prechádzať zdrojové kódy

集美宣教代码提交

liuwenbin 7 rokov pred
rodič
commit
53c90ee2c1

+ 52 - 39
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -31,6 +31,7 @@ import io.searchbox.core.*;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.annotation.Transient;
@ -57,9 +58,7 @@ public class JMJkEduArticleService extends BaseService {
    private String esIndex;
    @Autowired
    private AdminTeamService adminTeamService;
    @Autowired
    private DoctorRoleDao doctorRoleDao;
    
    @Autowired
    private ElasticFactory elasticFactory;
    @Autowired
@ -84,6 +83,8 @@ public class JMJkEduArticleService extends BaseService {
    private SignPatientLabelInfoService signPatientLabelInfoService;
    @Autowired
    private DoctorInfoService doctorInfoService;
    @Autowired
    private DoctorRoleDao doctorRoleDao;
    /**
     *
@ -98,8 +99,8 @@ public class JMJkEduArticleService extends BaseService {
     */
    public List<HealthEduArticlePatientModel> pushArticleList(int page, int pagesize, String sendCode,  String firstLevelCategoryId,String secondLevelCategoryId,Integer myArticle,Integer sendType,String currentUserRole,
                                                              String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
        pagesize = page * pagesize;
        page = (page - 1) * pagesize;
//        pagesize = page * pagesize;
//        page = (page - 1) ;
//        if(loginType==2){
//
//            String sql = "select r.code as roleCode from wlyy_user_role u " +
@ -142,16 +143,19 @@ public class JMJkEduArticleService extends BaseService {
        HealthEduArticlePatientModel heapm = null;
        JSONObject article = null;
        Doctor doctor = null;
    
        List<HealthEduArticlePatientModel> resultList = new ArrayList<>();
        
        StringBuffer sql3 = null;
        for (HealthEduArticleES one : esList) {
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
//            if (result.get(one.getArticleId()) != null) {
//                heapm = result.get(one.getArticleId());
//
//            } else {
                heapm = new HealthEduArticlePatientModel();
            heapm = new HealthEduArticlePatientModel();
//            }
            heapm.setSendName(one.getSendName());
            heapm.setSendCode(one.getDoctorCode());
@ -167,6 +171,15 @@ public class JMJkEduArticleService extends BaseService {
            heapm.setLevel2TypeName(one.getSecondLevelCategoryName());
            heapm.setLevel(article.getString("articlelevel"));
//            heapm.setAllCount(heapm.getAllCount() + one.getPatients().size());
            sql3 = new StringBuffer();
            sql3.append("SELECT COUNT(*) as num FROM "+esType+" WHERE isRead='1' AND batchNo = '"+one.getBatchNo()+"' AND patientCode is not null AND articleId='"+article.getString("articleId")+"'");
            Long num = elasticsearchUtil.excuteForLong(sql3.toString(), esType, esIndex);
            if(num!=null){
                heapm.setReadNumber(num.longValue());
            }else{
                heapm.setReadNumber(0L);
            }
            if(!StringUtils.isEmpty(article.getString("browseNumber"))){
                heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
            }else{
@ -177,7 +190,7 @@ public class JMJkEduArticleService extends BaseService {
            }else{
                heapm.setCommentNumber(0);//文章评论数
            }
            
            if(!StringUtils.isEmpty(article.getString("pointNumber"))){
                heapm.setPointNumber(Integer.valueOf(article.getString("pointNumber")));//文章点赞数
            }else{
@ -189,7 +202,7 @@ public class JMJkEduArticleService extends BaseService {
            }else{
                heapm.setCollectionNumber(0);//文章点赞数
            }
            
            heapm.setArticleCover(article.getString("articleCover"));//封面
            if(article.getString("insertTime")!=null){
                heapm.setComputeTime(computeTime(article.getString("insertTime")));
@ -216,7 +229,7 @@ public class JMJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public List<HealthEduArticleES> pushArticleListCount(String sendCode,  String firstLevelCategoryId,String secondLevelCategoryId,Integer myArticle,Integer sendType,String currentUserRole,
                                                              String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
                                                         String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
        StringBuffer sql2 = new StringBuffer("select * from   " + esType +
                " where  doctorCode='" + sendCode + "' and userType = 2" );
@ -436,15 +449,15 @@ public class JMJkEduArticleService extends BaseService {
     */
    @Transactional
    public List<HealthEduArticleES> savePCPushArticle(Set<String> patientSet,
                                                     String sendCode,
                                                      String sendCode,
//                                                  String sendName,
                                                     Integer sendType,
                                                     String sendMessage,
                                                     Long teamId,
                                                     String articleId,
                                                     String leaveWords,
                                                     String currentUserRoleCode,
                                                     String currentUserRoleLevel) throws Exception {
                                                      Integer sendType,
                                                      String sendMessage,
                                                      Long teamId,
                                                      String articleId,
                                                      String leaveWords,
                                                      String currentUserRoleCode,
                                                      String currentUserRoleLevel) throws Exception {
//        String batchNo = UUID.randomUUID().toString();
@ -508,7 +521,6 @@ public class JMJkEduArticleService extends BaseService {
//        healthEduArticlePatient.setBatchNo(batchNo);
//        healthEduArticlePatient.setCreateTime(new Date());
//
//
//        //通过文章id 获取文章详情
//        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
//
@ -634,7 +646,9 @@ public class JMJkEduArticleService extends BaseService {
        //保存到ES中
        elastricSearchSave.save(healthEduArticleESList, esIndex, esType);
        HealthEduArticleES e = healthEduArticleESList.get(0);
        HealthEduArticleES e = new HealthEduArticleES();
        BeanUtils.copyProperties(healthEduArticleESList.get(0),e);
        e.setUserType(2);
        e.setPatientCode(null);
        e.setPatientName(null);
@ -743,14 +757,14 @@ 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 + "))";
                }
@ -767,7 +781,7 @@ public class JMJkEduArticleService extends BaseService {
//        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 + ") ";
@ -1047,10 +1061,10 @@ public class JMJkEduArticleService extends BaseService {
//        }
//        patientSet.addAll(resultList);
//    }
    
    
    public void readAllArticle(String patient)throws Exception{
    
//        JestClient jestClient = null;
//
//        try {
@ -1092,16 +1106,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();
@ -1135,7 +1149,7 @@ public class JMJkEduArticleService extends BaseService {
            }
        }
    }
    
    /**
     * 居民单条文章增加已读状态
     * @param patient
@ -1143,7 +1157,7 @@ public class JMJkEduArticleService extends BaseService {
     */
    public void readPatientArticle(String patient,String articleId){
        JestClient jestClient = null;
        
        try {
            jestClient = elasticFactory.getJestClient();
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -1177,23 +1191,22 @@ 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+"' ";
        }
        sql += " order by createTime desc ";
        if(pagesize !=0){
            sql= sql+  " limit " + page + "," + pagesize;
        }
        
        List<HealthEduArticleES> esList = elasticsearchUtil.excute(sql, HealthEduArticleES.class, esIndex, esType);
        HealthEduArticlePatientModel heapm = null;
        JSONObject article = null;
@ -1291,7 +1304,7 @@ public class JMJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject queryArticlePcList(String firstLevelCategoryId, String secondLevelCategoryId, String insertTimeStart, String insertTimeEnd, String articlelevel, String articleTitle,
                                          String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer sEcho,Integer roleType) throws Exception{
                                         String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer sEcho,Integer roleType) throws Exception{
        return thirdJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,isMyArticle,
                articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize,sEcho,roleType);
    }
@ -1310,7 +1323,7 @@ public class JMJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject queryArticleAPPList(String firstLevelCategoryId, String secondLevelCategoryId, String insertTimeStart, String insertTimeEnd, String articlelevel, String articleTitle,
                                         String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer roleType) throws Exception{
                                          String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer roleType) throws Exception{
        return thirdJkEduArticleService.queryArticleAPPList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,isMyArticle,
                articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize,roleType);
    }
@ -1332,7 +1345,7 @@ public class JMJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject authenArticlePCList(String firstLevelCategoryId, String secondLevelCategoryId, String insertTimeStart, String insertTimeEnd, String articleTitle,
                                         String currentUserRole, String currentUserRoleLevel, String isAuthentication,Integer page, Integer pageSize,Integer sEcho) throws Exception{
                                          String currentUserRole, String currentUserRoleLevel, String isAuthentication,Integer page, Integer pageSize,Integer sEcho) throws Exception{
        return thirdJkEduArticleService.authenArticlePCList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,
                articleTitle,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize,sEcho);
    }

+ 59 - 24
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java

@ -6,10 +6,12 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.profile.DoctorRole;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.organization.HospitalMapping;
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.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
@ -68,7 +70,9 @@ public class ThirdJkEduArticleService extends BaseService {
    private HospitalMappingDao hospitalMappingDao;
    @Autowired
    private DoctorRoleDao doctorRoleDao;
    
    @Autowired
    private HospitalDao hospitalDao;
    //    private String baseUrl = "http://service.yihu.com:8085/WsPlatform/rest";
//    private String baseUrl = "http://172.17.110.230:83/WsPlatform/rest";
//    private String baseUrl = articleBaseUrl+"/WsPlatform/rest";
@ -404,8 +408,8 @@ public class ThirdJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public void saveArticle(String userCode,String articleTitle,String articleType,Integer	articlelevel,String	secondLevelCategoryId,String newUrl,
                                 String	secondLevelCategoryName,String firstLevelCategoryId,String firstLevelCategoryName,String content,
                                 String operatorRoleCode,String opertorRoleLevel,Integer userScope,Integer isAuthentication,String articleId,Integer roleType) throws Exception {
                            String	secondLevelCategoryName,String firstLevelCategoryId,String firstLevelCategoryName,String content,
                            String operatorRoleCode,String opertorRoleLevel,Integer userScope,Integer isAuthentication,String articleId,Integer roleType) throws Exception {
        String response = "";
        JSONObject json = null;
@ -435,29 +439,37 @@ public class ThirdJkEduArticleService extends BaseService {
            param.put("firstLevelCategoryName", firstLevelCategoryName);
            param.put("content", content);
            param.put("newUrl", newUrl);
            Hospital hospital = hospitalDao.findByCode(operatorRoleCode);
            if(hospital!=null&&hospital.getLevel()==3){
                operatorRoleCode = hospital.getTown();
            }
            param.put("operatorRoleCode", operatorRoleCode);
            param.put("opertorRoleLevel", opertorRoleLevel);
            param.put("userScope", userScope);
            param.put("roleType", roleType);
            param.put("isAuthentication", isAuthentication);
//            if(isAuthentication==1){
                String operatorRoleCodeName = "";//认证机构的名称
                List<DoctorRole> roleList = doctorRoleDao.findUserRole(userCode);
                if(roleList.isEmpty()){
                    operatorRoleCodeName = doctor.getHospitalName();
                }else{
                    HashMap<String,String> rolemap = new HashMap<>();
                    for (DoctorRole doctorRole:roleList) {
                        rolemap.put(doctorRole.getCode(),doctorRole.getName());
                    }
                    if(rolemap.keySet().contains(operatorRoleCode)){
                        operatorRoleCodeName =  rolemap.get(operatorRoleCode);
            String operatorRoleCodeName = "";//认证机构的名称
            List<DoctorRole> roleList = doctorRoleDao.findUserRole(userCode);
            if(roleList.isEmpty()){
                operatorRoleCodeName = doctor.getHospitalName();
            }else{
                HashMap<String,String> rolemap = new HashMap<>();
                for (DoctorRole doctorRole:roleList) {
                    rolemap.put(doctorRole.getCode(),doctorRole.getName());
                }
                if(rolemap.keySet().contains(operatorRoleCode)){
                    if(operatorRoleCode.length()==6&&!operatorRoleCode.endsWith("00")){
                        operatorRoleCodeName =  rolemap.get(operatorRoleCode)+"卫生和计划生育局";
                    }else{
                        operatorRoleCodeName = doctor.getHospitalName();
                        operatorRoleCodeName =  rolemap.get(operatorRoleCode);
                    }
                }else{
                    operatorRoleCodeName = doctor.getHospitalName();
                }
                param.put("authentication", operatorRoleCodeName);
                param.put("authenticationId", userCode);
            }
            param.put("authentication", operatorRoleCodeName);
            param.put("authenticationId", userCode);
//            }
            response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(saveArticle, param.toString(), "1"));
            json = JSON.parseObject(response);
@ -487,7 +499,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject queryArticlePcList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,String articlelevel,Boolean isMyArticle,
                                        String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer sEcho,Integer roleType) throws Exception {
                                         String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer sEcho,Integer roleType) throws Exception {
        String response = "";
        JSONObject json = null;
@ -501,6 +513,11 @@ public class ThirdJkEduArticleService extends BaseService {
            param.put("articleTitle", articleTitle);
            param.put("userCode", userCode);
            param.put("isAuthentication", isAuthentication);
            Hospital hospital = hospitalDao.findByCode(currentUserRole);
            if(hospital!=null&&hospital.getLevel()==3){
                currentUserRole = hospital.getTown();
            }
            param.put("currentUserRole", currentUserRole);
            param.put("currentUserRoleLevel", currentUserRoleLevel);
            param.put("page", page+"");
@ -536,7 +553,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject queryArticleAPPList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,String articlelevel,Boolean isMyArticle,
                                         String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer roleType) throws Exception {
                                          String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer roleType) throws Exception {
        String response = "";
        JSONObject json = null;
@ -550,6 +567,11 @@ public class ThirdJkEduArticleService extends BaseService {
            param.put("articleTitle", articleTitle);
            param.put("userCode", userCode);
            param.put("isAuthentication", isAuthentication);
            Hospital hospital = hospitalDao.findByCode(currentUserRole);
            if(hospital!=null&&hospital.getLevel()==3){
                currentUserRole = hospital.getTown();
            }
            param.put("currentUserRole", currentUserRole);
            param.put("currentUserRoleLevel", currentUserRoleLevel);
            param.put("page", page+"");
@ -585,7 +607,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject authenArticlePCList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,
                                         String articleTitle,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer sEcho) throws Exception {
                                          String articleTitle,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer sEcho) throws Exception {
        String response = "";
        JSONObject json = null;
@ -597,6 +619,10 @@ public class ThirdJkEduArticleService extends BaseService {
            param.put("insertTimeEnd", insertTimeEnd);
            param.put("articleTitle", articleTitle);
            param.put("isAuthentication", isAuthentication);
            Hospital hospital = hospitalDao.findByCode(currentUserRole);
            if(hospital!=null&&hospital.getLevel()==3){
                currentUserRole = hospital.getTown();
            }
            param.put("currentUserRole", currentUserRole);
            param.put("currentUserRoleLevel", currentUserRoleLevel);
            param.put("page", page+"");
@ -852,7 +878,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public void updateArticleQRCode(String currentRoleLevel,String currentRoleCode,String imgUrl,Integer position,String userId,String userName,
                                          String orgId,String orgName,Integer id,String identification) throws Exception {
                                    String orgId,String orgName,Integer id,String identification) throws Exception {
        JSONObject json = null;
        try{
@ -879,7 +905,7 @@ public class ThirdJkEduArticleService extends BaseService {
    }
    public void saveArticleQRCode(String currentRoleLevel,String currentRoleCode,String imgUrl,Integer position,String userId,String userName,
                                          String orgId,String orgName,String identification) throws Exception {
                                  String orgId,String orgName,String identification) throws Exception {
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
@ -923,14 +949,23 @@ public class ThirdJkEduArticleService extends BaseService {
    /**************************************************** behaver *******************************************************/
    public void saveBehavior(String articleId,String cName,String userId) throws Exception {
    public void saveBehavior(String articleId,String userId,Integer behaviorAction,Integer number) throws Exception {
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("articleId",articleId);// 文章ID
            Patient patient = patientDao.findByCode(userId);
            Doctor doctor = doctorDao.findByCode(userId);
            String cName = "";
            if(patient!=null){
                cName = patient.getName();
            }else if(doctor!=null){
                cName = doctor.getName();
            }
            param.put("cName",cName);//用户名称
            param.put("userId",userId);//用户ID
            param.put("behaviorAction",behaviorAction);//用户
            param.put("number",number);//用户
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(saveBehavior, param.toString(), "1"));
            json = JSON.parseObject(response);
        }catch (Exception e) {

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java

@ -113,7 +113,7 @@ public class ElasticsearchUtil {
                            if (heads.get(i).contains("date_histogram")) {
                                key = "setQuotaDate";
                            }
                            
                            try {
                                //yyyy-MM-dd'T'HH:mm:ssXX
                                value = dateFormat.parse(String.valueOf(one.get(i)));
@ -127,12 +127,12 @@ public class ElasticsearchUtil {
                                        Date date = new Date();
                                        date = ts;
                                        value =date;
                                    
                                    } catch (Exception e2) {
                                        value = String.valueOf(one.get(i));
                                    }
                                }
                                
                            }
//                            value = DateUtil.strToDate(String.valueOf(value).replace("T00:00:00+0800", " 00:00:00"), "yyyy-MM-dd HH:mm:ss");
                        }
@ -184,7 +184,7 @@ public class ElasticsearchUtil {
            }
            SearchResponse response = (SearchResponse) requestBuilder.get();
            ObjectResult temp = new ObjectResultsExtractor(true, true, true).extractResults(response.getAggregations(), true);
            Long Longvalue = ((Double) temp.getLines().get(0).get(1)).longValue();
            Long Longvalue = ((Double) temp.getLines().get(0).get(0)).longValue();
            return Longvalue;
        } catch (Exception e) {
            logger.error(e.getMessage());

+ 13 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java

@ -2,6 +2,8 @@ package com.yihu.wlyy.web;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.util.DateUtil;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
@ -32,6 +34,8 @@ public class BaseController {
    @Autowired
    protected HttpServletRequest request;
    @Autowired
    private HospitalDao hospitalDao;
    /**
     * 獲取髮送請求用戶的uid
@ -191,7 +195,15 @@ public class BaseController {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getJSONObject("currentUserRole").getString("code");
            String currentUserRole = json.getJSONObject("currentUserRole").getString("code");
            if(StringUtils.isNotEmpty(currentUserRole)){
                Hospital hospital = hospitalDao.findByCode(currentUserRole);
                if(hospital!=null&&hospital.getLevel()==3){
                    return hospital.getTown();
                }
            }
            return currentUserRole;
        } catch (Exception e) {
            return null;
        }

+ 55 - 43
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.util.ElasticsearchUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import io.swagger.annotations.Api;
@ -32,6 +33,12 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    String fastdfs_file_url;
    @Value("${neiwang.enable}")
    private Boolean isneiwang = false;  //如果不是内网项目要转到到内网wlyy在上传
    @Value("${es.type.HealthEduArticlePatient}")
    private String esType;
    @Value("${es.index.HealthEduArticlePatient}")
    private String esIndex;
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    @RequestMapping(value = "saveArticle", method = RequestMethod.POST)
    @ApiOperation("添加、编辑文章")
@ -130,18 +137,19 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
            JSONObject response = jmJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,articleTitle,
                    getUID(),currentUserRole,currentUserRoleLevel,isAuthentication,isMyArticle,page,pageSize,sEcho,roleType);
            
            
            //判断文章列表是否有推送过该居民
            if(StringUtils.isNotBlank(patient)){
                com.alibaba.fastjson.JSONArray pushresponse = jmJkEduArticleService.pushArticleLogs(0,0,patient,"");
                Set<String> articleids = new HashSet<>();
                if(pushresponse.size() > 0){
                if(pushresponse.size() > 0)
                {
                    for (int i = 0; i < pushresponse.size(); i++) {
                        articleids.add(pushresponse.getJSONObject(i).getString("articleId"));
                    }
                }
                
                StringBuffer sql3 = null;
                JSONArray datas = response.getJSONArray("aaData");
                if(datas.size() > 0 && !articleids.isEmpty()){
                    for (int i = 0; i < datas.size(); i++) {
@ -151,6 +159,10 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                        }else{
                            datas.getJSONObject(i).put("ispush","0");
                        }
//                        sql3 = new StringBuffer();
//                        sql3.append("SELECT COUNT(*) as num FROM "+esType+" WHERE  userType=2 AND articleId='"+dataarticleid+"'");
//                        Long num = elasticsearchUtil.excuteForLong(sql3.toString(), esType, esIndex);
//                        datas.getJSONObject(i).put("ispush","0");
                    }
                    response.put("aaData",datas);
                }
@ -166,23 +178,23 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    @RequestMapping(value = "authenArticlePCList", method = RequestMethod.GET)
    @ApiOperation("查询pc端文章认证列表")
    public  String authenArticlePCList(@ApiParam(name = "firstLevelCategoryId", value = "文章一级分类")
                                      @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                      @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                      @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                      @ApiParam(name = "insertTimeStart", value = "新增文章开始时间")
                                      @RequestParam(value = "insertTimeStart", required = false) String insertTimeStart,
                                      @ApiParam(name = "insertTimeEnd", value = "新增文章结束时间")
                                      @RequestParam(value = "insertTimeEnd", required = false) String insertTimeEnd,
                                      @ApiParam(name = "articleTitle", value = "文章标题关键字")
                                      @RequestParam(value = "articleTitle", required = false) String articleTitle,
                                      @ApiParam(name = "isAuthentication", value = "是否认证")
                                      @RequestParam(value = "isAuthentication", required = false) String isAuthentication,
                                      @ApiParam(name = "iDisplayStart", value = "当前页")
                                      @RequestParam(value = "iDisplayStart", required = true) Integer page,
                                      @ApiParam(name = "iDisplayLength", value = "是否过滤我的文章")
                                      @RequestParam(value = "iDisplayLength", required = true) Integer pageSize,
                                      @ApiParam(name = "sEcho", value = "插件自带")
                                      @RequestParam(value = "sEcho", required = false) Integer sEcho){
                                       @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                       @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                       @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                       @ApiParam(name = "insertTimeStart", value = "新增文章开始时间")
                                       @RequestParam(value = "insertTimeStart", required = false) String insertTimeStart,
                                       @ApiParam(name = "insertTimeEnd", value = "新增文章结束时间")
                                       @RequestParam(value = "insertTimeEnd", required = false) String insertTimeEnd,
                                       @ApiParam(name = "articleTitle", value = "文章标题关键字")
                                       @RequestParam(value = "articleTitle", required = false) String articleTitle,
                                       @ApiParam(name = "isAuthentication", value = "是否认证")
                                       @RequestParam(value = "isAuthentication", required = false) String isAuthentication,
                                       @ApiParam(name = "iDisplayStart", value = "当前页")
                                       @RequestParam(value = "iDisplayStart", required = true) Integer page,
                                       @ApiParam(name = "iDisplayLength", value = "是否过滤我的文章")
                                       @RequestParam(value = "iDisplayLength", required = true) Integer pageSize,
                                       @ApiParam(name = "sEcho", value = "插件自带")
                                       @RequestParam(value = "sEcho", required = false) Integer sEcho){
        try {
@ -201,14 +213,14 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    public  String saveOrUpdateArticleQR(
//                                        @ApiParam(name = "currentRoleLevel", value = "当前登录角色的级别")
//                                         @RequestParam(value = "currentRoleLevel", required = true) String currentRoleLevel,
                                         @ApiParam(name = "identification", value = "认证标识文字")
                                         @RequestParam(value = "identification", required = false) String identification,
                                         @ApiParam(name = "position", value = "位置")
                                         @RequestParam(value = "position", required = false) Integer position,
                                         @ApiParam(name = "imgUrl", value = "二维码图片地址")
                                         @RequestParam(value = "imgUrl", required = false) String imgUrl,
                                         @ApiParam(name = "id", value = "认证标识id")
                                         @RequestParam(value = "id", required = false) Integer id){
            @ApiParam(name = "identification", value = "认证标识文字")
            @RequestParam(value = "identification", required = false) String identification,
            @ApiParam(name = "position", value = "位置")
            @RequestParam(value = "position", required = false) Integer position,
            @ApiParam(name = "imgUrl", value = "二维码图片地址")
            @RequestParam(value = "imgUrl", required = false) String imgUrl,
            @ApiParam(name = "id", value = "认证标识id")
            @RequestParam(value = "id", required = false) Integer id){
        try{
            jmJkEduArticleService.saveOrUpdateArticleQR(getCurrentRoleLevel(),getCurrentRoleCode(),position,imgUrl,getUID(),id,identification);
@ -222,17 +234,17 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    @RequestMapping(value = "authenticationArticle", method = RequestMethod.POST)
    @ApiOperation("文章认证")
    public  String authenticationArticle(@ApiParam(name = "articleId", value = "文章id,多个文章‘,’隔开")
                                          @RequestParam(value = "articleId", required = true) String articleId,
                                          @ApiParam(name = "isAuthentication", value = "认证,0取消认证,1认证")
                                          @RequestParam(value = "isAuthentication", required = true) String isAuthentication,
                                          @ApiParam(name = "firstLevelCategoryId", value = "文章一级分类")
                                          @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                          @ApiParam(name = "firstLevelCategoryName", value = "文章一级分类名称")
                                          @RequestParam(value = "firstLevelCategoryName", required = false) String firstLevelCategoryName,
                                          @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                          @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                          @ApiParam(name = "secondLevelCategoryName", value = "文章二级分类名称")
                                          @RequestParam(value = "secondLevelCategoryName", required = false) String secondLevelCategoryName){
                                         @RequestParam(value = "articleId", required = true) String articleId,
                                         @ApiParam(name = "isAuthentication", value = "认证,0取消认证,1认证")
                                         @RequestParam(value = "isAuthentication", required = true) String isAuthentication,
                                         @ApiParam(name = "firstLevelCategoryId", value = "文章一级分类")
                                         @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                         @ApiParam(name = "firstLevelCategoryName", value = "文章一级分类名称")
                                         @RequestParam(value = "firstLevelCategoryName", required = false) String firstLevelCategoryName,
                                         @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                         @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                         @ApiParam(name = "secondLevelCategoryName", value = "文章二级分类名称")
                                         @RequestParam(value = "secondLevelCategoryName", required = false) String secondLevelCategoryName){
        try{
            jmJkEduArticleService.authenticationArticle(articleId,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName);
            return success("认证成功!");
@ -271,9 +283,9 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
            if(StringUtils.isEmpty(currentRoleLevel)){
                currentRoleLevel = getCurrentRoleLevel();
            }
            if(page == 0){
                page ++;
            }
//            if(page == 0){
//                page ++;
//            }
            List<HealthEduArticlePatientModel> eduArticlePatients = jmJkEduArticleService.pushArticleList(page, pagesize, getUID(),firstLevelCategoryId,secondLevelCategoryId,myArticle,sendType,currentRoleCode,currentRoleLevel,articleTitle,sendTimeStart,sendTimeEnd);
//            Long count = jmJkEduArticleService.pushArticleListCount(getUID(),2);
            List<HealthEduArticleES> eduArticlePatientsCount = jmJkEduArticleService.pushArticleListCount( getUID(),firstLevelCategoryId,secondLevelCategoryId,myArticle,sendType,currentRoleCode,

+ 2 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/jimeiJkEdu/PatientJMJkEduArticleController.java

@ -191,10 +191,9 @@ public class PatientJMJkEduArticleController extends BaseController {
    @ApiOperation("添加 浏览、转发、分享、点赞 ")
    public String saveBehavior(
            @ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId,
            @ApiParam(name = "cName", value = "用户名称", required = true) @RequestParam(value = "cName", required = true) String cName,
            @ApiParam(name = "userId", value = "用户ID", required = true) @RequestParam(value = "userId", required = false) String  userId){
            @ApiParam(name = "behaviorAction", value = "1、点赞 2、转发 3、分享 4、浏览 5、评论 6、收藏 7、发送", required = true) @RequestParam(value = "behaviorAction", required = true) Integer behaviorAction){
        try {
            thirdJkEduArticleService.saveBehavior(articleId,cName,userId);
            thirdJkEduArticleService.saveBehavior(articleId,getUID(),behaviorAction,null);
//            Long count = healthEducationArticleService.pushArticleLogsCount("ece5c665b16542b0847e52b4a9fee44a");
            return write(200,"保存成功!");
        }catch (Exception e) {

+ 23 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/HealthEduArticlePatientModel.java

@ -41,6 +41,8 @@ public class HealthEduArticlePatientModel {
    private Integer commentNumber=0;//文章评论数
    @ApiModelProperty(value = "文章点赞数", required = false, access = "response")
    private Integer pointNumber=0;//文章点赞数
    @ApiModelProperty(value = "文章阅读数", required = false, access = "response")
    private Long readNumber=0L;//文章阅读数
    @ApiModelProperty(value = "封面图", required = false, access = "response")
    private String articleCover="";//封面图
    @ApiModelProperty(value = "发送类型", required = false, access = "response")
@ -53,7 +55,7 @@ public class HealthEduArticlePatientModel {
    private Integer collectionNumber;//收藏数
    @ApiModelProperty(value = "文章来源", required = false, access = "response")
    private String articleSource;//文章来源
    
    private String computeTime;//时间
    private String photo;//医生头像
    private String operatorName;//文章作者
@ -201,43 +203,43 @@ public class HealthEduArticlePatientModel {
    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }
    
    public Integer getSendType() {
        return sendType;
    }
    
    public void setSendType(Integer sendType) {
        this.sendType = sendType;
    }
    
    public String getIsread() {
        return isread;
    }
    
    public void setIsread(String isread) {
        this.isread = isread;
    }
    
    public String getLeaveWords() {
        return leaveWords;
    }
    
    public void setLeaveWords(String leaveWords) {
        this.leaveWords = leaveWords;
    }
    
    public String getLevel1TypeName() {
        return level1TypeName;
    }
    
    public void setLevel1TypeName(String level1TypeName) {
        this.level1TypeName = level1TypeName;
    }
    
    public String getLevel2TypeName() {
        return level2TypeName;
    }
    
    public void setLevel2TypeName(String level2TypeName) {
        this.level2TypeName = level2TypeName;
    }
@ -249,12 +251,20 @@ public class HealthEduArticlePatientModel {
    public void setCollectionNumber(Integer collectionNumber) {
        this.collectionNumber = collectionNumber;
    }
    
    public String getArticleSource() {
        return articleSource;
    }
    
    public void setArticleSource(String articleSource) {
        this.articleSource = articleSource;
    }
    public Long getReadNumber() {
        return readNumber;
    }
    public void setReadNumber(Long readNumber) {
        this.readNumber = readNumber;
    }
}

+ 23 - 23
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java

@ -85,7 +85,7 @@ public class ThirdJkEduArticleController extends BaseController {
        try {
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getRepUID(),userType,myArticle);
//            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"812f75071f434fde9a1fb64c6213a897",userType,myArticle);
    
            //判断文章列表是否有推送过该居民
            if(org.apache.commons.lang3.StringUtils.isNotBlank(patient)){
                com.alibaba.fastjson.JSONArray pushresponse = jmJkEduArticleService.pushArticleLogs(0,0,patient,"");
@ -95,7 +95,7 @@ public class ThirdJkEduArticleController extends BaseController {
                        articleids.add(pushresponse.getJSONObject(i).getString("articleId"));
                    }
                }
        
                if(response.size() > 0 && !articleids.isEmpty()){
                    for (int i = 0; i < response.size(); i++) {
                        String dataarticleid = response.getJSONObject(i).getString("articleId");
@ -122,11 +122,11 @@ public class ThirdJkEduArticleController extends BaseController {
                                 @RequestParam(value = "userType", required = false) String userType){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,getUID());
            
            if("2".equals(userType)){
                jmJkEduArticleService.readPatientArticle(getRepUID(),articleId);
            }
            
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -141,7 +141,7 @@ public class ThirdJkEduArticleController extends BaseController {
                                          @RequestParam(value = "articleId", required = true) String articleId,
                                          @ApiParam(name = "userType", value = "用户类型:1医生,2居民",defaultValue = "1")
                                          @RequestParam(value = "userType", required = true) Integer userType
                                          ){
    ){
        try {
            thirdJkEduArticleService.cancelArticleCollection(articleId,getRepUID(),userType);
//            thirdJkEduArticleService.cancelArticleCollection(articleId,"0de7295862dd11e69faffa163e8aee56",1);
@ -162,7 +162,7 @@ public class ThirdJkEduArticleController extends BaseController {
                                        @ApiParam(name = "articleCategoryName", value = "文章类别名称")
                                        @RequestParam(value = "articleCategoryName", required = false) String articleCategoryName,
                                        @ApiParam(name = "userType", value = "用户类型:1医生,2居民",defaultValue = "1")
                                            @RequestParam(value = "userType", required = true) Integer userType){
                                        @RequestParam(value = "userType", required = true) Integer userType){
        try {
            thirdJkEduArticleService.saveArticleCollection(articleId,articleCategoryId,articleCategoryName,getRepUID(),userType);
//            thirdJkEduArticleService.saveArticleCollection(articleId,articleCategoryId,articleCategoryName,"0de7295862dd11e69faffa163e8aee56",1);
@ -237,13 +237,13 @@ public class ThirdJkEduArticleController extends BaseController {
    @RequestMapping(value = "addCategory",method = RequestMethod.POST)
    @ApiOperation("添加二级分类-仅向市级管理员开放编辑权限")
    public String addCategory(@ApiParam(name = "categoryName", value = "文章分类名称")
                                           @RequestParam(value = "categoryName", required = true) String categoryName,
                                           @ApiParam(name = "categoryLevel", value = "分类级别-默认二级")
                                           @RequestParam(value = "categoryLevel", required = true,defaultValue = "2") Integer categoryLevel,
                                           @ApiParam(name = "firstlevelId", value = "一级类别ID")
                                           @RequestParam(value = "firstlevelId", required = true ) String firstlevelId,
                                           @ApiParam(name = "secondLevelId", value = "二级类别ID")
                                           @RequestParam(value = "secondLevelId", required = false ) String secondLevelId
                              @RequestParam(value = "categoryName", required = true) String categoryName,
                              @ApiParam(name = "categoryLevel", value = "分类级别-默认二级")
                              @RequestParam(value = "categoryLevel", required = true,defaultValue = "2") Integer categoryLevel,
                              @ApiParam(name = "firstlevelId", value = "一级类别ID")
                              @RequestParam(value = "firstlevelId", required = true ) String firstlevelId,
                              @ApiParam(name = "secondLevelId", value = "二级类别ID")
                              @RequestParam(value = "secondLevelId", required = false ) String secondLevelId
//                                           @ApiParam(name = "currentRoleCode", value = "当前登录角色")
//                                           @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode
    ){
@ -264,9 +264,9 @@ public class ThirdJkEduArticleController extends BaseController {
    @RequestMapping(value = "checkCategory",method = RequestMethod.POST)
    @ApiOperation("添加二级分类-仅向市级管理员开放编辑权限")
    public String checkCategory(@ApiParam(name = "categoryName", value = "文章分类名称")
                              @RequestParam(value = "categoryName", required = true) String categoryName,
                              @ApiParam(name = "categoryLevel", value = "分类级别-默认二级")
                              @RequestParam(value = "categoryLevel", required = true,defaultValue = "2") Integer categoryLevel){
                                @RequestParam(value = "categoryName", required = true) String categoryName,
                                @ApiParam(name = "categoryLevel", value = "分类级别-默认二级")
                                @RequestParam(value = "categoryLevel", required = true,defaultValue = "2") Integer categoryLevel){
        try {
            thirdJkEduArticleService.checkCategory(categoryName,categoryLevel);
            return success("添加成功!");
@ -279,11 +279,11 @@ public class ThirdJkEduArticleController extends BaseController {
    @RequestMapping(value = "updateCategory",method = RequestMethod.POST)
    @ApiOperation("更新二级分类-仅向市级管理员开放编辑权限")
    public String updateCategory(@ApiParam(name = "categoryId", value = "文章分类code")
                              @RequestParam(value = "categoryId", required = true) String categoryId,
                              @ApiParam(name = "categoryName", value = "文章分类名称")
                              @RequestParam(value = "categoryName", required = true ) String categoryName,
                              @ApiParam(name = "categoryState", value = "类别状态1、正常、2删除")
                              @RequestParam(value = "categoryState", required = false ) Integer categoryState){
                                 @RequestParam(value = "categoryId", required = true) String categoryId,
                                 @ApiParam(name = "categoryName", value = "文章分类名称")
                                 @RequestParam(value = "categoryName", required = true ) String categoryName,
                                 @ApiParam(name = "categoryState", value = "类别状态1、正常、2删除")
                                 @RequestParam(value = "categoryState", required = false ) Integer categoryState){
//                              @ApiParam(name = "currentRoleCode", value = "当前登录角色")
//                              @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode){
@ -312,7 +312,7 @@ public class ThirdJkEduArticleController extends BaseController {
            return error(-1,"查询失败!");
        }
    }
    
    @RequestMapping(value = "getCategoryByName",method = RequestMethod.GET)
    @ApiOperation("根据一级类别名称获取二级分类下得所有分类")
    public String getCategoryList(@ApiParam(name = "name", value = "类别名称")
@ -352,7 +352,7 @@ public class ThirdJkEduArticleController extends BaseController {
    @RequestMapping(value = "getConfigDicShoList",method = RequestMethod.GET)
    @ApiOperation("获取优先级-数据字典")
    public String getConfigDicShoList(@ApiParam(name = "typeName", value = "优先级-字典业务类型")
                                          @RequestParam(value = "typeName", required = true) String typeName){
                                      @RequestParam(value = "typeName", required = true) String typeName){
        try {
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getConfigDicShoList(typeName);
            return write(200,"查询成功!","data",response);