Browse Source

import

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

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

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

234
src/views/doctorCheck/lisResultImport.vue

@ -30,7 +30,7 @@
</div> </div>
</div> </div>
<div id="tableData" style="padding: 15px;background-color: #fff;border-radius: 8px;"> <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" :height="window.pageHeight < 600 ? 440 : (window.pageHeight - 210)" highlight-current-row size="small"
:summary-method="getSummaries" show-summary> :summary-method="getSummaries" show-summary>
<el-table-column type="index" label="序号" width="40" align="center" /> <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" <el-dialog title="选择文件" :visible.sync="dialogGroup.fileChoose" width="700px" :show-close="false"
:append-to-body="true" :close-on-click-modal="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 多选属性--> <!-- webkitdirectory 选择文件属性 multiple 多选属性-->
<div><input id="fileNames" type="file" accept=".xlsx,.xls" @change="changeFileChoose" @focus="fileGetFocus" /> <div><input id="fileNames" type="file" accept=".xlsx,.xls" @change="changeFileChoose" @focus="fileGetFocus" />
</div> </div>
<div style="margin: 5px 70px;width:240px;"> <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"> highlight-current-row size="small">
<el-table-column prop="sheetName" label="Excel表单名" min-width="200" align="center" /> <el-table-column prop="sheetName" label="Excel表单名" min-width="200" align="center" />
</el-table> </el-table>
@ -79,13 +79,13 @@
<el-input type="number" v-model="readDataOpts.titleRow" size="small" style="width:60px;margin: 0 5px;" /> <el-input type="number" v-model="readDataOpts.titleRow" size="small" style="width:60px;margin: 0 5px;" />
<span style="margin-top: 6px;"></span> <span style="margin-top: 6px;"></span>
</div> </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="V">纵向排列</el-radio>
<el-radio v-model="readDataOpts.resultMode" label="H">横向排列</el-radio> <el-radio v-model="readDataOpts.resultMode" label="H">横向排列</el-radio>
</div> </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="0">人员条码</el-radio>
<el-radio v-model="dataImportOpts.barcodeMode" label="1">项目条码</el-radio> <el-radio v-model="dataImportOpts.barcodeMode" label="1">项目条码</el-radio>
</div> </div>
@ -95,7 +95,8 @@
:picker-options="pickerOptions" value-format="yyyy-MM-dd HH:mm:ss" style="width:160px;" size="small"> :picker-options="pickerOptions" value-format="yyyy-MM-dd HH:mm:ss" style="width:160px;" size="small">
</el-date-picker> </el-date-picker>
<span style="margin-top: 6px;">标本间隔时间</span> <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> <template slot="append"></template>
</el-input> </el-input>
</div> </div>
@ -143,7 +144,7 @@
</div> </div>
</span> </span>
</el-dialog> </el-dialog>
<!-- 通用进度条 --> <!-- 通用进度条 -->
<el-dialog title="数据处理中……" :visible.sync="elProgress.display" width="700px" height="400" :show-close="false" <el-dialog title="数据处理中……" :visible.sync="elProgress.display" width="700px" height="400" :show-close="false"
:close-on-click-modal="false" :append-to-body="true"> :close-on-click-modal="false" :append-to-body="true">
@ -169,7 +170,7 @@ export default {
}, },
data() { data() {
return { return {
startPoint: -1, // -1 startPoint: -1, // -1
endPoint: -1, // -1 endPoint: -1, // -1
rClickRow: null, // rClickRow: null, //
@ -182,12 +183,12 @@ export default {
}, },
oldSeq: -2, // oldSeq: -2, //
seq: 10, // seq: 10, //
excelCols: [{ dispLabel: '', val: '', dataLabel: '' }], //excel {dispLabel:'',val:'',dataLabel:''} excelCols: [{ dispLabel: '', val: '', dataLabel: '' }], //excel {dispLabel:'',val:'',dataLabel:''}
importCols: [], // dataCols importCols: [], // dataCols
excelData: [], // excel excelData: [], // excel
choosedData: [], // choosedData: [], //
toApiBodys: [], // api
dataCols: [ dataCols: [
{ dispLabel: '不设置', val: '' }, { dispLabel: '不设置', val: '' },
{ dispLabel: '条码号', val: 'barcode' }, { dispLabel: '条码号', val: 'barcode' },
@ -198,7 +199,8 @@ export default {
{ dispLabel: '项目', val: 'itemName' }, { dispLabel: '项目', val: 'itemName' },
{ dispLabel: '结果', val: 'itemResult' } { dispLabel: '结果', val: 'itemResult' }
], ],
preBarcode: '', //
curCheckDate: '', //
tableData: [], // tableData: [], //
@ -212,14 +214,13 @@ export default {
}, },
readDataOptsInit: {}, readDataOptsInit: {},
dataImportOpts: {
startRow: 0, // excelData
dataImportOpts: {
barcodeMode: '1', // '0'/'1'/ barcodeMode: '1', // '0'/'1'/
startCheckDate:'', //
checkInterval:30, //
startCheckDate: '', //
checkInterval: 30, //
}, },
dataImportOptsInit: {},
dataImportOptsInit: {},
pickerOptions: { pickerOptions: {
shortcuts: [{ shortcuts: [{
text: '今天', text: '今天',
@ -255,7 +256,7 @@ export default {
// //
created() { created() {
this.seq = 10
this.seq = 10
this.readDataOptsInit = Object.assign({}, this.readDataOpts) this.readDataOptsInit = Object.assign({}, this.readDataOpts)
this.dataImportOptsInit = Object.assign({}, this.dataImportOpts) this.dataImportOptsInit = Object.assign({}, this.dataImportOpts)
}, },
@ -288,10 +289,6 @@ export default {
this.readDataOpts = Object.assign({}, this.readDataOptsInit) this.readDataOpts = Object.assign({}, this.readDataOptsInit)
this.dataImportOpts = Object.assign({}, this.dataImportOptsInit) this.dataImportOpts = Object.assign({}, this.dataImportOptsInit)
this.customerOrgIds = [] //
this.customerOrgRegisterList = [] //
this.customerOrgRegister = {} //
this.startPoint = -1 // -1 this.startPoint = -1 // -1
this.endPoint = -1 // -1 this.endPoint = -1 // -1
@ -326,10 +323,10 @@ export default {
this.dialogGroup[e] = false this.dialogGroup[e] = false
}) })
this.clearProcess() this.clearProcess()
break;
break;
case 10: case 10:
this.excelCols = [] this.excelCols = []
this.tableData = []
this.tableData = []
this.startPoint = -1 // -1 this.startPoint = -1 // -1
this.endPoint = -1 // -1 this.endPoint = -1 // -1
// EXCEL // EXCEL
@ -359,8 +356,24 @@ export default {
break; 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 => { keys.forEach(e => {
if (e == 'fileDataOpr') { if (e == 'fileDataOpr') {
this.dialogGroup[e] = true this.dialogGroup[e] = true
@ -388,7 +401,7 @@ export default {
this.dialogGroup[e] = false this.dialogGroup[e] = false
} }
}) })
break;
break;
default: default:
@ -636,12 +649,14 @@ export default {
let items = [] // let items = [] //
this.dataCols.forEach(e => { 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() { btnImport() {
this.elProgress.display = true; this.elProgress.display = true;
this.elProgress.percentage = 0; this.elProgress.percentage = 0;
@ -711,61 +726,150 @@ export default {
if (e.choosed) this.choosedData.push(e) if (e.choosed) this.choosedData.push(e)
}); });
// //
this.importing(this.dataImportOpts.startRow)
this.importing()
// //
document.getElementById('fileNames').value = ''; 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( this.elProgress.percentage = Math.floor(
((i + 1) * 100) / this.choosedData.length ((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) { if (res.code >= 0) {
this.tableData.push(Object.assign({ importState: '导入成功' }, this.choosedData[i]))
this.tableData.push(Object.assign({ importState: '导入成功' }, this.toApiBodys[i]))
} else { } 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 //Excel
excelDataToApiBody(ExcelData) { excelDataToApiBody(ExcelData) {
console.log('ExcelData,this.excelCols', ExcelData, this.excelCols)
let body = { 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) { rowClickPrList(row) {
// console.log("this.excelData",this.excelData); // console.log("this.excelData",this.excelData);

Loading…
Cancel
Save