|
@ -0,0 +1,84 @@
|
|
|
package com.yihu.jw.hospital.endpoint.article;
|
|
|
|
|
|
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
|
|
|
import com.yihu.jw.hospital.service.consult.KnowledgeArticleService;
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 健康文章
|
|
|
* @author huangwenjie
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.PREFIX)
|
|
|
@Api(value = "健康文章", description = "健康文章接口", tags = {"健康文章接口"})
|
|
|
public class ArticleEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
@Autowired
|
|
|
private KnowledgeArticleService knowledgeArticleService;
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
|
|
|
@ApiOperation(value = "获取文章列表")
|
|
|
public ListEnvelop searchKnowledgePageList(
|
|
|
// @ApiParam(name = "category_first", value = "1级分类编码")
|
|
|
// @RequestParam(value = "category_first", required = false) String category_first,
|
|
|
// @ApiParam(name = "category_secend", value = "2级分类编码")
|
|
|
// @RequestParam(value = "category_second", required = false) String category_second,
|
|
|
// @ApiParam(name = "keyword", value = "关键字")
|
|
|
// @RequestParam(value = "keyword", required = false) String keyword,
|
|
|
// @ApiParam(name = "status", value = "审核状态:0未审核,1已审核")
|
|
|
// @RequestParam(value = "status", required = false) String status,
|
|
|
// @ApiParam(name = "start", value = "开始时间")
|
|
|
// @RequestParam(value = "start", required = false) String start,
|
|
|
// @ApiParam(name = "end", value = "结束时间")
|
|
|
// @RequestParam(value = "end", required = false) String end,
|
|
|
@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{
|
|
|
List<KnowledgeArticleDO> result = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
|
|
|
return success(result);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.queryById)
|
|
|
@ApiOperation(value = "根据id查询文章")
|
|
|
public Envelop queryByCode(
|
|
|
@ApiParam(name = "id", value = "id", required = true)
|
|
|
@RequestParam(value = "id", required = true)String id) throws Exception{
|
|
|
KnowledgeArticleDO articleDO = knowledgeArticleService.retrieve(id);
|
|
|
return success(articleDO);
|
|
|
}
|
|
|
|
|
|
@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.deleteById)
|
|
|
@ApiOperation(value = "根据id删除文章")
|
|
|
public Envelop deleteById(
|
|
|
@ApiParam(name = "id", value = "id,多个使用英文逗号分隔", required = true)
|
|
|
@RequestParam(value = "id", required = true)String id)throws Exception {
|
|
|
knowledgeArticleService.delArticle(id);
|
|
|
return success("操作成功");
|
|
|
}
|
|
|
|
|
|
@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticle)
|
|
|
@ApiOperation(value = "保存/更新文章")
|
|
|
public Envelop saveArticle(
|
|
|
@ApiParam(name = "jsonData", value = "Json数据", required = true)
|
|
|
@RequestParam String jsonData)throws Exception {
|
|
|
knowledgeArticleService.saveArticle(jsonData);
|
|
|
return success("操作成功");
|
|
|
}
|
|
|
}
|