|
@ -11,6 +11,7 @@ import com.yihu.wlyy.service.common.account.PatientService;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.ElasticsearchUtil;
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
import com.yihu.wlyy.web.third.gateway.service.GcLabelService;
|
|
|
import com.yihu.wlyy.web.third.gateway.vo.DictModel;
|
|
|
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
|
|
|
import org.slf4j.Logger;
|
|
@ -52,6 +53,8 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
private PatientService patientService;
|
|
|
@Value("${jkEdu.web.articleBaseUrl}")
|
|
|
private String articleBaseUrl;
|
|
|
@Autowired
|
|
|
private GcLabelService labelService;
|
|
|
|
|
|
// private String baseUrl = "http://service.yihu.com:8085/WsPlatform/rest";
|
|
|
// private String baseUrl = "http://172.17.110.230:83/WsPlatform/rest";
|
|
@ -61,15 +64,28 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
private String clientId;
|
|
|
|
|
|
private String clientVersion = "1.0";
|
|
|
|
|
|
private String getArticalById = "JkEdu.Article.getArticalById";//获取单篇文章详情
|
|
|
private String getDoctorArticalList = "JkEdu.Article.getDoctorArticalList";//获取卫计委认证文章+医生发表未认证文章
|
|
|
/*********************************************** Collection ***************************************/
|
|
|
private String getCollectionArticalList = "JkEdu.Article.getCollectionArticalList";//获取收藏文章列表
|
|
|
private String getCategoryList = "JkEdu.Category.getCategoryList";//获取类别接口
|
|
|
private String cancelArticleCollection = "JkEdu.Behavior.cancelArticleCollection";//取消收藏接口
|
|
|
private String saveArticleCollection = "JkEdu.Behavior.saveArticleCollection";//医生收藏接口
|
|
|
/*********************************************** Article ******************************************/
|
|
|
private String getDoctorArticalByUserId = "JkEdu.Article.getDoctorArticalByUserId";//医生发表文章接口
|
|
|
private String getArticalList = "JkEdu.Article.getArticalList";//获取文章列表 多ID
|
|
|
private String getArticalById = "JkEdu.Article.getArticalById";//获取单篇文章详情
|
|
|
private String getDoctorArticalList = "JkEdu.Article.getDoctorArticalList";//获取卫计委认证文章+医生发表未认证文章
|
|
|
private String saveArticle = "JkEdu.Article.saveArticle";//添加文章
|
|
|
private String queryArticlePcList = "JkEdu.Article.queryArticlePcList";//PC端获取文章列表
|
|
|
private String authenticationArticle = "JkEdu.Article.authenticationArticle";//文章认证
|
|
|
/*********************************************** Category ******************************************/
|
|
|
private String getCategoryList = "JkEdu.Category.getCategoryList";//获取类别接口
|
|
|
private String addCategory = "JkEdu.Category.addCategory";//新增类别接口
|
|
|
private String updateCategory = "JkEdu.Category.updateCategory";//更新类别接口
|
|
|
/*********************************************** ConfigDicSho ***************************************/
|
|
|
private String getConfigDicShoList = "JkEdu.ConfigDicSho.getConfigDicShoList";//更新类别接口
|
|
|
/*********************************************** ArticleQR ***************************************/
|
|
|
private String getArticleQRCode = "JkEdu.ArticleQR.getArticleQRCode";//获取认证标识
|
|
|
private String updateArticleQRCode = "JkEdu.ArticleQR.updateArticleQRCode";//更新认证标识
|
|
|
private String saveArticleQRCode = "JkEdu.ArticleQR.saveArticleQRCode";//添加认证标识
|
|
|
|
|
|
/**
|
|
|
* 封装入参
|
|
@ -97,8 +113,10 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
return params;
|
|
|
}
|
|
|
|
|
|
/*************************************************** Collection ***************************************************/
|
|
|
|
|
|
/**
|
|
|
* 获取文章列表
|
|
|
* 获取收藏文章列表
|
|
|
*
|
|
|
* @param articleTitle 否 文章标题
|
|
|
* @param articleState 否 传1
|
|
@ -106,9 +124,11 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
* @param pageIndex 否 起始页数 0开始,默认0
|
|
|
* @param pageSize 否 每页显示数 ,默认5
|
|
|
* @param userId 是 当前用户ID
|
|
|
* @param userType 是 1 医生 2 居民
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getDoctorArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId, Integer pageIndex, Integer pageSize, String userId) throws Exception {
|
|
|
public JSONArray getCollectionArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId,
|
|
|
Integer pageIndex, Integer pageSize, String userId, Integer userType,Boolean myArticle) throws Exception {
|
|
|
JSONArray re = new JSONArray();
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
@ -119,7 +139,9 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
param.put("pageIndex", pageIndex);
|
|
|
param.put("pageSize", pageSize);
|
|
|
param.put("userId", userId);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getDoctorArticalList, param.toString(), "1"));
|
|
|
param.put("userType", userType);
|
|
|
param.put("myArticle", myArticle);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getCollectionArticalList, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@ -133,38 +155,84 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取文章详情
|
|
|
* 取消收藏文章
|
|
|
*
|
|
|
* @param articleId 文章id
|
|
|
* @param articleId 是 文章id
|
|
|
* @param userId 是 当前用户ID
|
|
|
* @param userType 是 1 医生 2 居民
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject getArticalById(String articleId) throws Exception {
|
|
|
JSONObject re = new JSONObject();
|
|
|
public void cancelArticleCollection(String articleId, String userId, Integer userType) throws Exception {
|
|
|
String response = "";
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("articleId", articleId);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticalById, param.toString(), "1"));
|
|
|
param.put("userId", userId);
|
|
|
param.put("userType", userType);
|
|
|
|
|
|
response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(cancelArticleCollection, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return re;
|
|
|
}
|
|
|
if ("10000".equals(json.getString("Code"))) {
|
|
|
|
|
|
} else {
|
|
|
new Exception(json.getString("Message"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 收藏文章列表
|
|
|
*
|
|
|
* @param articleId 文章id
|
|
|
* @param articleCategoryId 文章类别ID
|
|
|
* @param articleCategoryName 文章类别名称
|
|
|
* @param userId 是 当前用户ID
|
|
|
* @param userType 是 1 医生 2 居民
|
|
|
* @return
|
|
|
*/
|
|
|
public void saveArticleCollection(String articleId, String articleCategoryId, String articleCategoryName, String userId, Integer userType) throws Exception {
|
|
|
String response = "";
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
|
Doctor doctor = doctorDao.findByCode(userId);
|
|
|
String orgName = doctor.getHospitalName();//用户所属机构
|
|
|
String orgId = doctor.getHospital();//用户所属机构ID
|
|
|
String cName = doctor.getName();//用户名
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("articleId", articleId);
|
|
|
param.put("cName", cName);
|
|
|
param.put("articleCategoryId", articleCategoryId);
|
|
|
param.put("articleCategoryName", articleCategoryName);
|
|
|
param.put("orgName", orgName);
|
|
|
param.put("orgId", orgId);
|
|
|
param.put("userId", userId);
|
|
|
param.put("userType", userType);
|
|
|
|
|
|
response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(saveArticleCollection, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if ("10000".equals(json.getString("Code"))) {
|
|
|
JSONArray result = json.getJSONArray("Result");
|
|
|
if (result.size() > 0) {
|
|
|
return result.getJSONObject(0);
|
|
|
}
|
|
|
return re;
|
|
|
|
|
|
} else {
|
|
|
throw new Exception(json.getString("Message"));
|
|
|
new Exception(json.getString("Message"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*************************************************** Article ******************************************************/
|
|
|
|
|
|
/**
|
|
|
* 获取收藏文章列表
|
|
|
* 获取医生文章列表
|
|
|
*
|
|
|
* @param articleTitle 否 文章标题
|
|
|
* @param articleState 否 传1
|
|
@ -172,11 +240,9 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
* @param pageIndex 否 起始页数 0开始,默认0
|
|
|
* @param pageSize 否 每页显示数 ,默认5
|
|
|
* @param userId 是 当前用户ID
|
|
|
* @param userType 是 1 医生 2 居民
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getCollectionArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId,
|
|
|
Integer pageIndex, Integer pageSize, String userId, Integer userType,Boolean myArticle) throws Exception {
|
|
|
public JSONArray getDoctorArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId, Integer pageIndex, Integer pageSize, String userId) throws Exception {
|
|
|
JSONArray re = new JSONArray();
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
@ -187,9 +253,7 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
param.put("pageIndex", pageIndex);
|
|
|
param.put("pageSize", pageSize);
|
|
|
param.put("userId", userId);
|
|
|
param.put("userType", userType);
|
|
|
param.put("myArticle", myArticle);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getCollectionArticalList, param.toString(), "1"));
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getDoctorArticalList, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@ -203,21 +267,54 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public JSONArray getArticalList(String articleId, int articleState, int pageIndex, int pageSize,String firstLevelCategoryId) throws Exception {
|
|
|
JSONArray re = new JSONArray();
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("articleId", articleId);
|
|
|
param.put("articleState", articleState);
|
|
|
param.put("pageIndex", pageIndex);
|
|
|
param.put("pageSize", pageSize);
|
|
|
param.put("firstLevelCategoryId", firstLevelCategoryId);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticalList, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return re;
|
|
|
}
|
|
|
if ("10000".equals(json.getString("Code"))) {
|
|
|
return json.getJSONArray("Result");
|
|
|
} else {
|
|
|
throw new Exception(json.getString("Message"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取文章类别
|
|
|
* 获取医生发表的文章列表
|
|
|
*
|
|
|
* @param categoryLevel 是 获取类别:1、一级类别 2、二级类别
|
|
|
* @param articleTitle 否 文章标题
|
|
|
* @param articleState 否 传1
|
|
|
* @param firstLevelCategoryId 否 一级类别ID ,多个逗号隔开
|
|
|
* @param pageIndex 否 起始页数 0开始,默认0
|
|
|
* @param pageSize 否 每页显示数 ,默认5
|
|
|
* @param userId 是 当前用户ID
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getCategoryList(String categoryLevel,String userId) throws Exception {
|
|
|
public JSONArray getDoctorArticalByUserId(String articleTitle, Integer articleState, String firstLevelCategoryId,
|
|
|
Integer pageIndex, Integer pageSize, String userId) throws Exception {
|
|
|
JSONArray re = new JSONArray();
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("categoryLevel", categoryLevel);
|
|
|
param.put("articleTitle", articleTitle);
|
|
|
param.put("articleState", articleState);
|
|
|
param.put("firstLevelCategoryId", firstLevelCategoryId);
|
|
|
param.put("pageIndex", pageIndex);
|
|
|
param.put("pageSize", pageSize);
|
|
|
param.put("userId", userId);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getCategoryList, param.toString(), "1"));
|
|
|
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getDoctorArticalByUserId, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@ -225,108 +322,195 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
}
|
|
|
|
|
|
if ("10000".equals(json.getString("Code"))) {
|
|
|
return json.getJSONObject("Result").getJSONArray("result");
|
|
|
return json.getJSONArray("Result");
|
|
|
} else {
|
|
|
throw new Exception(json.getString("Message"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取消收藏文章
|
|
|
* 获取文章详情
|
|
|
*
|
|
|
* @param articleId 是 文章id
|
|
|
* @param userId 是 当前用户ID
|
|
|
* @param userType 是 1 医生 2 居民
|
|
|
* @param articleId 文章id
|
|
|
* @return
|
|
|
*/
|
|
|
public void cancelArticleCollection(String articleId, String userId, Integer userType) throws Exception {
|
|
|
String response = "";
|
|
|
public JSONObject getArticalById(String articleId) throws Exception {
|
|
|
JSONObject re = new JSONObject();
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("articleId", articleId);
|
|
|
param.put("userId", userId);
|
|
|
param.put("userType", userType);
|
|
|
|
|
|
response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(cancelArticleCollection, param.toString(), "1"));
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticalById, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return re;
|
|
|
}
|
|
|
if ("10000".equals(json.getString("Code"))) {
|
|
|
|
|
|
if ("10000".equals(json.getString("Code"))) {
|
|
|
JSONArray result = json.getJSONArray("Result");
|
|
|
if (result.size() > 0) {
|
|
|
return result.getJSONObject(0);
|
|
|
}
|
|
|
return re;
|
|
|
} else {
|
|
|
new Exception(json.getString("Message"));
|
|
|
throw new Exception(json.getString("Message"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 收藏文章列表
|
|
|
*
|
|
|
* @param articleId 文章id
|
|
|
* @param articleCategoryId 文章类别ID
|
|
|
* @param articleCategoryName 文章类别名称
|
|
|
* @param userId 是 当前用户ID
|
|
|
* @param userType 是 1 医生 2 居民
|
|
|
* 添加文章
|
|
|
* @param userCode 医生code
|
|
|
* @param articleTitle 标题
|
|
|
* @param articleType 类型
|
|
|
* @param articlelevel 优先级
|
|
|
* @param secondLevelCategoryId 二级分类id
|
|
|
* @param newUrl 封面图片地址
|
|
|
* @param secondLevelCategoryName 二级分类名称
|
|
|
* @param firstLevelCategoryId 一级分类id
|
|
|
* @param firstLevelCategoryName 一级分类名称
|
|
|
* @param content 内容
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void saveArticleCollection(String articleId, String articleCategoryId, String articleCategoryName, String userId, Integer userType) {
|
|
|
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) throws Exception {
|
|
|
|
|
|
String response = "";
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
|
Doctor doctor = doctorDao.findByCode(userId);
|
|
|
String orgName = doctor.getHospitalName();//用户所属机构
|
|
|
String orgId = doctor.getHospital();//用户所属机构ID
|
|
|
String cName = doctor.getName();//用户名
|
|
|
Doctor doctor = doctorDao.findByCode(userCode);
|
|
|
String orgName = doctor.getHospitalName();//组织名称
|
|
|
String deptName = doctor.getDeptName();//科室名称
|
|
|
String levelName = doctor.getJobName();//职称
|
|
|
String photo = doctor.getPhoto();//头像
|
|
|
String orgId = doctor.getHospital();//组织
|
|
|
String userName = doctor.getName();//登录名称
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("articleId", articleId);
|
|
|
param.put("cName", cName);
|
|
|
param.put("articleCategoryId", articleCategoryId);
|
|
|
param.put("articleCategoryName", articleCategoryName);
|
|
|
param.put("userCode", userCode);
|
|
|
param.put("orgName", orgName);
|
|
|
param.put("deptName", deptName);
|
|
|
param.put("levelName", levelName);
|
|
|
param.put("photo", photo);
|
|
|
param.put("orgId", orgId);
|
|
|
param.put("userId", userId);
|
|
|
param.put("userType", userType);
|
|
|
|
|
|
response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(saveArticleCollection, param.toString(), "1"));
|
|
|
param.put("userName", userName);
|
|
|
param.put("articleTitle", articleTitle);
|
|
|
param.put("articleType", articleType);
|
|
|
param.put("articlelevel", articlelevel);
|
|
|
param.put("secondLevelCategoryId", secondLevelCategoryId);
|
|
|
param.put("secondLevelCategoryName", secondLevelCategoryName);
|
|
|
param.put("firstLevelCategoryId", firstLevelCategoryId);
|
|
|
param.put("firstLevelCategoryName", firstLevelCategoryName);
|
|
|
param.put("content", content);
|
|
|
param.put("newUrl", newUrl);
|
|
|
param.put("operatorRoleCode", operatorRoleCode);
|
|
|
param.put("opertorRoleLevel", opertorRoleLevel);
|
|
|
param.put("userScope", userScope);
|
|
|
param.put("isAuthentication", isAuthentication);
|
|
|
if(isAuthentication==1){
|
|
|
param.put("authentication", doctor.getHospital());
|
|
|
param.put("authenticationId", doctor.getHospitalName());
|
|
|
}
|
|
|
response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(saveArticle, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if ("10000".equals(json.getString("Code"))) {
|
|
|
|
|
|
} else {
|
|
|
new Exception(json.getString("Message"));
|
|
|
throw new Exception(json.getString("Message"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取医生发表的文章列表
|
|
|
*
|
|
|
* @param articleTitle 否 文章标题
|
|
|
* @param articleState 否 传1
|
|
|
* @param firstLevelCategoryId 否 一级类别ID ,多个逗号隔开
|
|
|
* @param pageIndex 否 起始页数 0开始,默认0
|
|
|
* @param pageSize 否 每页显示数 ,默认5
|
|
|
* @param userId 是 当前用户ID
|
|
|
* PC端文章列表
|
|
|
* @param firstLevelCategoryId
|
|
|
* @param secondLevelCategoryId
|
|
|
* @param insertTimeStart
|
|
|
* @param insertTimeEnd
|
|
|
* @param articlelevel
|
|
|
* @param articleTitle
|
|
|
* @param userCode
|
|
|
* @param isAuthentication
|
|
|
* @param currentUserRole
|
|
|
* @param currentUserRoleLevel
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getDoctorArticalByUserId(String articleTitle, Integer articleState, String firstLevelCategoryId,
|
|
|
Integer pageIndex, Integer pageSize, String userId) throws Exception {
|
|
|
JSONArray re = new JSONArray();
|
|
|
public JSONArray queryArticlePcList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,String articlelevel,
|
|
|
String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel) throws Exception {
|
|
|
|
|
|
String response = "";
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("firstLevelCategoryId", firstLevelCategoryId);
|
|
|
param.put("secondLevelCategoryId", secondLevelCategoryId);
|
|
|
param.put("insertTimeStart", insertTimeStart);
|
|
|
param.put("insertTimeEnd", insertTimeEnd);
|
|
|
param.put("articlelevel", articlelevel);
|
|
|
param.put("articleTitle", articleTitle);
|
|
|
param.put("articleState", articleState);
|
|
|
param.put("userCode", userCode);
|
|
|
param.put("isAuthentication", isAuthentication);
|
|
|
param.put("currentUserRole", currentUserRole);
|
|
|
param.put("currentUserRoleLevel", currentUserRoleLevel);
|
|
|
response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(queryArticlePcList, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if ("10000".equals(json.getString("Code"))) {
|
|
|
return json.getJSONArray("Result");
|
|
|
} else {
|
|
|
throw new Exception(json.getString("Message"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public void authenticationArticle(String articleId,String isAuthentication,String firstLevelCategoryId,String firstLevelCategoryName,String secondLevelCategoryId,String secondLevelCategoryName) throws Exception{
|
|
|
|
|
|
String response = "";
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("articleId", articleId);
|
|
|
param.put("isAuthentication", isAuthentication);
|
|
|
param.put("firstLevelCategoryId", firstLevelCategoryId);
|
|
|
param.put("pageIndex", pageIndex);
|
|
|
param.put("pageSize", pageSize);
|
|
|
param.put("userId", userId);
|
|
|
param.put("firstLevelCategoryName", firstLevelCategoryName);
|
|
|
param.put("secondLevelCategoryId", secondLevelCategoryId);
|
|
|
param.put("secondLevelCategoryName", secondLevelCategoryName);
|
|
|
response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(authenticationArticle, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (!"10000".equals(json.getString("Code"))) {
|
|
|
throw new Exception(json.getString("Message"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getDoctorArticalByUserId, param.toString(), "1"));
|
|
|
|
|
|
/*************************************************** Category *****************************************************/
|
|
|
|
|
|
/**
|
|
|
* 获取文章类别
|
|
|
*
|
|
|
* @param categoryLevel 是 获取类别:1、一级类别 2、二级类别
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getCategoryList(String categoryLevel) throws Exception {
|
|
|
JSONArray re = new JSONArray();
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("categoryLevel", categoryLevel);
|
|
|
// param.put("userId", userId);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getCategoryList, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@ -334,26 +518,97 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
}
|
|
|
|
|
|
if ("10000".equals(json.getString("Code"))) {
|
|
|
return json.getJSONArray("Result");
|
|
|
return json.getJSONObject("Result").getJSONArray("result");
|
|
|
} else {
|
|
|
throw new Exception(json.getString("Message"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public JSONArray getArticalList(String articleId, int articleState, int pageIndex, int pageSize,String firstLevelCategoryId) throws Exception {
|
|
|
JSONArray re = new JSONArray();
|
|
|
/**
|
|
|
* 添加分类
|
|
|
* @param categoryLevel
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void addCategory(String categoryName,Integer categoryLevel,String firstlevelId,String secondLevelId,String userCode,String currentRoleCode) throws Exception {
|
|
|
JSONObject json = null;
|
|
|
Doctor doctor = doctorDao.findByCode(userCode);
|
|
|
boolean bl = checkEduArticleAhthority(doctor,currentRoleCode);
|
|
|
if(!bl){
|
|
|
new Exception("二级分类仅向市级管理员开放编辑权限!");
|
|
|
}
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("articleId", articleId);
|
|
|
param.put("articleState", articleState);
|
|
|
param.put("pageIndex", pageIndex);
|
|
|
param.put("pageSize", pageSize);
|
|
|
param.put("firstLevelCategoryId", firstLevelCategoryId);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticalList, param.toString(), "1"));
|
|
|
param.put("categoryId", UUID.randomUUID().toString());
|
|
|
param.put("categoryName", categoryName);
|
|
|
param.put("categoryLevel", categoryLevel);
|
|
|
param.put("firstlevelId", firstlevelId);
|
|
|
param.put("secondLevelId", secondLevelId);
|
|
|
param.put("orgName", doctor.getHospital());
|
|
|
param.put("orgId", doctor.getHospitalName());
|
|
|
param.put("operatorName", doctor.getName());
|
|
|
param.put("operatorId", userCode);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(addCategory, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (!"10000".equals(json.getString("Code"))) {
|
|
|
new Exception(json.getString("Message"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新文章分类
|
|
|
* @param categoryId
|
|
|
* @param categoryName
|
|
|
* @param categoryState
|
|
|
* @param userCode
|
|
|
* @param currentRoleCode
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void updateCategory(String categoryId,String categoryName,Integer categoryState,String userCode,String currentRoleCode) throws Exception {
|
|
|
|
|
|
JSONObject json = null;
|
|
|
Doctor doctor = doctorDao.findByCode(userCode);
|
|
|
boolean bl = checkEduArticleAhthority(doctor,currentRoleCode);
|
|
|
if(!bl){
|
|
|
new Exception("二级分类仅向市级管理员开放编辑权限!");
|
|
|
}
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("categoryId",categoryId);
|
|
|
param.put("categoryName", categoryName);
|
|
|
param.put("categoryState", categoryState);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(updateCategory, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (!"10000".equals(json.getString("Code"))) {
|
|
|
new Exception(json.getString("Message"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**************************************************** ConfigDicSho ************************************************/
|
|
|
|
|
|
/**
|
|
|
* 获取优先级
|
|
|
* @param typeName
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getConfigDicShoList(String typeName) throws Exception {
|
|
|
|
|
|
JSONArray re = new JSONArray();
|
|
|
JSONObject json = null;
|
|
|
try {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("typeName",typeName);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getConfigDicShoList, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return re;
|
|
|
}
|
|
|
if ("10000".equals(json.getString("Code"))) {
|
|
@ -363,91 +618,113 @@ public class ThirdJkEduArticleService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// public JSONArray getPatientHealthLogs(int page, int pagesize,String sendCode, String articleType)throws Exception{
|
|
|
//
|
|
|
// pagesize = page * pagesize;
|
|
|
// page = (page - 1) * pagesize;
|
|
|
// StringBuffer sql = new StringBuffer("select *,count(articleId) allCount from " + esType +
|
|
|
// " where sendCode='" + sendCode + "' ");
|
|
|
// if (!StringUtils.isEmpty(articleType)) {
|
|
|
// sql.append(" and articleType='" + articleType + "' ");
|
|
|
// }
|
|
|
// sql.append(" group by articleId order by createTime limit " + page + "," + pagesize);
|
|
|
// List<HealthEduArticlePatient> esList = elasticsearchUtil.excute(sql.toString(), com.yihu.es.entity.HealthEduArticlePatient.class, esIndex, esType);
|
|
|
// for(HealthEduArticlePatient one :esList){
|
|
|
// JSONObject jsonObject = getArticalById(one.getArticleId());
|
|
|
//
|
|
|
// }
|
|
|
// return null;
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
public JSONArray pushArticleLogs(int page, int pagesize, String patientCode) throws Exception {
|
|
|
|
|
|
pagesize = page * pagesize;
|
|
|
page = (page - 1) * pagesize;
|
|
|
//
|
|
|
// StringBuffer sql2 = new StringBuffer("select * from " + esType +
|
|
|
// " where sendCode='" + sendCode + "' ");
|
|
|
// sql2.append(" order by createTime limit " + page + "," + pagesize);
|
|
|
String sql = "SELECT * FROM " + esType + " where nested(patients.code)= '" + patientCode + "' order by createTime desc limit " + page + "," + pagesize;
|
|
|
List<com.yihu.es.entity.HealthEduArticlePatient> esList = elasticsearchUtil.excute(sql, com.yihu.es.entity.HealthEduArticlePatient.class, esIndex, esType);
|
|
|
HealthEduArticlePatientModel heapm = null;
|
|
|
com.alibaba.fastjson.JSONObject article = null;
|
|
|
List<HealthEduArticlePatientModel> result = new ArrayList<>();
|
|
|
Doctor doctor = null;
|
|
|
for (HealthEduArticlePatient one : esList) {
|
|
|
article = healthEducationArticleService.getArticalById(one.getArticleId());
|
|
|
heapm = new HealthEduArticlePatientModel();
|
|
|
heapm.setSendName(one.getSendName());
|
|
|
heapm.setSendCode(one.getDoctorCode());
|
|
|
heapm.setCreateTime(one.getCreateTime());
|
|
|
heapm.setArticleId(article.getString("articleId"));
|
|
|
heapm.setAttachedTitle(article.getString("articleTitle"));
|
|
|
heapm.setAttachedContent(article.getString("articleContent"));
|
|
|
heapm.setArticleType(article.getString("articleType"));
|
|
|
heapm.setLevel1Type(article.getString("firstLevelCategoryId"));
|
|
|
heapm.setLevel2Type(article.getString("secondLevelCategoryId"));
|
|
|
heapm.setLevel(article.getString("articlelevel"));
|
|
|
heapm.setAllCount(heapm.getAllCount() + one.getPatients().size());
|
|
|
heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
|
|
|
heapm.setCommentNumber(Integer.valueOf(article.getString("commentNumber")));//文章评论数
|
|
|
heapm.setPointNumber(Integer.valueOf(article.getString("pointNumber")));//文章点赞数
|
|
|
heapm.setArticleCover(article.getString("articleCover"));//封面
|
|
|
heapm.setComputeTime(computeTime(article.getString("insertTime")));
|
|
|
heapm.setOperatorName(article.getString("operatorName"));
|
|
|
doctor = doctorDao.findByCode(one.getDoctorCode());
|
|
|
heapm.setPhoto(doctor.getPhoto());
|
|
|
result.add(heapm);
|
|
|
// heapm.setTime();//时间 xx小时前 2017-10-11
|
|
|
|
|
|
/**************************************************** ArticleQR ********************************************************/
|
|
|
|
|
|
/**
|
|
|
* 获取认证标识
|
|
|
* @param currentRoleLevel
|
|
|
* @param currentRoleCode
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject getArticleQRCode(String currentRoleLevel,String currentRoleCode) throws Exception {
|
|
|
JSONObject re = new JSONObject();
|
|
|
JSONObject json = null;
|
|
|
try{
|
|
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("currentRoleLevel",currentRoleLevel);
|
|
|
param.put("currentRoleCode",currentRoleCode);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticleQRCode, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return re;
|
|
|
}
|
|
|
if ("10000".equals(json.getString("Code"))) {
|
|
|
return json;
|
|
|
}else {
|
|
|
throw new Exception(json.getString("Message"));
|
|
|
}
|
|
|
JSONArray re = new JSONArray();
|
|
|
re.addAll(result);
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新认证标识
|
|
|
* @param currentRoleLevel
|
|
|
* @param currentRoleCode
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void updateArticleQRCode(String currentRoleLevel,String currentRoleCode,String imgUrl,Integer position,String userId,String userName,
|
|
|
String orgId,String orgName,Integer id) throws Exception {
|
|
|
|
|
|
public String computeTime(String create) {
|
|
|
Date createDate = DateUtil.strToDate(create, "yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
Date nowDate = new Date();
|
|
|
//计算2个时间差
|
|
|
Long l = nowDate.getTime() - createDate.getTime();
|
|
|
JSONObject json = null;
|
|
|
try{
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("id",id);
|
|
|
param.put("currentRoleLevel",currentRoleLevel);
|
|
|
param.put("currentRoleCode",currentRoleCode);
|
|
|
param.put("imgUrl",imgUrl);
|
|
|
param.put("position",position);
|
|
|
param.put("userId",userId);
|
|
|
param.put("userName",userName);
|
|
|
param.put("orgId",orgId);
|
|
|
param.put("orgName",orgName);
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(updateArticleQRCode, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (!"10000".equals(json.getString("Code"))) {
|
|
|
|
|
|
long hour = l / (60 * 60 * 1000); //小时
|
|
|
long min = l / (60 * 1000);//分钟
|
|
|
long s = l / 1000;//秒
|
|
|
if (s < 60) {
|
|
|
return s + "秒前";
|
|
|
throw new Exception(json.getString("Message"));
|
|
|
}
|
|
|
if (min < 60) {
|
|
|
return min + "分钟前";
|
|
|
}
|
|
|
|
|
|
public void saveArticleQRCode(String currentRoleLevel,String currentRoleCode,String imgUrl,Integer position,String userId,String userName,
|
|
|
String orgId,String orgName) throws Exception {
|
|
|
JSONObject json = null;
|
|
|
try{
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("imgUrl",imgUrl);
|
|
|
param.put("position",position);
|
|
|
param.put("userId",userId);
|
|
|
param.put("userName",userName);
|
|
|
param.put("orgId",orgId);
|
|
|
param.put("orgName",orgName);
|
|
|
param.put("operatorRoleCode",currentRoleCode);
|
|
|
param.put("currentRoleLevel",currentRoleLevel);//saveArticleQRCode
|
|
|
String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(saveArticleQRCode, param.toString(), "1"));
|
|
|
json = JSON.parseObject(response);
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
if (hour < 24) {
|
|
|
return hour + "小时前";
|
|
|
if (!"10000".equals(json.getString("Code"))) {
|
|
|
|
|
|
throw new Exception(json.getString("Message"));
|
|
|
}
|
|
|
return DateUtil.dateToStr(createDate, "yyyy-MM-dd");
|
|
|
}
|
|
|
|
|
|
/**************************************************** other *******************************************************/
|
|
|
|
|
|
/**
|
|
|
* 校验是否有编辑权限
|
|
|
*/
|
|
|
public boolean checkEduArticleAhthority(Doctor doctor,String currentRoleCode){
|
|
|
// Doctor doctor = doctorDao.findByCode(userCode);
|
|
|
//1专科医生,2全科医生,3健康管理师, 10管理员
|
|
|
if(doctor.getLevel()==10){
|
|
|
// Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(userCode);
|
|
|
// Integer level = (Integer)resultMap.get("level");
|
|
|
// List<String> roleList = (List<String>)resultMap.get("roleList");
|
|
|
Integer level = labelService.roleConverse(currentRoleCode);
|
|
|
//判断是否是市级
|
|
|
if(level==1){
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
}
|