Browse Source

import

master
pengjun 2 years ago
parent
commit
23a0cbed36
  1. 208
      src/views/customerOrg/patientRegisterImport.vue
  2. 1658
      src/views/customerOrg/patientRegisterImport240409.vue

208
src/views/customerOrg/patientRegisterImport.vue

@ -20,7 +20,8 @@
<el-button class="commonbutton" @click="seq = 0" size="small">导入</el-button>
</div>
<div style="padding: 0 5px;" v-show="checkPagePriv(pagePriv.privs, '导入后结果状态导出')">
<el-button class="commonbutton" @click="btnExport('tableData')" size="small" style="width:140px;">导入后结果状态导出</el-button>
<el-button class="commonbutton" @click="btnExport('tableData')" size="small"
style="width:140px;">导入后结果状态导出</el-button>
</div>
</div>
</div>
@ -35,7 +36,8 @@
:label="item.dataLabel || item.dispLabel" min-width="100" />
</el-table>
<el-table :data="tableData" border v-if="mode == '20'" :row-class-name="importRowClassName"
:height="window.pageHeight < 600 ? 440 : (window.pageHeight - 160)" highlight-current-row size="small">
: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" />
<el-table-column prop="importState" label="导入状态" min-width="80" sortable />
<el-table-column prop="importDes" label="导入描述" min-width="180" sortable />
@ -105,7 +107,7 @@
:append-to-body="true" :close-on-click-modal="false">
<div style="height:400px;padding: 0 50px; ">
<!-- webkitdirectory 选择文件属性 multiple 多选属性-->
<div><input ref="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 style="margin: 5px 70px;width:240px;">
<el-table :data="sheetNames" border ref="sheetNames" height="300" row-click="chooseSheetName"
@ -115,8 +117,7 @@
</div>
<div style="display: flex;flex-wrap: wrap;">
<span style="margin-top: 6px;">标题行 </span>
<el-input type="number" id="fileNames" 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>
</div>
</div>
@ -203,7 +204,8 @@
<el-radio v-model="dataImportOpts.completeFlag" label="1">正式登记</el-radio>
</div>
</div>
<div style="display: flex;margin:20px;">
<!-- 2024-04-09 取消此选项 -->
<div style="display: flex;margin:20px;" v-if="false">
<span>工卡号</span>
<div style="display: block;margin-top:20px;">
<div style="display: flex;">
@ -300,6 +302,7 @@
<el-input placeholder="姓名" v-model="query.patientName" size="small" clearable style="width: 130px" />
<span class="spanMidClass">性别</span>
<el-select v-model="query.sexId" placeholder="请选择" style="width: 130px" size="small">
<el-option label="全部" value="A" />
<el-option v-for="item in dict.sex" :key="item.id" :label="item.displayName" :value="item.id" />
</el-select>
</div>
@ -545,6 +548,7 @@ export default {
excelCols: [{ dispLabel: '', val: '', dataLabel: '' }], //excel {dispLabel:'',val:'',dataLabel:''}
importCols: [], // dataCols
excelData: [], //excel
choosedData: [], //
dataCols: [
{ dispLabel: '不设置', val: '' },
@ -696,6 +700,9 @@ export default {
//
clearProcess() {
let elo = document.getElementById('fileNames')
if(elo) elo.value = ''; //
this.workBook = null //EXCEL
this.sheetNames = [] //EXCEL {sheetName:}
@ -963,7 +970,7 @@ export default {
columns.forEach((column, index) => {
//
if (index === 1) {
sums[index] = "合计";
sums[index] = "导入合计";
return;
}
@ -974,15 +981,16 @@ export default {
}
data.forEach((item) => {
if (item[column.property] == '导入成功') {
success++
console.log('item,column.property',item,column.property)
if (item[column.property]) {
fail++
} else {
fail++
success++
}
});
});
sums[2] = `导入 成功:${success} 条,失败:${fail} 条。`
sums[2] = `成功:${success} 条,失败:${fail} 条。`
return sums;
},
@ -1221,7 +1229,7 @@ export default {
}
},
// Excel
// EXCELExcel
parseExcelData() {
let lfind = -1
this.excelCols.forEach((e, i) => {
@ -1251,61 +1259,155 @@ export default {
this.importCols.push(e)
}
})
this.tableData = []
this.tableData = [] //
this.choosedData = [] //
this.excelData.forEach(e => {
if (e.choosed) this.choosedData.push(e)
});
//
this.importing(this.dataImportOpts.startRow, this.dataImportOpts.nameType)
//
document.getElementById('fileNames').value = '';
},
//
// startRow :
// startRowNameType : 1 3.
// startRowNameType : 1 3.()
async importing(startRow, startRowNameType) {
let body = {}
for (let i = startRow; i < this.excelData.length; i++) {
for (let i = startRow; i < this.choosedData.length; i++) {
this.elProgress.percentage = Math.floor(
((i + 1) * 100) / this.excelData.length
((i + 1) * 100) / this.choosedData.length
);
if (this.excelData[i].choosed) {
body = this.excelDataToApiBody(this.excelData[i])
if (i == startRow) body.nameType = startRowNameType
if (this.choosedSameMan.patientId) {
body.patientId = this.choosedSameMan.patientId
this.choosedSameMan = {} //
}
console.log('this.excelData[i]', i, body)
try {
let res = await postapi('/api/app/patientregister/createpatientregisterexcel', body)
if (res.code != -1) {
if (res.data.code == 1) {
this.tableData.push(Object.assign({ importState: '导入成功' }, this.excelData[i]))
} else if (res.data.code == -2) {
this.sameMans = res.data.details
this.dialogSameMan = true
this.dataImportOpts.startRow = i
break;
} else {
this.tableData.push(Object.assign({ importState: '导入失败', importDes: res.data.msg }, this.excelData[i]))
// Excel
body = this.excelDataToApiBody(this.choosedData[i])
if (i == startRow) body.nameType = startRowNameType
console.log(`this.choosedData[${i}],startRowNameType,body`)
try {
//
if (this.choosedSameMan.patientNo) {
//
if (this.choosedSameMan.patientNo == '$newPatient$') {
body.nameType = '3'
} else {
body.patientNo = this.choosedSameMan.patientNo
}
} else if (startRowNameType != '3') {
let result = await this.isSamePatient(startRowNameType, body)
if (result.isContinue) {
if (result.err) {
this.tableData.push(Object.assign({ importState: '导入失败', importDes: result.err }, this.choosedData[i]))
continue
}
} else {
this.tableData.push(Object.assign({ importState: '导入失败', importDes: res.message }, this.excelData[i]))
this.dataImportOpts.startRow = i
break; // i this.importing
}
} catch (error) {
break;
}
// /api/app/patientregister/createpatientregisterexcel
let res = await postapi('/api/app/patientregister/CreatePatientRegisterFromExcel', body)
this.choosedSameMan = {} //
if (res.code >= 0) {
this.tableData.push(Object.assign({ importState: '导入成功' }, this.choosedData[i]))
} else {
this.tableData.push(Object.assign({ importState: '导入失败', importDes: res.message }, this.choosedData[i]))
}
} catch (error) {
this.tableData.push(Object.assign({ importState: '导入失败', importDes: `${error}` }, this.choosedData[i]))
}
//
if (i == this.excelData.length - 1) {
if (i == this.choosedData.length - 1) {
this.elProgress.display = false;
this.seq = -1
}
}
},
//
async isSamePatient(startRowNameType, body) {
console.log('isSamePatient', startRowNameType, body)
let result = {
isContinue: true,
err: ''
}
let res
if (body.idNo) {
try {
res = await postapi('/api/app/patient/GetByIdNo', { idNo: body.idNo })
if (res.code < 0) {
result.err = `身份证号查重错误,原因:${res.message}`
return result
} else if (res.code == 1) {
body.patientNo = res.data.patientNo
return result
}
} catch (error) {
result.err = `身份证号查重错误,原因:${error}`
return result
}
}
//
let url, localBody = {
customerOrgId: body.customerOrgId,
name: body.patientName
}
switch (startRowNameType) {
case '1':
case '2':
if (startRowNameType == '1') url = '/api/app/patientregister/GetSameNamePatient'
if (startRowNameType == '2') url = '/api/app/patientregister/GetCustomerOrgSameNamePatient'
res = await postapi(url, localBody)
if (res.code >= 0) {
if (res.data.length > 0) {
result.isContinue = false
this.sameMans = res.data
this.dialogSameMan = true
}
} else {
result.err = `${startRowNameType == '2' ? '同单位内' : ''}同名查重错误,原因:${res.message}`
}
break;
default:
break;
}
return result
// if (this.choosedSameMan.patientNo) {
// body.patientNo = this.choosedSameMan.patientNo
// // body.patientId = this.choosedSameMan.patientId
// this.choosedSameMan = {} //
// }
// try {
// switch (key) {
// case value:
// break;
// default:
// break;
// }
// { dispLabel: '', val: 'patientName' },
// { dispLabel: '', val: 'sexName' },
// { dispLabel: '', val: 'age' },
// { dispLabel: '', val: 'birthDate' },
// { dispLabel: '', val: 'maritalStatusName' },
// { dispLabel: '', val: 'nationName' },
// { dispLabel: '', val: 'idNo' },
},
//Excel
excelDataToApiBody(ExcelData) {
let body = {
@ -1340,22 +1442,22 @@ export default {
//
rowClickSameMan(row) {
this.choosedSameMan = Object.assign({}, row)
this.choosedSameMan = deepCopy(row)
},
//
btnOldMan() {
if (!this.choosedSameMan.patientId) {
if (!this.choosedSameMan.patientNo) {
this.$message.warning("请选择要导入的档案人员")
return
}
this.importing(this.dataImportOpts.startRow)
this.importing(this.dataImportOpts.startRow, this.dataImportOpts.nameType)
this.dialogSameMan = false
},
//
btnNewMan() {
this.choosedSameMan = {}
this.importing(this.dataImportOpts.startRow, '3')
this.choosedSameMan = { patientNo: '$newPatient$' } //
this.importing(this.dataImportOpts.startRow, this.dataImportOpts.nameType)
this.dialogSameMan = false
},
@ -1520,7 +1622,8 @@ export default {
payTypeFlag: this.payTypeFlag,
medicalCenterId: this.peisid,
}
// {
//{
// "patientRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
// "customerOrgId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
// "customerOrgRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
@ -1529,6 +1632,7 @@ export default {
// "payTypeFlag": "string",
// "medicalCenterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
// }
this.elProgress.display = true
this.elProgress.percentage = 0
for (let i = 0; i < this.prList.length; i++) {
@ -1539,20 +1643,16 @@ export default {
body.customerOrgId = this.newCustomerOrgFlag ? customerOrgId : this.prList[i].customerOrgId
try {
let res = await postapi('/api/app/patientregister/createpatientregisterhistory', body)
if (res.code != -1) {
if (res.data.code != -1) {
this.tableData.push(Object.assign({ importState: '导入成功' }, this.prList[i]))
} else {
this.tableData.push(Object.assign({ importState: '导入失败', importDes: res.data.msg }, this.prList[i]))
}
// /api/app/patientregister/createpatientregisterhistory
let res = await postapi('/api/app/patientregister/CreatePatientRegisterFromHistory', body)
if (res.code >= 0) {
this.tableData.push(Object.assign({ importState: '导入成功' }, this.prList[i]))
} else {
this.tableData.push(Object.assign({ importState: '导入失败', importDes: res.message }, this.prList[i]))
}
} catch (error) {
this.tableData.push(Object.assign({ importState: '导入失败', importDes: res.message }, this.prList[i]))
}
}
this.elProgress.display = false

1658
src/views/customerOrg/patientRegisterImport240409.vue
File diff suppressed because it is too large
View File

Loading…
Cancel
Save