Browse Source

import

master
pengjun 1 year ago
parent
commit
f6d81adfd7
  1. 6
      src/views/basic-dictionary/ThirdPartyInterfaces.vue
  2. 206
      src/views/doctorCheck/lisResultImport.vue

6
src/views/basic-dictionary/ThirdPartyInterfaces.vue

@ -386,6 +386,12 @@ export default {
},{
id:"08",
displayName:"心电图结果导入"
},{
id:"09",
displayName:"同步组合项目价格"
},{
id:"10",
displayName:"短信推送"
}]
}
},

206
src/views/doctorCheck/lisResultImport.vue

@ -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>
@ -187,7 +188,7 @@ export default {
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: [], //
@ -213,10 +215,9 @@ export default {
readDataOptsInit: {},
dataImportOpts: {
startRow: 0, // excelData
barcodeMode: '1', // '0'/'1'/
startCheckDate:'', //
checkInterval:30, //
startCheckDate: '', //
checkInterval: 30, //
},
dataImportOptsInit: {},
@ -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
@ -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
@ -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)
},
})
}
})
//
@ -711,58 +726,147 @@ 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]))
this.tableData.push(Object.assign({ importState: '导入失败', importDes: res.message }, this.toApiBodys[i]))
}
//
if (i == this.choosedData.length - 1) {
this.elProgress.display = false;
this.seq = -1
}
}
},
//
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
}
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
}
return body
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)
}
},

Loading…
Cancel
Save