| | |
| | | label-width="100px" |
| | | class="query-form" |
| | | > |
| | | <el-form-item label="满意度类型" prop="satisfactionScope"> |
| | | <el-select |
| | | v-model="satisfactionScope" |
| | | placeholder="默认离院" |
| | | clearable |
| | | style="width: 150px" |
| | | @change="handleSatisfactionScopeChange" |
| | | > |
| | | <el-option label="离院满意度" value="leave" /> |
| | | <el-option label="在院满意度" value="hospital" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="统计类型" prop="statisticaltype"> |
| | | <el-select |
| | | v-model="queryParams.statisticaltype" |
| | |
| | | @selection-change="handleSelectionChange" |
| | | :row-key="getRowKey" |
| | | > |
| | | <!-- 病区列 --> |
| | | <!-- 病区列:住院满意度统计在院病区,其余统计出院病区 --> |
| | | <el-table-column |
| | | v-if="queryParams.statisticaltype == 1" |
| | | label="出院病区" |
| | | :label="wardColumnLabel" |
| | | align="center" |
| | | sortable |
| | | key="leavehospitaldistrictname" |
| | |
| | | :show-overflow-tooltip="true" |
| | | :sort-method="sortChineseNumber" |
| | | min-width="120" |
| | | /> |
| | | > |
| | | <template slot-scope="scope"> |
| | | {{ getWardName(scope.row) || "-" }} |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <!-- 科室列 --> |
| | | <el-table-column |
| | |
| | | :row-data="currentRow" |
| | | :topicList="topiclist" |
| | | :query-params="queryParams" |
| | | :topType="2" |
| | | @close="topicVisible = false" |
| | | /> |
| | | </el-dialog> |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | // 满意度类型:leave=离院满意度(按出院病区统计),hospital=在院满意度(按在院病区统计) |
| | | satisfactionScope: "leave", |
| | | |
| | | // 查询参数 |
| | | queryParams: { |
| | | statisticaltype: 1, |
| | |
| | | flatArraydept: [], |
| | | |
| | | // 服务类型选项 |
| | | options: [], |
| | | options: [ |
| | | { |
| | | value: 6, |
| | | label: "住院满意度", |
| | | raw: { |
| | | cssClass: "", |
| | | listClass: "", |
| | | }, |
| | | }, |
| | | |
| | | { |
| | | value: 14, |
| | | label: "门诊满意度", |
| | | raw: { |
| | | cssClass: "", |
| | | listClass: "", |
| | | }, |
| | | }, |
| | | ], |
| | | |
| | | // 表格数据 |
| | | userList: [], |
| | |
| | | }; |
| | | }, |
| | | |
| | | computed: { |
| | | // 是否按「在院满意度」口径统计:在院患者按在院病区(hospitaldistrictcodes)统计, |
| | | // 离院满意度仍按出院病区(leavehospitaldistrictcodes)统计 |
| | | isInHospitalSatisfaction() { |
| | | return this.satisfactionScope === "hospital"; |
| | | }, |
| | | |
| | | // 病区列标题 |
| | | wardColumnLabel() { |
| | | return this.isInHospitalSatisfaction ? "在院病区" : "出院病区"; |
| | | }, |
| | | }, |
| | | |
| | | created() { |
| | | this.orgname = localStorage.getItem("orgname"); |
| | | |
| | |
| | | // 处理病区/科室选择 |
| | | if (params.statisticaltype == 1) { |
| | | // 病区统计 |
| | | if (params.leavehospitaldistrictcodes.includes("all")) { |
| | | // 如果选择了"全部",则移除"all"值 |
| | | params.leavehospitaldistrictcodes = |
| | | params.leavehospitaldistrictcodes.filter( |
| | | (item) => item !== "all" |
| | | ); |
| | | // 如果需要传所有病区代码,可以从store中获取 |
| | | params.leavehospitaldistrictcodes = ( |
| | | this.$store.getters.belongWards || [] |
| | | ).map((ward) => ward.districtCode); |
| | | let wardCodes = params.leavehospitaldistrictcodes || []; |
| | | if (wardCodes.includes("all")) { |
| | | // 如果选择了"全部",则使用当前用户所属的全部病区 |
| | | wardCodes = (this.$store.getters.belongWards || []).map( |
| | | (ward) => ward.districtCode |
| | | ); |
| | | } |
| | | // 住院满意度针对在院患者,按在院病区(hospitaldistrictcodes)统计; |
| | | // 出院随访等其他服务类型仍按出院病区(leavehospitaldistrictcodes)统计 |
| | | delete params.leavehospitaldistrictcodes; |
| | | if (this.isInHospitalSatisfaction) { |
| | | params.hospitaldistrictcodes = wardCodes; |
| | | } else { |
| | | params.leavehospitaldistrictcodes = wardCodes; |
| | | } |
| | | } else if (params.statisticaltype == 2) { |
| | | // 科室统计 |
| | |
| | | } |
| | | }, |
| | | sortChineseNumber(aRow, bRow) { |
| | | const a = aRow.leavehospitaldistrictname; |
| | | const b = bRow.leavehospitaldistrictname; |
| | | const a = this.getWardName(aRow); |
| | | const b = this.getWardName(bRow); |
| | | |
| | | // 中文数字到阿拉伯数字的映射(扩展到45) |
| | | const chineseNumMap = { |
| | |
| | | return -1; |
| | | }; |
| | | |
| | | const indexA = getIndex(a.leavehospitaldistrictname); |
| | | const indexB = getIndex(b.leavehospitaldistrictname); |
| | | const indexA = getIndex(this.getWardName(a)); |
| | | const indexB = getIndex(this.getWardName(b)); |
| | | |
| | | // 排序逻辑 |
| | | if (indexA === -1 && indexB === -1) { |
| | | return (a.leavehospitaldistrictname || "").localeCompare( |
| | | b.leavehospitaldistrictname || "" |
| | | ); |
| | | return this.getWardName(a).localeCompare(this.getWardName(b)); |
| | | } |
| | | if (indexA === -1) return 1; |
| | | if (indexB === -1) return -1; |
| | |
| | | |
| | | // 处理查询 |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | |
| | | // 切换满意度类型(离院/在院)后重新查询 |
| | | handleSatisfactionScopeChange() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | |
| | | // 获取行key |
| | | getRowKey(row) { |
| | | return row.statisticaltype === 1 |
| | | ? row.leavehospitaldistrictcode |
| | | ? row.hospitaldistrictcode || row.leavehospitaldistrictcode |
| | | : row.deptcode; |
| | | }, |
| | | |
| | | // 病区名称:住院满意度接口返回在院病区字段,其余返回出院病区字段 |
| | | getWardName(row) { |
| | | if (!row) return ""; |
| | | return row.hospitaldistrictname || row.leavehospitaldistrictname || ""; |
| | | }, |
| | | |
| | | // 格式化百分比 |
| | |
| | | } |
| | | |
| | | if (this.queryParams.statisticaltype == 1) { |
| | | this.topicvalue.name = row.leavehospitaldistrictname; |
| | | params.leavehospitaldistrictcodes = [row.leavehospitaldistrictcode]; |
| | | this.topicvalue.name = this.getWardName(row); |
| | | // 住院满意度按在院病区统计,其余按出院病区统计 |
| | | if (this.isInHospitalSatisfaction) { |
| | | delete params.leavehospitaldistrictcodes; |
| | | params.hospitaldistrictcodes = [ |
| | | row.hospitaldistrictcode || row.leavehospitaldistrictcode, |
| | | ]; |
| | | } else { |
| | | params.leavehospitaldistrictcodes = [ |
| | | row.leavehospitaldistrictcode, |
| | | ]; |
| | | } |
| | | } else { |
| | | this.topicvalue.name = row.deptname; |
| | | params.deptcodes = [row.deptcode]; |
| | |
| | | |
| | | // 添加表头 |
| | | const headers = [ |
| | | this.queryParams.statisticaltype == 1 ? "出院病区" : "科室", |
| | | this.queryParams.statisticaltype == 1 ? this.wardColumnLabel : "科室", |
| | | "出院人次", |
| | | "无需随访人次", |
| | | "应随访人次", |
| | |
| | | this.userList.forEach((item) => { |
| | | const dataRow = worksheet.addRow([ |
| | | this.queryParams.statisticaltype == 1 |
| | | ? item.leavehospitaldistrictname |
| | | ? this.getWardName(item) |
| | | : item.deptname, |
| | | item.dischargeCount || 0, |
| | | item.nonFollowUp || 0, |