Showing
1 changed file
with
22 additions
and
5 deletions
... | @@ -39,15 +39,17 @@ const getItemsList = async(queryUrl) => { | ... | @@ -39,15 +39,17 @@ const getItemsList = async(queryUrl) => { |
39 | 39 | ||
40 | //itemArray에 있는 모든 data를 MongoDB의 SMB collections에 저장함 | 40 | //itemArray에 있는 모든 data를 MongoDB의 SMB collections에 저장함 |
41 | const exportJsonData = (itemList) => { | 41 | const exportJsonData = (itemList) => { |
42 | - itemList.forEach(item => { | 42 | + itemList.forEach(async item => { |
43 | const medicineId = item.itemSeq; | 43 | const medicineId = item.itemSeq; |
44 | const medicineInfo = { | 44 | const medicineInfo = { |
45 | name : item.itemName, | 45 | name : item.itemName, |
46 | company : item.entpName, | 46 | company : item.entpName, |
47 | - target : item.efcyQesitm, | 47 | + target : await slicingInfo(item.efcyQesitm), |
48 | - dosage : item.useMethodQesitm, | 48 | + dosage : await slicingInfo(item.useMethodQesitm), |
49 | - warn : item.atpnWarnQesitm + '\n\n' + item.atpnQesitm, | 49 | + warn : await slicingInfo(item.atpnWarnQesitm ? |
50 | - antiEffect : item.seQesitm | 50 | + item.atpnWarnQesitm + '\n' + item.atpnQesitm |
51 | + : item.atpnQesitm), | ||
52 | + antiEffect : await slicingInfo(item.seQesitm) | ||
51 | }; | 53 | }; |
52 | 54 | ||
53 | Medicine.findOneAndUpdate({ | 55 | Medicine.findOneAndUpdate({ |
... | @@ -57,3 +59,18 @@ const exportJsonData = (itemList) => { | ... | @@ -57,3 +59,18 @@ const exportJsonData = (itemList) => { |
57 | }).exec(); | 59 | }).exec(); |
58 | }) | 60 | }) |
59 | } | 61 | } |
62 | + | ||
63 | +//복용 정보에서 불필요한 태그를 제거하고 제거된 값을 반환한다. | ||
64 | +const slicingInfo = async (info) => { | ||
65 | + let result = info; | ||
66 | + | ||
67 | + if(info) { | ||
68 | + result = await info.split('<p>').join('') | ||
69 | + .split('</p>').join('') | ||
70 | + .split('<sup>').join('') | ||
71 | + .split('</sup>').join('') | ||
72 | + .split('null').join(''); | ||
73 | + } | ||
74 | + | ||
75 | + return result; | ||
76 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment