From cdd1d2fea5a0f37014394d5d0bfc1a4e4d5fb379 Mon Sep 17 00:00:00 2001 From: Tony Date: Fri, 1 Jul 2022 18:21:46 +0100 Subject: [PATCH] feat(route): cde xxgk (#10094) * feat(route): cde xxgk * docs: fix example * docs: fix path --- docs/government.md | 10 +++ lib/v2/cde/index.js | 4 +- lib/v2/cde/maintainer.js | 1 + lib/v2/cde/radar.js | 26 ++++++- lib/v2/cde/router.js | 1 + .../cde/templates/xxgk/breakthroughCure.art | 18 +++++ lib/v2/cde/templates/xxgk/cliniCal.art | 16 ++++ .../cde/templates/xxgk/priorityApproval.art | 18 +++++ lib/v2/cde/utils.js | 4 +- lib/v2/cde/xxgk.js | 73 +++++++++++++++++++ 10 files changed, 163 insertions(+), 8 deletions(-) create mode 100644 lib/v2/cde/templates/xxgk/breakthroughCure.art create mode 100644 lib/v2/cde/templates/xxgk/cliniCal.art create mode 100644 lib/v2/cde/templates/xxgk/priorityApproval.art create mode 100644 lib/v2/cde/xxgk.js diff --git a/docs/government.md b/docs/government.md index eeab0f3ad..ed458ecfd 100644 --- a/docs/government.md +++ b/docs/government.md @@ -239,6 +239,16 @@ pageClass: routes +### 信息公开 + + + +| 优先审评公示 | 突破性治疗公示 | 临床试验默示许可 | +| :--------------: | :--------------: | :------: | +| priorityApproval | breakthroughCure | cliniCal | + + + ## 哈尔滨市科技局 ### 政务公开 diff --git a/lib/v2/cde/index.js b/lib/v2/cde/index.js index bf6bd4cdb..65a2b64c8 100644 --- a/lib/v2/cde/index.js +++ b/lib/v2/cde/index.js @@ -104,7 +104,7 @@ module.exports = async (ctx) => { const items = await Promise.all( list.map((item) => ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got.get(item.link, { + const detailResponse = await got(item.link, { headers: { cookie: await utils.getCookie(ctx), }, @@ -126,7 +126,7 @@ module.exports = async (ctx) => { ctx.state.data = { title: `${utils.title} - ${cateTitleMap[channel][cate]}`, - link: String(channelLinkMap[channel]), + link: channelLinkMap[channel], item: items, }; }; diff --git a/lib/v2/cde/maintainer.js b/lib/v2/cde/maintainer.js index 294d15815..339d48cf0 100644 --- a/lib/v2/cde/maintainer.js +++ b/lib/v2/cde/maintainer.js @@ -1,3 +1,4 @@ module.exports = { + '/xxgk/:category': ['TonyRL'], '/:channel/:category': ['Fatpandac'], }; diff --git a/lib/v2/cde/radar.js b/lib/v2/cde/radar.js index 08d7a6eb8..ade8d0963 100644 --- a/lib/v2/cde/radar.js +++ b/lib/v2/cde/radar.js @@ -11,19 +11,19 @@ module.exports = { { title: '要闻导读', docs: 'https://docs.rsshub.app/government.html#guo-jia-yao-pin-shen-ping-wang-zhan-shou-ye', - source: ['/main/news/listpage/545cf855a50574699b46b26bcb165f32'], + source: ['/main/news/listpage/1e0a362d64015ebcbf32d6949acbba11'], target: '/cde/news/ywdd', }, { title: '图片新闻', docs: 'https://docs.rsshub.app/government.html#guo-jia-yao-pin-shen-ping-wang-zhan-shou-ye', - source: ['/main/news/listpage/545cf855a50574699b46b26bcb165f32'], + source: ['/main/news/listpage/4b49e3142441860ac6a48c888a54712a'], target: '/cde/news/tpxw', }, { title: '工作动态', docs: 'https://docs.rsshub.app/government.html#guo-jia-yao-pin-shen-ping-wang-zhan-shou-ye', - source: ['/main/news/listpage/545cf855a50574699b46b26bcb165f32'], + source: ['/main/news/listpage/3cc45b396497b598341ce3af000490e5'], target: '/cde/news/gzdt', }, { @@ -35,9 +35,27 @@ module.exports = { { title: '中心规章', docs: 'https://docs.rsshub.app/government.html#guo-jia-yao-pin-shen-ping-wang-zhan-shou-ye', - source: ['/main/policy/listpage/9f9c74c73e0f8f56a8bfbc646055026d'], + source: ['/main/policy/listpage/369ac7cfeb67c6000c33f85e6f374044'], target: '/cde/policy/zxgz', }, + { + title: '优先审评公示 - 信息公开', + docs: 'https://docs.rsshub.app/government.html#guo-jia-yao-pin-shen-ping-wang-zhan-shou-ye', + source: ['/main/xxgk/listpage/2f78f372d351c6851af7431c7710a731'], + target: '/cde/xxgf/priorityApproval', + }, + { + title: '突破性治疗公示 - 信息公开', + docs: 'https://docs.rsshub.app/government.html#guo-jia-yao-pin-shen-ping-wang-zhan-shou-ye', + source: ['/main/xxgk/listpage/da6efd086c099b7fc949121166f0130c'], + target: '/cde/xxgf/breakthroughCure', + }, + { + title: '临床试验默示许可 - 信息公开', + docs: 'https://docs.rsshub.app/government.html#guo-jia-yao-pin-shen-ping-wang-zhan-shou-ye', + source: ['/main/xxgk/listpage/4b5255eb0a84820cef4ca3e8b6bbe20c'], + target: '/cde/xxgf/cliniCal', + }, ], }, }; diff --git a/lib/v2/cde/router.js b/lib/v2/cde/router.js index f487b5733..be1e651ae 100644 --- a/lib/v2/cde/router.js +++ b/lib/v2/cde/router.js @@ -1,3 +1,4 @@ module.exports = function (router) { + router.get('/xxgk/:category', require('./xxgk')); router.get('/:channel/:category', require('./index')); }; diff --git a/lib/v2/cde/templates/xxgk/breakthroughCure.art b/lib/v2/cde/templates/xxgk/breakthroughCure.art new file mode 100644 index 000000000..ed4c29941 --- /dev/null +++ b/lib/v2/cde/templates/xxgk/breakthroughCure.art @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + +
受理号药品名称注册申请人申请日期公示日期公示截止日期
{{ item.acceptid }}{{ item.drgnamecn }}{{ item.company }}{{ item.applyDate }}{{ item.noticeDate }}{{ item.endNoticeDate }}
diff --git a/lib/v2/cde/templates/xxgk/cliniCal.art b/lib/v2/cde/templates/xxgk/cliniCal.art new file mode 100644 index 000000000..487cd718b --- /dev/null +++ b/lib/v2/cde/templates/xxgk/cliniCal.art @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + +
受理号药品名称申请人名称适应症注册分类
{{ item.acceptid }}{{ item.drgnamecn }}{{ item.companys }}{{ item.lcmsxkIndication }}{{ item.lcmsxkRegisterkind }}
diff --git a/lib/v2/cde/templates/xxgk/priorityApproval.art b/lib/v2/cde/templates/xxgk/priorityApproval.art new file mode 100644 index 000000000..2a385a9d3 --- /dev/null +++ b/lib/v2/cde/templates/xxgk/priorityApproval.art @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + +
受理号药品名称注册申请人承办日期申请日期公示日期
{{ item.acceptid }}{{ item.drgnamecn }}{{ item.company }}{{ item.createdate }}{{ item.applyDate }}{{ item.noticeDate }}
diff --git a/lib/v2/cde/utils.js b/lib/v2/cde/utils.js index cbe24866d..e3e074fc1 100644 --- a/lib/v2/cde/utils.js +++ b/lib/v2/cde/utils.js @@ -4,8 +4,8 @@ const title = '国家药品监督管理局药品审评中心'; const rootUrl = 'https://www.cde.org.cn'; const getCookie = (ctx) => - ctx.cache.tryGet(rootUrl, async () => { - const response = await got.get(rootUrl); + ctx.cache.tryGet('cde:cookie', async () => { + const response = await got(rootUrl); return response.headers['set-cookie'] .join() diff --git a/lib/v2/cde/xxgk.js b/lib/v2/cde/xxgk.js new file mode 100644 index 000000000..6c2ac71d1 --- /dev/null +++ b/lib/v2/cde/xxgk.js @@ -0,0 +1,73 @@ +const got = require('@/utils/got'); +const { parseDate } = require('@/utils/parse-date'); +const { art } = require('@/utils/render'); +const path = require('path'); +const utils = require('./utils'); + +const baseUrl = 'https://www.cde.org.cn'; +const xxgkMap = { + xxgk: { + priorityApproval: { + title: '优先审评公示', + url: `${baseUrl}/main/xxgk/listpage/2f78f372d351c6851af7431c7710a731`, + endPoint: '/priority/getPriorityApprovalList', + form: { + pageSize: 50, + pageNum: 1, + noticeType: 2, + acceptid: '', + drugname: '', + company: '', + }, + }, + breakthroughCure: { + title: '突破性治疗公示', + url: `${baseUrl}/main/xxgk/listpage/da6efd086c099b7fc949121166f0130c`, + endPoint: '/breakthrough/getBreakthroughCureList', + form: { + pageSize: 50, + pageNum: 1, + noticeType: 1, + acceptid: '', + drugname: '', + company: '', + }, + }, + cliniCal: { + title: '临床试验默示许可', + url: `${baseUrl}/main/xxgk/listpage/4b5255eb0a84820cef4ca3e8b6bbe20c`, + endPoint: '/xxgk/getCliniCalList', + form: { + pageSize: 50, + pageNum: 1, + condition: '', + }, + }, + }, +}; + +module.exports = async (ctx) => { + const { category } = ctx.params; + + const { data } = await got.post(`${baseUrl}/main${xxgkMap.xxgk[category].endPoint}`, { + form: xxgkMap.xxgk[category].form, + headers: { + referer: xxgkMap.xxgk[category].url, + cookie: await utils.getCookie(ctx), + }, + }); + + const items = data.data.records.map((item) => ({ + title: item.drgnamecn, + guid: item.acceptid, + pubDate: item.endNoticeDate ? parseDate(item.endNoticeDate) : null, + description: art(path.join(__dirname, `templates/xxgk/${category}.art`), { item }), + link: xxgkMap.xxgk[category].url, + })); + + ctx.state.data = { + title: `${xxgkMap.xxgk[category].title} - 国家药品监督管理局药品审评中心`, + link: xxgkMap.xxgk[category].url, + item: items, + }; +};