feat: 需求调整
1. 医保处方支持打印 2. 同步his接口开发
This commit is contained in:
parent
8956fb8c8a
commit
c8f4c72205
@ -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 },
|
||||
|
||||
@ -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 }
|
||||
}
|
||||
}
|
||||
|
||||
@ -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药品错误",
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -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":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user