<template>
|
<div class="app-container">
|
<!-- 搜索表单 -->
|
<el-form
|
:model="queryParams"
|
ref="queryForm"
|
:inline="true"
|
v-show="showSearch"
|
label-width="70px"
|
>
|
<el-row :gutter="8">
|
<el-col :span="5">
|
<el-form-item label="患者姓名" prop="name">
|
<el-input
|
v-model="queryParams.name"
|
placeholder="请输入姓名"
|
clearable
|
size="small"
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="5">
|
<el-form-item label="首诊医院" prop="treatmenthospitalname">
|
<org-selecter
|
ref="orgSelecter"
|
:org-type="'3'"
|
v-model="queryParams.treatmenthospitalno"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="9">
|
<el-form-item label="上报时间">
|
<el-date-picker
|
style="width: 100%"
|
v-model="selecttime"
|
type="monthrange"
|
range-separator="至"
|
start-placeholder="开始月份"
|
end-placeholder="结束月份"
|
value-format="yyyy-MM-dd"
|
@change="getTimeList"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="4">
|
<el-form-item>
|
<el-button
|
type="primary"
|
icon="el-icon-search"
|
size="mini"
|
@click="handleQuery"
|
>
|
搜索
|
</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">
|
重置
|
</el-button>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
|
<!-- 操作按钮 -->
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
<el-button
|
type="warning"
|
plain
|
icon="el-icon-download"
|
size="mini"
|
:loading="exportLoading"
|
@click="handleExport"
|
v-hasPermi="['project:donatebaseinfo:export']"
|
>
|
导出
|
</el-button>
|
</el-col>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
|
</el-row>
|
|
<!-- 数据表格 -->
|
<el-table
|
v-loading="loading"
|
:data="donatebaseinfoList"
|
@selection-change="handleSelectionChange"
|
border
|
:default-sort="{ prop: 'donatetime', order: 'descending' }"
|
>
|
<el-table-column
|
label="案例时间"
|
align="center"
|
prop="donatetime"
|
width="100"
|
>
|
<template slot-scope="scope">
|
<span>{{ parseTime(scope.row.donatetime, "{y}-{m}-{d}") }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="案例编号"
|
align="center"
|
prop="caseNo"
|
width="200"
|
/>
|
<el-table-column label="姓名" align="center" prop="name" width="100" />
|
<el-table-column label="性别" align="center" prop="sex" width="100">
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.sys_user_sex"
|
:value="parseInt(scope.row.sex)"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column label="年龄" align="center" prop="age" width="100">
|
<template slot-scope="scope">
|
{{
|
`${
|
scope.row.age && scope.row.age !== 0
|
? `${scope.row.age}${scope.row.ageunit || ""}`
|
: ""
|
} ${
|
scope.row.age2 && scope.row.age2 !== 0
|
? `${scope.row.age2}${scope.row.ageunit2}`
|
: ""
|
}`.trim()
|
}}
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="首诊医院"
|
align="center"
|
prop="treatmenthospitalname"
|
/>
|
<el-table-column label="GSC评分" align="center" prop="gcsScore" />
|
<el-table-column label="血型" align="center" prop="bloodtype" width="100">
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.sys_BloodType"
|
:value="scope.row.bloodtype"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="捐献类别"
|
align="center"
|
prop="donationcategory"
|
width="150"
|
>
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.sys_DonationCategory"
|
:value="scope.row.donationcategory"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="报告人"
|
align="center"
|
prop="reportername"
|
width="100"
|
/>
|
<el-table-column
|
label="捐献进度"
|
align="center"
|
prop="workflow"
|
width="120"
|
>
|
<template slot-scope="scope">
|
<div v-if="!scope.row.terminationCase">
|
<dict-tag
|
:options="dict.type.sys_donornode"
|
:value="scope.row.workflow"
|
/>
|
</div>
|
<div v-else><el-button type="danger" plain>任务终止</el-button></div>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="操作"
|
width="190"
|
align="center"
|
class-name="small-padding fixed-width"
|
fixed="right"
|
>
|
<template slot-scope="scope">
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-edit"
|
@click="handleUpdate(scope.row)"
|
v-hasPermi="['project:donatebaseinfo:edit']"
|
>
|
详情
|
</el-button>
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-edit"
|
@click="handleOpenEdit(scope.row)"
|
v-hasPermi="['project:donatebaseinfo:edit']"
|
>编辑</el-button
|
>
|
<el-button
|
size="mini"
|
type="text"
|
style="color: #f56c6c;"
|
@click="handleTerminate(scope.row)"
|
v-if="
|
scope.row.terminationCase === 0 && scope.row.recordstate !== '99'
|
"
|
>
|
终止
|
</el-button>
|
<el-button
|
size="mini"
|
type="text"
|
style="color: #67c23a;"
|
@click="handleRestore(scope.row)"
|
v-if="scope.row.terminationCase === 1"
|
>
|
恢复
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<!-- 分页 -->
|
<pagination
|
v-show="total > 0"
|
:total="total"
|
:page.sync="queryParams.pageNum"
|
:limit.sync="queryParams.pageSize"
|
@pagination="getList"
|
/>
|
<!-- 案例编辑弹窗 -->
|
<edit-case-modal
|
:visible="editModalVisible"
|
:editData="currentEditData"
|
:dict-options="dict.type"
|
@update:visible="editModalVisible = $event"
|
@success="handleEditSuccess"
|
@closed="handleEditClosed"
|
/>
|
<!-- 终止/恢复弹框 -->
|
<terminate-restore-modal
|
:current-record="currentRecord"
|
:visible="modalVisible"
|
:titles="modalTitles"
|
@update:visible="handleModalVisibleChange"
|
@operation-success="handleOperationSuccess"
|
/>
|
</div>
|
</template>
|
<script>
|
import { getUserProfile } from "@/api/system/user";
|
import TerminateRestoreModal from "@/components/TerminateRestoreModal";
|
import EditCaseModal from "./EditCaseModal";
|
import {
|
listDonatebaseinfo,
|
addDonatebaseinfo,
|
exportDonatebaseinfo
|
} from "@/api/project/donatebaseinfo";
|
import Li_area_select from "@/components/Address";
|
import OrgSelecter from "@/views/project/components/orgselect";
|
import { listReportname, listUser } from "@/api/project/organization";
|
|
export default {
|
name: "Donatebaseinfo",
|
components: {
|
Li_area_select,
|
OrgSelecter,
|
TerminateRestoreModal,
|
EditCaseModal
|
},
|
dicts: [
|
"sys_user_sex",
|
"sys_BloodType",
|
"sys_DonationCategory",
|
"sys_donornode"
|
],
|
data() {
|
return {
|
selecttime: "",
|
residenceAddresss: { sheng: "山东省", shi: "", qu: "" },
|
registerAddresss: { sheng: "山东省", shi: "", qu: "" },
|
modalTitles: {
|
terminate: "终止捐献进程",
|
restore: "恢复捐献进程"
|
},
|
loading: true,
|
exportLoading: false,
|
editModalVisible: false,
|
currentEditData: {},
|
ids: [],
|
single: true,
|
multiple: true,
|
showSearch: true,
|
total: 0,
|
donatebaseinfoList: [],
|
title: "",
|
open: false,
|
currentuser: {},
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
name: null,
|
treatmenthospitalno: null,
|
starttime: null,
|
endtime: null
|
},
|
form: {
|
name: null,
|
sex: null,
|
idcardtype: null,
|
idcardno: null,
|
age: null,
|
andAge: "",
|
ageunit: "年",
|
age2: null,
|
ageunit2: "月",
|
birthday: null,
|
nationality: "中国",
|
bloodtype: "0",
|
rhyin: "0",
|
diseasetype: [],
|
infectious: [],
|
selfwill: [],
|
othercases: [],
|
infosources: [],
|
kinship: [],
|
patientstate: [],
|
acquisitiontissueno: "ZJOPO",
|
acquisitiontissuename: "青岛人体器官获取组织"
|
},
|
reporters: [],
|
users: [],
|
rules: {
|
name: [
|
{ required: true, message: "请输入捐献者姓名", trigger: "blur" }
|
],
|
birthday: [
|
{ required: true, message: "请选择出生日期", trigger: "blur" }
|
],
|
treatmenthospitalno: [
|
{ required: true, message: "请选择首诊医院", trigger: "blur" }
|
],
|
bloodtype: [
|
{ required: true, message: "请选择ABO血型", trigger: "blur" }
|
]
|
},
|
showSaveBtn: true,
|
currentRecord: {},
|
modalVisible: {}
|
};
|
},
|
created() {
|
const savedParams = sessionStorage.getItem("donatebaseinfo");
|
if (savedParams) {
|
this.queryParams = { ...this.queryParams, ...JSON.parse(savedParams) };
|
}
|
},
|
async mounted() {
|
await Promise.all([
|
this.getCurrentUser(),
|
this.getuserlist(),
|
this.selectReporters()
|
]);
|
|
this.initializeRouteParams();
|
this.getTimeList();
|
this.getList();
|
},
|
methods: {
|
async getCurrentUser() {
|
const response = await getUserProfile();
|
this.currentuser = response.data;
|
},
|
|
calculateAge(birthday) {
|
if (!birthday) {
|
this.form.age = this.form.age2 = null;
|
return;
|
}
|
|
const birthDate = new Date(birthday);
|
const today = new Date();
|
|
let yearDiff = today.getFullYear() - birthDate.getFullYear();
|
let monthDiff = today.getMonth() - birthDate.getMonth();
|
let dayDiff = today.getDate() - birthDate.getDate();
|
|
if (dayDiff < 0) {
|
monthDiff--;
|
const lastDayOfMonth = new Date(
|
today.getFullYear(),
|
today.getMonth(),
|
0
|
).getDate();
|
dayDiff += lastDayOfMonth;
|
}
|
|
if (monthDiff < 0) {
|
yearDiff--;
|
monthDiff += 12;
|
}
|
|
this.form.age = yearDiff;
|
this.form.ageunit = "岁";
|
this.form.age2 = monthDiff;
|
this.form.ageunit2 = "月";
|
|
if (yearDiff === 0) {
|
if (monthDiff === 0) {
|
this.form.age = dayDiff;
|
this.form.ageunit = "天";
|
this.form.age2 = null;
|
} else {
|
this.form.age = monthDiff;
|
this.form.ageunit = "月";
|
this.form.age2 = dayDiff;
|
this.form.ageunit2 = "天";
|
}
|
}
|
|
this.form.andAge = [
|
this.form.age && this.form.age !== 0
|
? `${this.form.age}${this.form.ageunit}`
|
: "",
|
this.form.age2 && this.form.age2 !== 0
|
? `${this.form.age2}${this.form.ageunit2}`
|
: ""
|
]
|
.filter(Boolean)
|
.join(" ");
|
},
|
|
handleTerminate(row) {
|
this.currentRecord = { ...row };
|
this.modalVisible = { ...this.modalVisible, terminate: true };
|
},
|
|
handleRestore(row) {
|
this.currentRecord = { ...row };
|
this.modalVisible = { ...this.modalVisible, restore: true };
|
},
|
|
getTimeList() {
|
if (!this.selecttime) {
|
// this.queryParams.starttime = "1998-01-01 00:00:00";
|
// this.queryParams.endtime = "2998-01-01 00:00:00";
|
return;
|
}
|
|
const [start, end] = this.selecttime;
|
this.queryParams.starttime = `${start} 00:00:00`;
|
|
const monthNum = Number(end.slice(5, 7));
|
const nextMonth = monthNum < 9 ? `0${monthNum + 1}` : monthNum + 1;
|
this.queryParams.endtime = `${end.slice(0, 5)}${nextMonth}-01 00:00:00`;
|
},
|
|
async selectReporters() {
|
const res = await listReportname("zzry");
|
this.reporters = res.data;
|
},
|
|
async getuserlist() {
|
const res = await listUser();
|
this.users = res.data;
|
},
|
|
updateMessage() {
|
const idCardReg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
|
|
if (idCardReg.test(this.form.idcardno)) {
|
const orgBirthday = this.form.idcardno.substring(6, 14);
|
const orgGender = this.form.idcardno.substring(16, 17);
|
|
const sex = orgGender % 2 == 1 ? 1 : 2;
|
const birthday = `${orgBirthday.substring(
|
0,
|
4
|
)}-${orgBirthday.substring(4, 6)}-${orgBirthday.substring(6, 8)}`;
|
|
this.form.sex = sex;
|
this.form.birthday = birthday;
|
this.calculateAge(birthday);
|
}
|
},
|
|
initializeRouteParams() {
|
const { params } = this.$route;
|
const routeParams = {
|
starttime: params.starttime,
|
endtime: params.endtime,
|
reporterno: params.reporterno,
|
terminationcase: params.terminationcase,
|
tempRecordState: params.tempRecordState,
|
city: params.city
|
};
|
|
Object.entries(routeParams).forEach(([key, value]) => {
|
if (value) this.queryParams[key] = value;
|
});
|
|
if (params.starttime && params.endtime) {
|
this.selecttime = [
|
this.$moment(params.starttime).format("YYYY-MM-DD"),
|
this.$moment(params.endtime).format("YYYY-MM-DD")
|
];
|
}
|
},
|
|
async getList() {
|
this.loading = true;
|
|
sessionStorage.setItem(
|
"donatebaseinfo",
|
JSON.stringify(this.queryParams)
|
);
|
|
try {
|
const response = await listDonatebaseinfo(this.queryParams);
|
this.donatebaseinfoList = response.data;
|
this.total = response.total;
|
} catch (error) {
|
console.error("获取列表失败:", error);
|
} finally {
|
this.loading = false;
|
}
|
},
|
/** 打开编辑弹窗 */
|
handleOpenEdit(row) {
|
this.currentEditData = { ...row };
|
console.log(this.currentEditData, "this.currentEditData");
|
this.editModalVisible = true;
|
},
|
|
/** 处理编辑成功 */
|
handleEditSuccess(updatedData) {
|
this.$modal.msgSuccess("编辑成功");
|
this.getList(); // 刷新列表
|
},
|
|
/** 处理编辑弹窗关闭 */
|
handleEditClosed() {
|
this.currentEditData = {};
|
},
|
|
handleModalVisibleChange(newVisible) {
|
this.modalVisible = { ...newVisible };
|
},
|
|
handleOperationSuccess({ type, record }) {
|
console.log(`${type}操作成功:`, record);
|
this.getList();
|
},
|
|
cancel() {
|
this.open = false;
|
this.reset();
|
},
|
|
reset() {
|
this.form = {
|
name: null,
|
sex: null
|
// ... 保留必要的字段初始值
|
};
|
this.resetForm("form");
|
},
|
|
handleQuery() {
|
this.queryParams.pageNum = 1;
|
this.getList();
|
},
|
|
resetQuery() {
|
this.queryParams = {
|
pageNum: 1,
|
pageSize: 10,
|
name: null,
|
treatmenthospitalno: null,
|
starttime: null,
|
endtime: null
|
};
|
this.selecttime = [];
|
this.getTimeList();
|
this.resetForm("queryForm");
|
this.handleQuery();
|
},
|
|
handleSelectionChange(selection) {
|
this.ids = selection.map(item => item.id);
|
this.single = selection.length !== 1;
|
this.multiple = !selection.length;
|
},
|
|
handleAdd() {
|
this.reset();
|
this.form.reporterno = this.currentuser.userName;
|
this.form.reportername = this.currentuser.nickName;
|
this.open = true;
|
this.title = "人体器官潜在捐献者登记表";
|
},
|
|
handleUpdate(row) {
|
this.$router.push({
|
path: "/case/course",
|
query: { id: row.id, organType: "edit" }
|
});
|
},
|
|
async submitForm() {
|
const valid = await this.$refs.form.validate();
|
if (!valid) return;
|
|
const formData = { ...this.form };
|
|
// 处理表单数据
|
const processedData = this.processFormData(formData);
|
|
try {
|
const res = await addDonatebaseinfo(processedData);
|
if (res.code === 200) {
|
this.$modal.msgSuccess("新增成功");
|
this.$router.push({
|
path: "/organ/donationdetails/",
|
query: { id: res.data.id, organType: "edit" }
|
});
|
this.open = false;
|
} else {
|
this.$modal.msgError("新增失败:" + res.msg);
|
}
|
} catch (error) {
|
this.$modal.msgError("操作失败");
|
}
|
},
|
|
processFormData(data) {
|
const processed = { ...data };
|
|
// 处理数组字段
|
const arrayFields = [
|
"diseasetype",
|
"infectious",
|
"selfwill",
|
"othercases",
|
"infosources",
|
"kinship",
|
"patientstate"
|
];
|
arrayFields.forEach(field => {
|
if (Array.isArray(processed[field])) {
|
processed[field] = processed[field].join(",");
|
}
|
});
|
|
// 处理日期字段
|
if (processed.birthday) {
|
processed.birthday = this.$moment(processed.birthday).format(
|
"YYYY-MM-DD HH:mm:ss"
|
);
|
}
|
|
processed.donatetime = processed.reporttime;
|
processed.workflow = 0;
|
processed.recordstate = 0;
|
|
return processed;
|
},
|
|
async handleExport() {
|
try {
|
await this.$modal.confirm("是否确认导出所有捐献基础数据项?");
|
this.exportLoading = true;
|
|
const response = await exportDonatebaseinfo(this.queryParams);
|
this.$download.name(response.msg);
|
} catch (error) {
|
if (error !== "cancel") {
|
this.$modal.msgError("导出失败");
|
}
|
} finally {
|
this.exportLoading = false;
|
}
|
}
|
}
|
};
|
</script>
|
|
<style scoped>
|
::v-deep .el-dialog__header {
|
padding-top: 40px !important;
|
margin: auto !important;
|
padding-bottom: 0px !important;
|
}
|
::v-deep .el-input.is-disabled .el-input__inner {
|
background-color: #fff;
|
border-color: #dfe4ed;
|
color: #000;
|
cursor: not-allowed;
|
}
|
</style>
|