|
|
|
@ -1271,7 +1271,29 @@ export default { |
|
|
|
// 导入必填项验证 |
|
|
|
checkValide(body){ |
|
|
|
let msg = '' |
|
|
|
// personnelTypeName,medicalTypeName,salesman |
|
|
|
// patientName,personnelTypeName,medicalTypeName,salesman |
|
|
|
let keys = Object.keys(this.masterCols) |
|
|
|
for (let i = 0; i < keys.length; i++) { |
|
|
|
const key = keys[i]; |
|
|
|
switch (key) { |
|
|
|
case 'patientName': |
|
|
|
case 'name': |
|
|
|
if(!body.patientName) msg = this.masterCols[key] + ' 未填值' |
|
|
|
break; |
|
|
|
case 'medicalTypeId': //体检类别 |
|
|
|
if(!body.medicalTypeName) msg = this.masterCols[key] + ' 未填值' |
|
|
|
break; |
|
|
|
case 'personnelTypeId': //人员类别 |
|
|
|
if(!body.personnelTypeName) msg = this.masterCols[key] + ' 未填值' |
|
|
|
break; |
|
|
|
case 'salesman': //介绍人 |
|
|
|
if(!body.salesman) msg = this.masterCols[key] + ' 未填值' |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
if(msg) break; |
|
|
|
} |
|
|
|
return msg |
|
|
|
}, |
|
|
|
|
|
|
|
@ -1292,47 +1314,44 @@ export default { |
|
|
|
console.log(`this.choosedData[${i}],startRowNameType,body`) |
|
|
|
|
|
|
|
// 判断是否必填: |
|
|
|
let msg = checkValide(body) |
|
|
|
let msg = this.checkValide(body) |
|
|
|
if(msg){ |
|
|
|
this.tableData.push(Object.assign({ importState: '导入失败', importDes: msg }, this.choosedData[i])) |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
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{ |
|
|
|
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])) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.dataImportOpts.startRow = i |
|
|
|
break; // 跳出循环,重新从 i 开执行 this.importing |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.dataImportOpts.startRow = i |
|
|
|
break; // 跳出循环,重新从 i 开执行 this.importing |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 旧接口:/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])) |
|
|
|
// 旧接口:/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])) |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.tableData.push(Object.assign({ importState: '导入失败', importDes: `${error}` }, this.choosedData[i])) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 结束导入 |
|
|
|
if (i == this.choosedData.length - 1) { |
|
|
|
this.elProgress.display = false; |
|
|
|
|