fix:问题修复
This commit is contained in:
parent
399432202a
commit
c9c6b7ea4f
@ -30,6 +30,8 @@ module.exports = async (item, mongodb) => {
|
|||||||
return await getStoreSimilarDrugInfo(item);
|
return await getStoreSimilarDrugInfo(item);
|
||||||
case "searchDrugs":
|
case "searchDrugs":
|
||||||
return await searchDrugs(item);
|
return await searchDrugs(item);
|
||||||
|
case "getDrugMatchedDisease":
|
||||||
|
return await getDrugMatchedDisease(item);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// 药品库信息
|
// 药品库信息
|
||||||
@ -403,7 +405,7 @@ async function getStoreSimilarDrugInfo(ctx) {
|
|||||||
drugs: medicines,
|
drugs: medicines,
|
||||||
similarDrugs: similarDrugs
|
similarDrugs: similarDrugs
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return { success: false, message: e.message }
|
return { success: false, message: e.message }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,3 +432,26 @@ async function searchDrugs(ctx) {
|
|||||||
return { success: false, message: e.message }
|
return { success: false, message: e.message }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getDrugMatchedDisease(ctx) {
|
||||||
|
try {
|
||||||
|
const drugIds = Array.isArray(ctx.drugIds) ? ctx.drugIds.filter(i => typeof i === 'string' && ObjectId.isValid(i)) : [];
|
||||||
|
if (drugIds.length === 0) {
|
||||||
|
return { success: false, message: "参数错误" }
|
||||||
|
}
|
||||||
|
const list = await db.collection("drug-info").find({ _id: { $in: drugIds.map(i => new ObjectId(i)) } }, { projection: { _id: 1, applicableDiagnosisIds: 1 } }).toArray();
|
||||||
|
const ids = [];
|
||||||
|
list.forEach(i => {
|
||||||
|
if (i && Array.isArray(i.applicableDiagnosisIds)) {
|
||||||
|
ids.push(...i.applicableDiagnosisIds);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (ids.length === 0) {
|
||||||
|
return { success: true, message: "查询成功", list: [] }
|
||||||
|
}
|
||||||
|
const diseases = await db.collection("hlw-diagnosis").find({ _id: { $in: ids} }, { projection: { _id: 1, name: 1 } }).toArray();
|
||||||
|
return { success: true, message: "查询成功", list: diseases.map(i => i.name) }
|
||||||
|
} catch (e) {
|
||||||
|
return { success: false, message: e.message }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -55,6 +55,7 @@ module.exports = async (item, db, context) => {
|
|||||||
case "importHlwDrugInfo":
|
case "importHlwDrugInfo":
|
||||||
case "getStoreSimilarDrugInfo":
|
case "getStoreSimilarDrugInfo":
|
||||||
case "searchDrugs":
|
case "searchDrugs":
|
||||||
|
case "getDrugMatchedDisease":
|
||||||
return await drugInfo(item, db);
|
return await drugInfo(item, db);
|
||||||
case "addPatientDescription":
|
case "addPatientDescription":
|
||||||
case "deletePatientDescription":
|
case "deletePatientDescription":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user