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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Fix lodash.template assignWith issue for Linux/Mac servers
|
||||
# Fix lodash.template assignWith issue for Linux/Mac servers - V2
|
||||
# Run this script after npm/yarn install
|
||||
|
||||
LODGASH_TEMPLATE="node_modules/lodash.template/index.js"
|
||||
@@ -9,34 +9,43 @@ if [ ! -f "$LODGASH_TEMPLATE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if already patched
|
||||
if grep -q "LODASH_TEMPLATE_PATCHED" "$LODGASH_TEMPLATE"; then
|
||||
echo "✓ lodash.template already patched"
|
||||
# Check if already patched with v2
|
||||
if grep -q "LODASH_TEMPLATE_PATCHED_V2" "$LODGASH_TEMPLATE"; then
|
||||
echo "✓ lodash.template already patched with v2"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "🔧 Patching lodash.template..."
|
||||
# Remove old patch if exists
|
||||
if grep -q "LODASH_TEMPLATE_PATCHED" "$LODGASH_TEMPLATE"; then
|
||||
echo "🔄 Removing old patch..."
|
||||
# Use sed to remove old patch (multi-line)
|
||||
sed -i '/\/\* LODASH_TEMPLATE_PATCHED \*\//,/^}$/d' "$LODGASH_TEMPLATE"
|
||||
fi
|
||||
|
||||
echo "🔧 Patching lodash.template with v2..."
|
||||
|
||||
# Create a temporary file with the patch
|
||||
PATCH=$(cat <<'EOF'
|
||||
/* LODASH_TEMPLATE_PATCHED */
|
||||
// assignWith polyfill for lodash.template
|
||||
PATCH='/* 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;
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
EOF
|
||||
)
|
||||
'
|
||||
|
||||
# Insert after the first line (license comment)
|
||||
{
|
||||
@@ -45,4 +54,4 @@ EOF
|
||||
tail -n +2 "$LODGASH_TEMPLATE"
|
||||
} > "$LODGASH_TEMPLATE.tmp" && mv "$LODGASH_TEMPLATE.tmp" "$LODGASH_TEMPLATE"
|
||||
|
||||
echo "✅ Successfully patched lodash.template with assignWith function"
|
||||
echo "✅ Successfully patched lodash.template with assignWith function (v2)"
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
"predev": "node utils/check.js dev && vdoing",
|
||||
"prebuild": "node utils/check.js build && vdoing",
|
||||
"updateTheme": "yarn remove vuepress-theme-vdoing && rm -rf node_modules && yarn && yarn add vuepress-theme-vdoing -D",
|
||||
"editFm": "node utils/editFrontmatter.js"
|
||||
"editFm": "node utils/editFrontmatter.js",
|
||||
"fix-lodash": "node fix-lodash-manual.js",
|
||||
"build:fixed": "npm run fix-lodash && npm run build",
|
||||
"build:win:fixed": "npm run fix-lodash && npm run build:win"
|
||||
},
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -23,6 +26,7 @@
|
||||
"inquirer": "^7.1.0",
|
||||
"json2yaml": "^1.1.0",
|
||||
"lodash": "^4.17.21",
|
||||
"lodash.assignwith": "^4.2.0",
|
||||
"vuepress": "1.9.9",
|
||||
"vuepress-plugin-baidu-tongji": "^1.0.1",
|
||||
"vuepress-plugin-demo-block": "^0.7.2",
|
||||
@@ -33,5 +37,13 @@
|
||||
"vuepress-theme-vdoing": "^1.12.9",
|
||||
"yamljs": "^0.3.0"
|
||||
},
|
||||
"dependencies": {}
|
||||
"dependencies": {},
|
||||
"resolutions": {
|
||||
"lodash": "^4.17.21",
|
||||
"lodash.template": "^4.5.0"
|
||||
},
|
||||
"overrides": {
|
||||
"lodash": "^4.17.21",
|
||||
"lodash.template": "^4.5.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user