|
|
|
@ -30,7 +30,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div id="tableData" style="padding: 15px;background-color: #fff;border-radius: 8px;"> |
|
|
|
<el-table :data="tableData" :row-class-name="importRowClassName" |
|
|
|
<el-table :data="tableData" :row-class-name="importRowClassName" |
|
|
|
:height="window.pageHeight < 600 ? 440 : (window.pageHeight - 210)" highlight-current-row size="small" |
|
|
|
:summary-method="getSummaries" show-summary> |
|
|
|
<el-table-column type="index" label="序号" width="40" align="center" /> |
|
|
|
@ -64,12 +64,12 @@ |
|
|
|
|
|
|
|
<el-dialog title="选择文件" :visible.sync="dialogGroup.fileChoose" width="700px" :show-close="false" |
|
|
|
:append-to-body="true" :close-on-click-modal="false"> |
|
|
|
<div style="height:400px;padding: 0 50px; "> |
|
|
|
<div style="height:400px;padding: 0 50px;"> |
|
|
|
<!-- webkitdirectory 选择文件属性, multiple 多选属性--> |
|
|
|
<div><input id="fileNames" type="file" accept=".xlsx,.xls" @change="changeFileChoose" @focus="fileGetFocus" /> |
|
|
|
</div> |
|
|
|
<div style="margin: 5px 70px;width:240px;"> |
|
|
|
<el-table :data="sheetNames" border ref="sheetNames" height="200" row-click="chooseSheetName" |
|
|
|
<el-table :data="sheetNames" border ref="sheetNames" height="260" row-click="chooseSheetName" |
|
|
|
highlight-current-row size="small"> |
|
|
|
<el-table-column prop="sheetName" label="Excel表单名" min-width="200" align="center" /> |
|
|
|
</el-table> |
|
|
|
@ -79,13 +79,13 @@ |
|
|
|
<el-input type="number" v-model="readDataOpts.titleRow" size="small" style="width:60px;margin: 0 5px;" /> |
|
|
|
<span style="margin-top: 6px;">行</span> |
|
|
|
</div> |
|
|
|
<div style="display: flex;flex-wrap: wrap;"> |
|
|
|
<span style="margin-top: 6px;">Excel结果排列方式:</span> |
|
|
|
<div style="margin-top: 7px;display: flex;flex-wrap: wrap;"> |
|
|
|
<span style="margin-top: -1px;">Excel结果排列方式:</span> |
|
|
|
<el-radio v-model="readDataOpts.resultMode" label="V">纵向排列</el-radio> |
|
|
|
<el-radio v-model="readDataOpts.resultMode" label="H">横向排列</el-radio> |
|
|
|
</div> |
|
|
|
<div style="display: flex;flex-wrap: wrap;"> |
|
|
|
<span style="margin-top: 6px;">条码方式:</span> |
|
|
|
<div style="margin-top: 7px;display: flex;flex-wrap: wrap;"> |
|
|
|
<span style="margin-top: -1px;">条码方式:</span> |
|
|
|
<el-radio v-model="dataImportOpts.barcodeMode" label="0">人员条码</el-radio> |
|
|
|
<el-radio v-model="dataImportOpts.barcodeMode" label="1">项目条码</el-radio> |
|
|
|
</div> |
|
|
|
@ -95,7 +95,8 @@ |
|
|
|
:picker-options="pickerOptions" value-format="yyyy-MM-dd HH:mm:ss" style="width:160px;" size="small"> |
|
|
|
</el-date-picker> |
|
|
|
<span style="margin-top: 6px;">标本间隔时间:</span> |
|
|
|
<el-input type="number" v-model="dataImportOpts.checkInterval" size="small" style="width:60px;margin: 0 5px;"> |
|
|
|
<el-input type="number" v-model="dataImportOpts.checkInterval" size="small" |
|
|
|
style="width:60px;margin: 0 5px;"> |
|
|
|
<template slot="append">秒</template> |
|
|
|
</el-input> |
|
|
|
</div> |
|
|
|
@ -143,7 +144,7 @@ |
|
|
|
</div> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 通用进度条 --> |
|
|
|
<el-dialog title="数据处理中……" :visible.sync="elProgress.display" width="700px" height="400" :show-close="false" |
|
|
|
:close-on-click-modal="false" :append-to-body="true"> |
|
|
|
@ -169,7 +170,7 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
|
|
|
|
|
|
|
|
startPoint: -1, // 多选起点 -1 表示未选择 |
|
|
|
endPoint: -1, // 多选终点 -1 表示未选择 |
|
|
|
rClickRow: null, //右击的行 |
|
|
|
@ -182,12 +183,12 @@ export default { |
|
|
|
}, |
|
|
|
oldSeq: -2, //旧的步骤(辅助区分上一步,下一步) |
|
|
|
seq: 10, //当前显示窗口 |
|
|
|
|
|
|
|
|
|
|
|
excelCols: [{ dispLabel: '', val: '', dataLabel: '' }], //excel数据列名 {dispLabel:'',val:'',dataLabel:''} |
|
|
|
importCols: [], // 实际导入的列(即有设置与 dataCols 匹配的列) |
|
|
|
excelData: [], // excel表格数据 |
|
|
|
choosedData: [], // 选中的待导入的数据 |
|
|
|
|
|
|
|
toApiBodys: [], // api需要的数据格式 |
|
|
|
dataCols: [ |
|
|
|
{ dispLabel: '不设置', val: '' }, |
|
|
|
{ dispLabel: '条码号', val: 'barcode' }, |
|
|
|
@ -198,7 +199,8 @@ export default { |
|
|
|
{ dispLabel: '项目', val: 'itemName' }, |
|
|
|
{ dispLabel: '结果', val: 'itemResult' } |
|
|
|
], |
|
|
|
|
|
|
|
preBarcode: '', // 上一人条码号 |
|
|
|
curCheckDate: '', // 当前检查时间 |
|
|
|
|
|
|
|
tableData: [], //导入数据状态显示 |
|
|
|
|
|
|
|
@ -212,14 +214,13 @@ export default { |
|
|
|
}, |
|
|
|
readDataOptsInit: {}, |
|
|
|
|
|
|
|
dataImportOpts: { |
|
|
|
startRow: 0, //从 excelData 的第几行开始导入 |
|
|
|
dataImportOpts: { |
|
|
|
barcodeMode: '1', // 条码方式: '0'/人员条码;'1'/项目条码 |
|
|
|
startCheckDate:'', // 检查起始时间 |
|
|
|
checkInterval:30, // 标本间隔时间(秒) |
|
|
|
startCheckDate: '', // 检查起始时间 |
|
|
|
checkInterval: 30, // 标本间隔时间(秒) |
|
|
|
}, |
|
|
|
dataImportOptsInit: {}, |
|
|
|
|
|
|
|
dataImportOptsInit: {}, |
|
|
|
|
|
|
|
pickerOptions: { |
|
|
|
shortcuts: [{ |
|
|
|
text: '今天', |
|
|
|
@ -255,7 +256,7 @@ export default { |
|
|
|
|
|
|
|
//组件创建完成,一般页面初始布局放在这里 |
|
|
|
created() { |
|
|
|
this.seq = 10 |
|
|
|
this.seq = 10 |
|
|
|
this.readDataOptsInit = Object.assign({}, this.readDataOpts) |
|
|
|
this.dataImportOptsInit = Object.assign({}, this.dataImportOpts) |
|
|
|
}, |
|
|
|
@ -288,10 +289,6 @@ export default { |
|
|
|
this.readDataOpts = Object.assign({}, this.readDataOptsInit) |
|
|
|
this.dataImportOpts = Object.assign({}, this.dataImportOptsInit) |
|
|
|
|
|
|
|
this.customerOrgIds = [] //选中单位节点 |
|
|
|
this.customerOrgRegisterList = [] //体检次数列表 |
|
|
|
this.customerOrgRegister = {} //体检次数 |
|
|
|
|
|
|
|
this.startPoint = -1 // 多选起点 -1 表示未选择 |
|
|
|
this.endPoint = -1 // 多选终点 -1 表示未选择 |
|
|
|
|
|
|
|
@ -326,10 +323,10 @@ export default { |
|
|
|
this.dialogGroup[e] = false |
|
|
|
}) |
|
|
|
this.clearProcess() |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 10: |
|
|
|
this.excelCols = [] |
|
|
|
this.tableData = [] |
|
|
|
this.tableData = [] |
|
|
|
this.startPoint = -1 // 多选起点 -1 表示未选择 |
|
|
|
this.endPoint = -1 // 多选终点 -1 表示未选择 |
|
|
|
//显示 EXCEL 导入 |
|
|
|
@ -359,8 +356,24 @@ export default { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//显示 数据分析操作 窗口 |
|
|
|
|
|
|
|
if (!this.dataImportOpts.startCheckDate) { |
|
|
|
this.$message.warning({ showClose: true, message: '请选择起始检查时间' }) |
|
|
|
break; |
|
|
|
} |
|
|
|
if (!this.dataImportOpts.checkInterval) { |
|
|
|
this.$message.warning({ showClose: true, message: '请填写标本间隔时间' }) |
|
|
|
break; |
|
|
|
} else { |
|
|
|
try { |
|
|
|
Number(this.dataImportOpts.checkInterval) |
|
|
|
} catch (error) { |
|
|
|
this.$message.warning({ showClose: true, message: '标本间隔时间只能填写数字' }) |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
keys.forEach(e => { |
|
|
|
if (e == 'fileDataOpr') { |
|
|
|
this.dialogGroup[e] = true |
|
|
|
@ -388,7 +401,7 @@ export default { |
|
|
|
this.dialogGroup[e] = false |
|
|
|
} |
|
|
|
}) |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
@ -636,12 +649,14 @@ export default { |
|
|
|
let items = [] //菜单 |
|
|
|
|
|
|
|
this.dataCols.forEach(e => { |
|
|
|
items.push({ |
|
|
|
label: e.dispLabel, |
|
|
|
onClick: () => { |
|
|
|
this.setColumn(chooseCol, e) |
|
|
|
}, |
|
|
|
}) |
|
|
|
if (!(this.readDataOpts.resultMode == 'H' && (e.val == 'itemResult' || e.val == 'itemName'))) { |
|
|
|
items.push({ |
|
|
|
label: e.dispLabel, |
|
|
|
onClick: () => { |
|
|
|
this.setColumn(chooseCol, e) |
|
|
|
}, |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
//右击显示的菜单 |
|
|
|
@ -695,7 +710,7 @@ export default { |
|
|
|
|
|
|
|
// 确定导入数据库 |
|
|
|
btnImport() { |
|
|
|
|
|
|
|
|
|
|
|
this.elProgress.display = true; |
|
|
|
this.elProgress.percentage = 0; |
|
|
|
|
|
|
|
@ -711,61 +726,150 @@ export default { |
|
|
|
if (e.choosed) this.choosedData.push(e) |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//导入进行中 |
|
|
|
this.importing(this.dataImportOpts.startRow) |
|
|
|
this.importing() |
|
|
|
// 开始导入时,清除选择的 文件 |
|
|
|
document.getElementById('fileNames').value = ''; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//导入进行时 |
|
|
|
// startRow : 从第几行开始导入 |
|
|
|
async importing(startRow) { |
|
|
|
let body = {} |
|
|
|
for (let i = startRow; i < this.choosedData.length; i++) { |
|
|
|
async importing() { |
|
|
|
|
|
|
|
// 将Excel的数据转换成接口的数据 |
|
|
|
this.excelDataToApiBodys(this.choosedData) |
|
|
|
console.log('this.toApiBodys', this.toApiBodys) |
|
|
|
|
|
|
|
// 旧接口:/api/app/patientregister/createpatientregisterexcel |
|
|
|
for (let i = 0; i < this.toApiBodys.length; i++) { |
|
|
|
this.elProgress.percentage = Math.floor( |
|
|
|
((i + 1) * 100) / this.choosedData.length |
|
|
|
); |
|
|
|
|
|
|
|
// 将Excel的数据转换成接口的数据 |
|
|
|
body = this.excelDataToApiBody(this.choosedData[i]) |
|
|
|
console.log(`this.choosedData[${i}],body`,this.choosedData[i],body) |
|
|
|
|
|
|
|
// 旧接口:/api/app/patientregister/createpatientregisterexcel |
|
|
|
let res = await postapi('/api/app/patientregister/CreatePatientRegisterFromExcel', body) |
|
|
|
this.choosedSameMan = {} // 清除选择同一人员的记录 |
|
|
|
let res = await postapi('/api/app/patientregister/CreatePatientRegisterFromExcel', this.toApiBodys[i]) |
|
|
|
if (res.code >= 0) { |
|
|
|
this.tableData.push(Object.assign({ importState: '导入成功' }, this.choosedData[i])) |
|
|
|
this.tableData.push(Object.assign({ importState: '导入成功' }, this.toApiBodys[i])) |
|
|
|
} else { |
|
|
|
this.tableData.push(Object.assign({ importState: '导入失败', importDes: res.message }, this.choosedData[i])) |
|
|
|
} |
|
|
|
|
|
|
|
// 结束导入 |
|
|
|
if (i == this.choosedData.length - 1) { |
|
|
|
this.elProgress.display = false; |
|
|
|
this.seq = -1 |
|
|
|
this.tableData.push(Object.assign({ importState: '导入失败', importDes: res.message }, this.toApiBodys[i])) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 结束导入 |
|
|
|
this.elProgress.display = false; |
|
|
|
this.seq = -1 |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//将Excel的数据转换成接口的数据 |
|
|
|
excelDataToApiBodys(ExcelAllChoosedData) { |
|
|
|
this.toApiBodys = [] |
|
|
|
ExcelAllChoosedData.forEach(e => { |
|
|
|
this.excelDataToApiBody(e) |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
//将Excel的数据转换成接口的数据 |
|
|
|
excelDataToApiBody(ExcelData) { |
|
|
|
console.log('ExcelData,this.excelCols', ExcelData, this.excelCols) |
|
|
|
let body = { |
|
|
|
customerOrgId: this.customerOrgIds[this.customerOrgIds.length - 1], |
|
|
|
customerOrgRegisterId: this.customerOrgRegister.id, |
|
|
|
medicalCenterId: this.peisid, |
|
|
|
completeFlag: this.dataImportOpts.completeFlag, |
|
|
|
cardStartNum: this.dataImportOpts.cardStartNum, |
|
|
|
cardLength: this.dataImportOpts.cardLength |
|
|
|
barcodeMode: this.dataImportOpts.barcodeMode |
|
|
|
} |
|
|
|
// 纵向数据 |
|
|
|
if (this.readDataOpts.resultMode == 'V') { |
|
|
|
|
|
|
|
this.excelCols.forEach(e => { |
|
|
|
if (e.val) { |
|
|
|
switch (e.val) { |
|
|
|
// case 'age': |
|
|
|
// if (ExcelData[e.dispLabel]) body[e.val] = parseInt(ExcelData[e.dispLabel]) |
|
|
|
// break; |
|
|
|
// case 'birthDate': |
|
|
|
// if(ExcelData[e.dispLabel]) body[e.val] = moment(new Date(ExcelData[e.dispLabel])).format('yyyy-MM-DD') |
|
|
|
// break; |
|
|
|
// case 'poisons': |
|
|
|
// if (ExcelData[e.dispLabel]) body[e.val] = ExcelData[e.dispLabel].replaceAll(",", ",").split(",") |
|
|
|
// break; |
|
|
|
default: |
|
|
|
body[e.val] = ExcelData[e.dispLabel] |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
if (!body.checkDate) { |
|
|
|
// console.log('body.checkDate,this.preBarcode,this.curCheckDate',body.checkDate,this.preBarcode,this.curCheckDate) |
|
|
|
if (!this.preBarcode) { |
|
|
|
this.preBarcode = body.barcode |
|
|
|
this.curCheckDate = this.dataImportOpts.startCheckDate |
|
|
|
} |
|
|
|
|
|
|
|
if (this.preBarcode != body.barcode) { |
|
|
|
this.preBarcode = body.barcode |
|
|
|
this.curCheckDate = moment(new Date(new Date(this.curCheckDate).getTime() + Number(this.dataImportOpts.checkInterval) * 1000)).format('yyyy-MM-DD HH:mm:ss') |
|
|
|
} |
|
|
|
body.checkDate = this.curCheckDate |
|
|
|
} |
|
|
|
if (body.deviceChannel == undefined) delete body.deviceChannel |
|
|
|
if (body.sampleNo == undefined) delete body.sampleNo |
|
|
|
|
|
|
|
let lfind = arrayExistObj(this.toApiBodys,'barcode',body.barcode) |
|
|
|
if(lfind == -1){ |
|
|
|
this.toApiBodys.push(Object.assign({},body,{details:[{ itemName: body.itemName, itemResult: body.itemResult, checkDate: body.checkDate }]})) |
|
|
|
}else{ |
|
|
|
this.toApiBodys[this.toApiBodys.length - 1].details.push({ itemName: body.itemName, itemResult: body.itemResult, checkDate: body.checkDate }) |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 横向数据 |
|
|
|
// { dataLabel: "", dispLabel: "P LCR", val: "" } |
|
|
|
body = { |
|
|
|
barcode: ExcelData['条码号'], |
|
|
|
barcodeMode: this.dataImportOpts.barcodeMode, |
|
|
|
patientName: ExcelData['姓名'], |
|
|
|
sampleNo: ExcelData['标本号'], |
|
|
|
deviceChannel: ExcelData['仪器通道'], |
|
|
|
checkDate: ExcelData['检查时间'], |
|
|
|
details: [] |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!body.checkDate) { |
|
|
|
// console.log('body.checkDate,this.preBarcode,this.curCheckDate',body.checkDate,this.preBarcode,this.curCheckDate) |
|
|
|
if (!this.preBarcode) { |
|
|
|
this.preBarcode = body.barcode |
|
|
|
this.curCheckDate = this.dataImportOpts.startCheckDate |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return body |
|
|
|
if (this.preBarcode != body.barcode) { |
|
|
|
this.preBarcode = body.barcode |
|
|
|
this.curCheckDate = moment(new Date(new Date(this.curCheckDate).getTime() + Number(this.dataImportOpts.checkInterval) * 1000)).format('yyyy-MM-DD HH:mm:ss') |
|
|
|
} |
|
|
|
body.checkDate = this.curCheckDate |
|
|
|
} |
|
|
|
|
|
|
|
if (body.deviceChannel == undefined) delete body.deviceChannel |
|
|
|
if (body.sampleNo == undefined) delete body.sampleNo |
|
|
|
// [ |
|
|
|
// { dispLabel: '条码号', val: 'barcode' }, |
|
|
|
// { dispLabel: '姓名', val: 'patientName' }, |
|
|
|
// { dispLabel: '标本号', val: 'sampleNo' }, |
|
|
|
// { dispLabel: '仪器通道', val: 'deviceChannel' }, |
|
|
|
// { dispLabel: '检查时间', val: 'checkDate' }, |
|
|
|
// { dispLabel: '项目', val: 'itemName' }, |
|
|
|
// { dispLabel: '结果', val: 'itemResult' } |
|
|
|
// ] |
|
|
|
this.excelCols.forEach(e => { |
|
|
|
if (!e.dataLabel && !e.val) { |
|
|
|
body.details.push({ itemName: e.dispLabel, itemResult: ExcelData[e.dispLabel], checkDate: body.checkDate }) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.toApiBodys.push(body) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//选择要导入的数据 |
|
|
|
rowClickPrList(row) { |
|
|
|
// console.log("this.excelData",this.excelData); |
|
|
|
|