|
@@ -16,11 +16,12 @@ export function CC_Dosage2Basis({dose = 0, xbzxs = 1}) {
|
|
|
* @param medicine 药品
|
|
* @param medicine 药品
|
|
|
* @param {number} medicine.oldDose 基础剂量
|
|
* @param {number} medicine.oldDose 基础剂量
|
|
|
* @param {number} medicine.xbzxs 转换系数
|
|
* @param {number} medicine.xbzxs 转换系数
|
|
|
- * @param {boolean=false} keep 保留计算结果
|
|
|
|
|
|
|
+ * @param {((value: number, oldValue: number) => boolean) | boolean=true} keep 保留计算结果
|
|
|
* @returns {number} 输入剂量
|
|
* @returns {number} 输入剂量
|
|
|
*/
|
|
*/
|
|
|
-export function CC_Basis2Dosage({oldDose = 0, xbzxs = 1}, keep = false) {
|
|
|
|
|
- console.log('log-->CC_Basis2Dosage', `basis: ${oldDose}, xbzxs: ${xbzxs}`);
|
|
|
|
|
|
|
+export function CC_Basis2Dosage({oldDose = 0, xbzxs = 1}, keep = true) {
|
|
|
|
|
+ console.log('log-->CC_Basis2Dosage', `basis: ${oldDose}, xbzxs: ${xbzxs}; keep=${typeof keep === 'function' ? '计算' : keep}`);
|
|
|
if (!xbzxs || xbzxs === 1) return +oldDose;
|
|
if (!xbzxs || xbzxs === 1) return +oldDose;
|
|
|
- return +oldDose / xbzxs;
|
|
|
|
|
|
|
+ const value= +oldDose / xbzxs;
|
|
|
|
|
+ return (typeof keep === 'function' ? keep(value, oldDose) : keep) ? value : null;
|
|
|
}
|
|
}
|