diff --git a/hlw/diagnostic-record/index.js b/hlw/diagnostic-record/index.js index bb9f693..28f9ce8 100644 --- a/hlw/diagnostic-record/index.js +++ b/hlw/diagnostic-record/index.js @@ -634,7 +634,7 @@ async function markStoreRxPrinted(item, db, user) { _id: new ObjectId(item.id.trim()), drugStoreNo: { $in: [...new Set(storeIds)] }, status: status.pass, - feeType: "ZF", + // feeType: "ZF", }, { $inc: { printCount: 1 }, diff --git a/hlw/drug-info/index.js b/hlw/drug-info/index.js index ac04881..0b0e859 100644 --- a/hlw/drug-info/index.js +++ b/hlw/drug-info/index.js @@ -3,6 +3,7 @@ const { ObjectId } = require("mongodb"); const { getDrugList } = require('./verify'); const { validateApplicableDiagnosisCodes } = require('./applicable-diagnosis'); +const hnHis = require("../hn-his"); let db = ""; function getConfigOptionNames(list) { @@ -57,6 +58,8 @@ module.exports = async (item, mongodb) => { return await searchDrugs(item); case "getDrugMatchedDisease": return await getDrugMatchedDisease(item); + case "updateHisDrugInfo": + return await updateHisDrugInfo(item) } }; // 药品库信息 @@ -500,3 +503,42 @@ async function getDrugMatchedDisease(ctx) { return { success: false, message: e.message } } } + +async function updateHisDrugInfo(ctx) { + try { + const id = typeof ctx.id === 'string' ? ctx.id.trim() : ''; + if (id === '' || !ObjectId.isValid(id)) { + return { success: false, message: '参数错误' } + } + const drug = await db.collection('drug-info').findOne({ _id: new ObjectId(id) }); + if (!drug) { + return { success: false, message: '药品不存在' } + } + const data = { + code: '01', + erp_id: drug.erpId, + drugname: drug.name, + gjbm: drug.insurance_code, + specification: drug.specification, + pack_unit_name: drug.unit, + manu_name: drug.manufacturer, + py_code: drug.pinyin_code, + default_dosage: drug.dosage, + default_unit: drug.dosage_unit, + default_drug_win: drug.days, + default_total: drug.recommended_quantity, + default_usage_name: drug.administration_method, + default_supply_name: drug.frequency || drug.freq, + drug_dosform: drug.dosage_form, + zl: drug.package_amount, + kfxs: drug.package_amount, + kfdw: drug.unit, + jlxs: drug.dosage, + jldw: drug.dosage_unit + } + return await hnHis({ type: 'updateHisDrug', data: [data] }) + // return { success: true, data } + } catch (e) { + return { success: false, message: e?.message } + } +} diff --git a/hlw/hn-his/index.js b/hlw/hn-his/index.js index 31a3888..ee0b8c4 100644 --- a/hlw/hn-his/index.js +++ b/hlw/hn-his/index.js @@ -13,6 +13,8 @@ const AppWin = { module.exports = async (item) => { switch (item.type) { + case "updateHisDrug": + return await updateHisDrug(item); case "getHisCustomer": return await getHisCustomer(item); case "addHisCustomer": @@ -926,3 +928,27 @@ async function hisTest() { // const data = { "patientid": "30015424", "registerid": "h202501070833145550001", "orderno": "h202501070833145550001", "doctorcode": "10010", "unitcode": "1005000", "visit_time": "2025-12-04 13:15", "area_code": "330602", "hospid": "108", "icds": [{ "icd_code ": "R51.x00", "icd_name": "头痛", "sort": 1 }], "details": [{ "drug_type": "xy", "drug_groupno": "7X", "drug_group": "", "drug_id": "00110", "drug_serial": "01", "drug_name": "富马酸替诺福韦二吡呋酯片", "drug_spec": "300mg×30片/盒", "drug_pric": "329.41", "drug_cnt": "1", "drug_sumamt": "329.41", "supple_code": "1", "supple_name": "口服", "medc_days": "3", "drug_times": "1", "drug_comm": "", "drug_ma": "", "remark": "", "limit_flag": "0", "usage": "11", "usage_name": "每天一次(qd)", "sin_doscnt": "2.00", "sin_dosunt": "片", "unit": "盒" }] } // return await syncHisChargeStatus(data); } + + +async function updateHisDrug({ data: drugArr }) { + try { + const params = { type: "updateOnlineDrug", data: drugArr }; + const { data, status_code, message } = await request.main(url, params, "POST"); + if (status_code == 200 && !message) { + return { + success: true, + message: `同步his药品成功`, + }; + } else { + return { + success: false, + message: message || "同步his药品失败", + }; + } + } catch (err) { + return { + success: false, + message: err.message || "同步his药品错误", + }; + } +} \ No newline at end of file diff --git a/hlw/index.js b/hlw/index.js index 315a867..45e6ddd 100644 --- a/hlw/index.js +++ b/hlw/index.js @@ -57,6 +57,7 @@ module.exports = async (item, db, context) => { case "getStoreSimilarDrugInfo": case "searchDrugs": case "getDrugMatchedDisease": + case "updateHisDrugInfo": return await drugInfo(item, db); case "addPatientDescription": case "deletePatientDescription":