d2767d7e by lxs

数据定价更新

1 parent 6d85f6b6
......@@ -53,7 +53,10 @@ const diseaseData: any = ref([]);
const qualityScoreData: any = ref({});
const disScore: any = ref([]);
const exportData: any = ref([]);
const dataUsage = ref('');
const dataUsage = ref({
field: '',
dictValue: ''
});
// 基础设置
const baseConfigFormRef = ref();
const baseConfigFormItems: any = ref([
......@@ -93,7 +96,6 @@ const baseConfigFormItems: any = ref([
placeholder: '',
field: 'belongingEntityGuid',
default: '',
options: [],
clearable: true,
disabled: true
},
......@@ -145,6 +147,7 @@ const setFormItems = (info = null) => {
datas = { ...datas, ...dData };
baseConfigFormItems.value.map(item => {
item.default = datas[item.field] || '';
item.label == '数据用途' && (dataUsage.value.dictValue = datas[item.field] || '');
})
nextTick(() => {
baseConfigFormRef.value.ruleFormRef?.clearValidate();
......@@ -256,7 +259,7 @@ const getDetail = () => {
const data = res.data || {};
flowDetail.value = data;
dataTransactionPrice.value = flowDetail.value.dataTransactionPrice;
dataUsage.value = data.dataUsage || '';
dataUsage.value.dictValue = data.dataUsage || '';
const mItem = typeMap.value.modelGuid.find(m => m.guid == flowDetail.value.modelGuid);
if (!mItem) {
const mtem = { guid: flowDetail.value.modelGuid, modelName: flowDetail.value.modelName };
......@@ -284,38 +287,38 @@ const getDataTypeList = () => {
)
}
}
const setFormItemData = () => {
let dictionaryList: any = [], diseaseList: any = [];
pricingTargetList.value.map(item => {
switch (item.targetType) {
case '2':
item.functionName == '2' && diseaseList.push(item);
break;
case '3':
dictionaryList.push(item);
break;
default:
break;
// 设置数据字典选项
const setDictFormItems = (dictList) => {
dictList.map(d => {
const dictName = d.dictionaryName;
const dictField = `dict_${d.guid}`;
baseConfigFormItems.value.push({
label: dictName,
type: 'select',
placeholder: '请输入',
field: dictField,
default: '',
options: [],
clearable: true,
filterable: true,
required: true,
});
baseConfigFormRules.value[dictField] = { required: true, trigger: 'change', message: `请选择${dictName}` };
dictName == '数据用途' && (dataUsage.value.field = dictField);
(() => {
if (typeMap.value[dictField] == undefined) {
getDataType(dictName, dictField)
} else {
let item = baseConfigFormItems.value.find(item => item.field == dictField);
item && (item.options = typeMap.value[dictField]);
}
})()
})
dictionaryData.value = dictionaryList;
diseaseData.value = diseaseList;
if (diseaseList.length) {
const diseaseName = flowDetail.value.diseaseName || '';
const modelGuid = flowDetail.value.modelGuid || '';
// 获取疾病得分
if (diseaseName && modelGuid) {
getTargetNum({ diseaseName, guid: modelGuid });
}
}
baseConfigFormItems.value.splice(4);
for (var r in baseConfigFormRules.value) {
if (r != 'modelGuid' && r != 'dataResourceGuid') {
delete baseConfigFormRules.value[r];
}
}
// 添加所属疾病
if (diseaseList.length > 0) {
}
// 设置疾病选项
const setDiseaseFormItems = () => {
baseConfigFormItems.value.push({
label: '所属疾病',
type: 'cascader',
......@@ -351,32 +354,67 @@ const setFormItemData = () => {
}
}
}
}
// 添加数据字典
dictionaryList.map(d => {
const dictName = d.dictionaryName;
const dictField = `dict_${d.guid}`;
}
// 设置内置指标选项
const setBuildInFormItems = (buildList) => {
buildList.map(b => {
const buildName = b.targetName;
const buildField = `build_${b.guid}`;
baseConfigFormItems.value.push({
label: dictName,
type: 'select',
placeholder: '请输入',
field: dictField,
default: '',
options: [],
label: buildName,
type: 'input',
placeholder: '',
field: buildField,
default: b.defaultValue || '',
clearable: true,
filterable: true,
required: true,
disabled: b.isInputParameter == 'Y'
});
baseConfigFormRules.value[dictField] = { required: true, trigger: 'change', message: `请选择${dictName}` };
(() => {
if (typeMap.value[dictField] == undefined) {
getDataType(dictName, dictField)
} else {
let item = baseConfigFormItems.value.find(item => item.field == dictField);
item && (item.options = typeMap.value[dictField]);
baseConfigFormRules.value[buildField] = { required: true, trigger: 'blur', message: `请填写${buildName}` };
})
};
// 添加表单选项数据
const setFormItemData = async () => {
let dictionaryList: any = [], diseaseList: any = [], buildInList: any = [];
pricingTargetList.value.map(item => {
switch (item.targetType) {
case '2':
item.functionName == '2' && diseaseList.push(item);
break;
case '3':
dictionaryList.push(item);
break;
case '1':
buildInList.push(item);
break;
default:
break;
}
})()
})
dictionaryData.value = dictionaryList;
diseaseData.value = diseaseList;
if (diseaseList.length) {
const diseaseName = flowDetail.value.diseaseName || '';
const modelGuid = flowDetail.value.modelGuid || '';
// 获取疾病得分
if (diseaseName && modelGuid) {
getTargetNum({ diseaseName, guid: modelGuid });
}
}
baseConfigFormItems.value.splice(4);
for (var r in baseConfigFormRules.value) {
if (r != 'modelGuid' && r != 'dataResourceGuid') {
delete baseConfigFormRules.value[r];
}
}
// 添加所属疾病
diseaseList.length > 0 && await setDiseaseFormItems();
// 添加数据字典
dictionaryList.length > 0 && await setDictFormItems(dictionaryList);
// 添加内置指标
buildInList.length > 0 && await setBuildInFormItems(buildInList);
setTimeout(() => {
baseConfigFormRef.value.ruleFormRef?.clearValidate();
}, 100)
......@@ -566,6 +604,22 @@ const getResourceInfo = (sGuid) => {
loading.value = false;
}
}
const matchTableFields = (rData, tData) => {
rData.dataFields.map(t => {
const match = tData.find(d => d.chName == t.fieldName);
if (match) {
t.chName = match.chName;
t.enName = match.enName;
}
})
rData.dataFieldsNum = rData.dataFields.filter(item => item.chName != '' && item.chName != null).length;
resourceTableFieldAllNum.value = tableData.value.reduce((accumulator, currentValue) => {
return accumulator + Number(currentValue.dataFieldsNum);
}, 0);
}
const setTableRowData = (dGuid, rIndex) => {
let rowData = tableData.value[rIndex];
if (guid && dGuid == rowData.dataTableGuid) {
......@@ -590,7 +644,86 @@ const setTableRowData = (dGuid, rIndex) => {
tableLoading.value = false;
if (res.code == proxy.$passCode) {
const data = res.data || {};
const damTableField = data.damCatalogTableField || [];
// const damTableField = data.damCatalogTableField || [];
const damTableField = [
{
"guid": "dec5a8a8b4bc4ba0b879105f89c1b245",
"tenantGuid": "f150638598f74d1bb2d9c542aaf2296c",
"relationMenuGuid": "4c2042543d3c413c851f483c3d5e854a",
"enName": "patient_id",
"chName": "编号",
"isRequired": "Y",
"orderNum": 1,
"bizState": "Y",
"createTime": "2025-07-01 13:09:46"
},
{
"guid": "28c1d258fca448e6b22f59c0c6e566e6",
"tenantGuid": "f150638598f74d1bb2d9c542aaf2296c",
"relationMenuGuid": "4c2042543d3c413c851f483c3d5e854a",
"enName": "patient_xm",
"chName": "姓名缩写",
"isRequired": "Y",
"orderNum": 4,
"bizState": "Y",
"createTime": "2025-07-01 13:09:46"
},
{
"guid": "08b27a077049434bbdee0c6ab51c8b1a",
"tenantGuid": "f150638598f74d1bb2d9c542aaf2296c",
"relationMenuGuid": "4c2042543d3c413c851f483c3d5e854a",
"enName": "patient_sj",
"chName": "时间",
"isRequired": "Y",
"orderNum": 5,
"bizState": "Y",
"createTime": "2025-07-01 13:09:46"
},
{
"guid": "a0d536a24fb64102acdd3f142f5eda77",
"tenantGuid": "f150638598f74d1bb2d9c542aaf2296c",
"relationMenuGuid": "4c2042543d3c413c851f483c3d5e854a",
"enName": "patient_sf",
"chName": "随访次数",
"isRequired": "Y",
"orderNum": 6,
"bizState": "Y",
"createTime": "2025-07-01 13:09:46"
},
{
"guid": "5402d6915458404aa59115fbff40c965",
"tenantGuid": "f150638598f74d1bb2d9c542aaf2296c",
"relationMenuGuid": "4c2042543d3c413c851f483c3d5e854a",
"enName": "patient_sg",
"chName": "身高",
"isRequired": "Y",
"orderNum": 7,
"bizState": "Y",
"createTime": "2025-07-01 13:09:46"
},
{
"guid": "752ee34845044ad2bbe30f5b738a1ef0",
"tenantGuid": "f150638598f74d1bb2d9c542aaf2296c",
"relationMenuGuid": "4c2042543d3c413c851f483c3d5e854a",
"enName": "patient_igf",
"chName": "IGF-1",
"isRequired": "Y",
"orderNum": 8,
"bizState": "Y",
"createTime": "2025-07-01 13:09:46"
},
{
"guid": "8dce74c208184f958f0ac8587fe66839",
"tenantGuid": "f150638598f74d1bb2d9c542aaf2296c",
"relationMenuGuid": "4c2042543d3c413c851f483c3d5e854a",
"enName": "patient_tz",
"chName": "体重",
"isRequired": "Y",
"orderNum": 8,
"bizState": "Y",
"createTime": "2025-07-01 13:09:46"
}
];
const damFieldOptions = damTableField.map(d => {
return {
...d,
......@@ -600,16 +733,9 @@ const setTableRowData = (dGuid, rIndex) => {
})
rowData.dataFields.map(t => {
t.damFieldTable = JSON.parse(JSON.stringify(damFieldOptions));
const match = damFieldOptions.find(d => d.chName == t.fieldName);
if (match) {
t.chName = match.chName;
t.enName = match.enName;
}
})
rowData.dataFieldsNum = rowData.dataFields.filter(item => item.chName != '' && item.chName != null).length;
resourceTableFieldAllNum.value = tableData.value.reduce((accumulator, currentValue) => {
return accumulator + Number(currentValue.dataFieldsNum);
}, 0);
// 匹配
!guid && matchTableFields(rowData, damTableField);
// console.log('rowData', rowData)
} else {
proxy.$ElMessage.error(res.msg);
......@@ -629,6 +755,7 @@ const changeDatasource = () => {
}
})
}
const cascaderChange = (val) => {
disScore.value = [];
if (val) {
......@@ -663,6 +790,9 @@ const selectChange = async (val, row, info) => {
} else {
changeDatasource();
}
} else if (row.field == dataUsage.value.field) {
dataUsage.value.dictValue = val || '';
setFormItems(info);
} else if (row.field == 'dataTableGuid') {
setTableRowData(val, info.$index)
} else if (row.field == 'chName') {
......@@ -721,6 +851,7 @@ const toPath = () => {
name: 'priceCalculate',
})
}
// 获取维度公式计算结果
const getSignatory = (row) => {
let formulaVal = 0;
......@@ -790,7 +921,7 @@ const reporting = (formInfo) => {
tNum = parseFloat(dictionary?.value || t.defaultValue || 0);
tCustomize = `默认值${parseFloat(dictionary?.value || t.defaultValue || 0)}`;
}
t.dictionaryName == '数据用途' && (dataUsage.value = pVal.value || '');
t.dictionaryName == '数据用途' && (dataUsage.value.dictValue = pVal.value || '');
}
} else if (t.targetType == '2') {// 指标类型-系统功能
if (t.functionName == '1') { // 功能名称-质量评价模型
......@@ -925,7 +1056,7 @@ const getCalculateParams = (baseConfigFormObj, baseConfigFormInfo) => {
belongingTheme: baseConfigFormInfo.belongingTheme,
diseaseGuid,
diseaseName: '',
dataUsage: dataUsage.value
dataUsage: dataUsage.value.dictValue
};
if (diseaseGuid) {
const parentsData = baseConfigFormObj.getCascaderCheckedData();
......@@ -970,7 +1101,6 @@ const getCalculatPrice = async (params) => {
loading.value = false;
if (res.code === proxy.$passCode) {
const data = res.data || {};
console.log('getCalculatPrice', data);
return data; // 返回计算结果以便后续使用
} else {
proxy.$ElMessage.error(res.msg);
......
......@@ -222,7 +222,7 @@ const signatoryFormItems: any = ref([
placeholder: '请输入',
field: 'weight',
default: '',
inputType: 'factorNumber',
inputType: 'scoreNumber',
maxlength: 10,
clearable: true,
},
......@@ -314,7 +314,7 @@ const targetFormItems: any = ref([
placeholder: '请输入',
field: 'weight',
default: '',
inputType: 'factorNumber',
inputType: 'scoreNumber',
maxlength: 10,
clearable: true,
required: true,
......@@ -354,7 +354,7 @@ const targetFormItems: any = ref([
placeholder: '请输入',
field: 'defaultValue',
default: '',
inputType: 'factorNumber',
inputType: 'moneyNumber',
maxlength: 18,
clearable: true,
required: false
......@@ -548,35 +548,44 @@ const drawerInfo: any = ref({
});
const setTableField = (data) => {
tableData.value = [];
const dictionaryName = typeMap.value['dictionaryType'].find(item => item.value == dictionaryType.value)?.label || '';
const dictionaryJson = dictionaryName && dictionaryName == currTableData.value.dictionaryName ? (currTableData.value.dictionaryJson || []) : [];
// if (dictionaryType.value == '1') {
// const tData = JSON.parse(JSON.stringify(mergeTableData));
// tableData.value = [];
// const dictionaryName = typeMap.value['dictionaryType'].find(item => item.value == dictionaryType.value)?.label || '';
// const dictionaryJson = dictionaryName && dictionaryName == currTableData.value.dictionaryName ? (currTableData.value.dictionaryJson || []) : [];
// if (dictionaryJson.length) {
// tData.map((item, i) => {
// item.factor = dictionaryJson[i]?.value || '';
// dictionaryJson.map(item => {
// tableData.value.push({
// label: item.name,
// factor: item.value || '',
// })
// })
// }
// tableData.value = tData;
// getMergeRow();
// } else {
// data.map((item: any) => {
// tableData.value.push({
// label: item.label,
// factor: '',
// })
// })
// }
tableData.value = [];
const dictionaryName = typeMap.value['dictionaryType'].find(item => item.value == dictionaryType.value)?.label || '';
const dictionaryJson = dictionaryName && dictionaryName == currTableData.value.dictionaryName ? (currTableData.value.dictionaryJson || []) : [];
// 创建已有数据的映射表,以 label 为键
const existingDataMap = {};
if (dictionaryJson.length) {
dictionaryJson.map(item => {
tableData.value.push({
label: item.name,
factor: item.value || '',
})
})
} else {
data.map((item: any) => {
dictionaryJson.forEach(item => {
existingDataMap[item.name] = item.value || '';
});
}
// 遍历最新数据,如果有匹配的已有数据则使用其值
data.forEach((item: any) => {
tableData.value.push({
label: item.label,
factor: '',
})
})
}
// }
factor: existingDataMap[item.label] || '', // 使用已有值或空字符串
});
});
}
const getDictionaryRuleData = () => {
......@@ -833,6 +842,7 @@ const selectChange = async (val, row, info) => {
await setFormItems(tInfo, 'target');
if (row.field == 'targetType') {
targetFormItems.value[3].default = val == '1' ? 'N' : 'Y';
targetFormItems.value[4].default = val == '1' ? 'N' : 'Y';
}
}
}
......@@ -1265,30 +1275,6 @@ onMounted(() => {
<template v-if="showFactorTable">
<span class="required_mark" style="line-height: 21px;">字典值对应因子</span>
<div class="table_panel">
<!-- <el-table border :data="tableData" :span-method="tableSpanMethod" tooltip-effect="light" style="height: 100%;"
v-if="dictionaryType == '1'">
<el-table-column label="医院等级">
<el-table-column prop="level" label="级别" width="100" />
<el-table-column prop="grade" label="等次" width="100" />
</el-table-column>
<el-table-column prop="factor" label="因子" class-name="edit-col">
<template #default="scope">
<el-input v-model="scope.row.factor" placeholder="请输入"
@change="(val) => inputChange(val, scope, 'factor')"
@input="(val) => inputEventChange(val, scope, 'factor')" />
</template>
</el-table-column>
</el-table>
<el-table border :data="tableData" tooltip-effect="light" style="height: 100%;" v-else>
<el-table-column label="字典名称" prop="label" width="140" />
<el-table-column prop="factor" label="因子" class-name="edit-col">
<template #default="scope">
<el-input v-model="scope.row.factor" placeholder="请输入"
@change="(val) => inputChange(val, scope, 'factor')"
@input="(val) => inputEventChange(val, scope, 'factor')" />
</template>
</el-table-column>
</el-table> -->
<el-table border :data="tableData" tooltip-effect="light" style="height: 100%;">
<el-table-column label="字典名称" prop="label" width="140" />
<el-table-column prop="factor" label="因子" class-name="edit-col">
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!