fix(prescription): 解决处方列表中手术类型和其他医嘱类型的问题
- 更新 lodash.template 修复脚本以处理 assignWith 函数的自定义器参数 - 在多个处方组件中引入 drord_doctor_type 字典用于动态生成医嘱类型列表 - 修复手术类型(adviceType=6)的特殊处理逻辑,包括类型映射和字段过滤 - 调整后端医嘱保存服务中的类型分类逻辑,正确处理手术类型 - 更新数据库查询映射以支持手术类型的正确显示和数据传输 - 修复费用对话框和订单表单中的相关类型显示问题
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Fix lodash.template assignWith issue - Manual fix script
|
||||
* Run this after npm/yarn install and before build
|
||||
@@ -18,34 +17,35 @@ if (!fs.existsSync(lodashTemplatePath)) {
|
||||
|
||||
let content = fs.readFileSync(lodashTemplatePath, 'utf8');
|
||||
|
||||
// Check if already patched
|
||||
if (content.includes('/* LODASH_TEMPLATE_PATCHED */')) {
|
||||
console.log('✓ lodash.template already patched');
|
||||
// Check if already patched with new version
|
||||
if (content.includes('/* LODASH_TEMPLATE_PATCHED_V2 */')) {
|
||||
console.log('✓ lodash.template already patched with v2');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Check if assignWith is actually missing
|
||||
if (content.includes('assignWith')) {
|
||||
// Check if it's used but not defined
|
||||
const hasFunctionDefinition = /function\s+assignWith|var\s+assignWith\s*=/.test(content);
|
||||
if (hasFunctionDefinition) {
|
||||
console.log('✓ assignWith is already defined in lodash.template');
|
||||
process.exit(0);
|
||||
}
|
||||
// Remove old patch if exists
|
||||
if (content.includes('/* LODASH_TEMPLATE_PATCHED */')) {
|
||||
console.log('🔄 Removing old patch...');
|
||||
content = content.replace(/\/\* LODASH_TEMPLATE_PATCHED \*\/\n.*assignWith[\s\S]*?^\}/m, '');
|
||||
}
|
||||
|
||||
console.log('🔧 Patching lodash.template...');
|
||||
console.log('🔧 Patching lodash.template with v2...');
|
||||
|
||||
// Simple assignWith implementation
|
||||
const assignWithImpl = `/* LODASH_TEMPLATE_PATCHED */
|
||||
// assignWith polyfill for lodash.template
|
||||
// Correct assignWith implementation that handles undefined customizer
|
||||
const assignWithImpl = `/* LODASH_TEMPLATE_PATCHED_V2 */
|
||||
// assignWith polyfill for lodash.template - Fixed version
|
||||
function assignWith(object, source, customizer) {
|
||||
if (object == null) return object;
|
||||
if (typeof customizer !== 'function') {
|
||||
customizer = function(objValue, srcValue) {
|
||||
return srcValue;
|
||||
};
|
||||
}
|
||||
var props = Object.keys(Object(source));
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var key = props[i];
|
||||
var value = source[key];
|
||||
var assignedValue = customizer ? customizer(object[key], value, key, object, source) : value;
|
||||
var assignedValue = customizer(object[key], value, key, object, source);
|
||||
if (assignedValue !== undefined) {
|
||||
object[key] = assignedValue;
|
||||
}
|
||||
@@ -74,5 +74,5 @@ const after = content.substring(insertPos);
|
||||
content = before + '\n' + assignWithImpl + after;
|
||||
|
||||
fs.writeFileSync(lodashTemplatePath, content);
|
||||
console.log('✅ Successfully patched lodash.template with assignWith function');
|
||||
console.log('✅ Successfully patched lodash.template with assignWith function (v2)');
|
||||
console.log(' File:', lodashTemplatePath);
|
||||
|
||||
Reference in New Issue
Block a user