|
@ -1,10 +1,16 @@
|
|
|
package com.yihu.jw.hospital.endpoint.article;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
|
|
|
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
|
|
|
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
|
|
|
import com.yihu.jw.hospital.service.consult.BasePatientBusinessService;
|
|
|
import com.yihu.jw.hospital.service.consult.KnowledgeArticleService;
|
|
|
import com.yihu.jw.hospital.service.consult.KnowledgeCategoryService;
|
|
|
import com.yihu.jw.patient.dao.BasePatientBusinessDao;
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
@ -34,6 +40,13 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
@Autowired
|
|
|
private KnowledgeCategoryService knowledgeCategoryService;
|
|
|
|
|
|
@Autowired
|
|
|
private BasePatientBusinessService patientBusinessService;
|
|
|
@Autowired
|
|
|
private BaseDoctorHospitalDao doctorHospitalDao;
|
|
|
@Autowired
|
|
|
private BasePatientBusinessDao basePatientBusinessDao;
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
|
|
|
@ApiOperation(value = "获取文章列表")
|
|
@ -67,6 +80,14 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
|
|
|
}
|
|
|
|
|
|
List<KnowledgeArticleDO> list = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
|
|
|
for (KnowledgeArticleDO knowledgeArticleDO:list){
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
|
|
|
if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
|
|
|
BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
|
|
|
knowledgeArticleDO.setDeptName(doctorHospitalDO.getDeptName());
|
|
|
knowledgeArticleDO.setHospitalName(doctorHospitalDO.getOrgName());
|
|
|
}
|
|
|
}
|
|
|
List<KnowledgeArticleDO> totals = knowledgeArticleService.search(fields,filters,sorts);
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
@ -195,4 +216,87 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
|
|
|
@RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
|
|
|
return success(knowledgeArticleService.saveDeptArticle(dept,sdJsons));
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.sendPatientBusiness)
|
|
|
@ApiOperation(value = "发送文章/问卷")
|
|
|
public ListEnvelop sendPatientBusiness(@ApiParam(name = "json", value = "患者业务关联表")
|
|
|
@RequestParam(value = "json",required = false)String json)throws Exception {
|
|
|
ListEnvelop listEnvelop = new ListEnvelop();
|
|
|
JSONArray jsonArray = JSONArray.parseArray(json);
|
|
|
List<BasePatientBusinessDO> patientBusinessDOList = new ArrayList<>();
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
BasePatientBusinessDO patientBusinessDO = toEntity(jsonObject.toJSONString(),BasePatientBusinessDO.class);
|
|
|
patientBusinessDOList.add(patientBusinessDO);
|
|
|
}
|
|
|
listEnvelop.setDetailModelList(knowledgeArticleService.sendBusinessToPatient(patientBusinessDOList));
|
|
|
return listEnvelop;
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleUsed)
|
|
|
@ApiOperation(value = "设置文章为常用/不常用")
|
|
|
public ObjEnvelop setArticleUsed(@ApiParam(name = "id", value = "文章id")
|
|
|
@RequestParam(value = "id",required = true)String id,
|
|
|
@ApiParam(name = "used", value = "常用")
|
|
|
@RequestParam(value = "used",required = false)Integer used)throws Exception {
|
|
|
return success(knowledgeArticleService.setUsed(id,used));
|
|
|
}
|
|
|
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchPatientArticle)
|
|
|
@ApiOperation(value = "获取患者文章列表")
|
|
|
public Envelop searchPatientArticle(
|
|
|
@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
|
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
|
@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
|
|
|
@RequestParam(value = "filters", required = false) String filters,
|
|
|
@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
|
|
|
@RequestParam(value = "sorts", required = false) String sorts,
|
|
|
@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
|
|
|
@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
|
|
|
@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
|
|
|
@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
|
|
|
if(StringUtils.isBlank(filters)){
|
|
|
filters=filters+"del=1";
|
|
|
}else{
|
|
|
filters=filters+";del=1";
|
|
|
}
|
|
|
|
|
|
List<BasePatientBusinessDO> list = patientBusinessService.search(fields,filters,sorts,page,pageSize);
|
|
|
|
|
|
for (BasePatientBusinessDO patientBusinessDO:list){
|
|
|
Integer type = patientBusinessDO.getRelationType();
|
|
|
if (type==1){
|
|
|
KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleService.selectById(patientBusinessDO.getRelationCode());
|
|
|
if (knowledgeArticleDO!=null){
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
|
|
|
if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
|
|
|
knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
|
|
|
knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
|
|
|
}
|
|
|
}
|
|
|
patientBusinessDO.setKnowledgeArticleDO(knowledgeArticleDO);
|
|
|
}
|
|
|
}
|
|
|
List<BasePatientBusinessDO> totals = patientBusinessService.search(fields,filters,sorts);
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("total",totals.size());
|
|
|
result.put("detailModelList",list);
|
|
|
|
|
|
return success(result);
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleCollection)
|
|
|
@ApiOperation(value = "设置文章状态")
|
|
|
public ObjEnvelop setArticleCollection(@ApiParam(name = "id", value = "文章id")
|
|
|
@RequestParam(value = "id",required = true)String id,
|
|
|
@ApiParam(name = "flag", value = "1收藏2阅读3点赞4分享")
|
|
|
@RequestParam(value = "flag",required = false)Integer flag,
|
|
|
@ApiParam(name = "status", value = "收藏(1收藏0未收藏)/阅读(1已读0未读)/点赞(1已赞0未赞)分享(1已分享0未分享)")
|
|
|
@RequestParam(value = "status",required = false)Integer status)throws Exception {
|
|
|
return success(patientBusinessService.setCollectionById(id,flag,status));
|
|
|
}
|
|
|
}
|