单应用项目,可以创建很多独立工具类页面 ,不用登录 初始化的页面
zhangchen
2025-07-18 fcd455b10a7f40d39a55c5182dc76646ecd7a7bb
ID1825-修改数据格式化逻辑
3个文件已修改
1个文件已添加
347 ■■■■■ 已修改文件
src/store/bedsideAuxiliaryScreen.ts 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/type/bedsideAuxiliaryScreen.type.ts 263 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobile/bedsideAuxiliaryScreen/components/NotSignedIn.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobile/bedsideAuxiliaryScreen/components/UnplannedSchedule.vue 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/bedsideAuxiliaryScreen.ts
@@ -2,8 +2,8 @@
import { ref } from "vue";
import cache from "../utils/cache";
import { EventSourcePolyfill } from "event-source-polyfill";
import type { DeviceData } from './type/bedsideAuxiliaryScreen.type';
import { defaultDeviceData, defaultconsumablesCollection } from './type/bedsideAuxiliaryScreen.type';
import type { BedsideAuxiliaryScreen } from './type/bedsideAuxiliaryScreen.type';
import { defaultDeviceData, defaultconsumablesCollection, formatDeviceData } from './type/bedsideAuxiliaryScreen.type';
export const useBedsideAuxiliaryScreenStore = defineStore(
@@ -21,8 +21,8 @@
      zuihouTime: '',
    });
    /** s设备信息数据 */
    const deviceData = ref<DeviceData>(defaultDeviceData());
    /** 设备信息数据 */
    const deviceData = ref<BedsideAuxiliaryScreen>(defaultDeviceData());
    /**
     * 设置设备编号
@@ -72,19 +72,7 @@
          // 倒计时提示文本
          if (dataBody.倒计时?.提示文本) {}
          // 床旁血压计
          if (dataBody.推送类型 === '床旁血压计') {}
          // 中央监控大屏信息
          else if (dataBody.推送类型 === '中央监控大屏信息') {
            // 存在透析状态,表示当前设备今天存在排班
            if (dataBody?.透析状态) {}
            // 不存在就是没有排班
            else {
              deviceData.value.devicdeNo = dataBody.IOT信息?.床号;
              deviceData.value.patientName = '';
              deviceData.value.consumablesCollection = dataBody?.使用耗材字典 || defaultconsumablesCollection();
            }
          }
          deviceData.value = formatDeviceData(dataBody)
        }
      };
    };
@@ -100,6 +88,8 @@
        console.log("[SSE] 连接已关闭");
      }
    };
    return {
      deviceCode,
      deviceData,
src/store/type/bedsideAuxiliaryScreen.type.ts
@@ -1,3 +1,18 @@
export interface IotInfo {
  属性历史列表: any[];
  床号: string;
  状态列表: IotInfoStatus[];
  设备唯一编号: string;
  设备序列号: string;
}
export interface IotInfoStatus {
  是否为警告标记: number;
  状态名称: string;
  状态类型: string;
  状态颜色: string;
}
export interface ConsumablesCollection {
  抗凝剂: string[];
  护理包: string[];
@@ -8,10 +23,198 @@
  透析模式: string[];
}
export interface DeviceData {
enum EPushType {
  SPHYGMOMANOMETR = "床旁血压计",
  CENTRAL_MONITORING = "中央监控大屏信息",
}
type PushType = "床旁血压计" | "中央监控大屏信息";
export interface DialysisStatus {
  clientCode: string;
  deviceHospitalCode: string;
  iot_传输时间: number | null;
  iot_当前脱水量: number | null;
  iot_脱水目标量: number | null;
  iot_脱水速率: number | null;
  iot_跨膜压: number | null;
  iot_透析时间: number | null;
  iot_静脉压: number | null;
  sortOrder: number | null;
  txTime: number | null;
  上次透后称重: number | null;
  体重增加: number | null;
  体重增长率: number | null;
  分区编号: string;
  处方脱水量: number | null;
  实时ktv: string;
  实时ktv计算结果列表: null | string[];
  实时脱水量: number | null;
  干体重: number | null;
  年龄: number | null;
  异常检验指标: AnomalyIndex[] | null;
  当前血温: number | null;
  性别: string;
  患者头像: string;
  患者姓名: string;
  患者来源: 0 | 1;
  患者编号: string;
  患者透析号: string;
  患者门诊住院号: string;
  抗凝剂列表: Anticoagulant[] | null;
  护理包列表: string[] | null;
  报警_脱水量设定不一致: boolean;
  最后一条血压: number | null;
  最近平均脱水量: string;
  最近最大脱水量: string;
  最近最大脱水量日期: string;
  此次脱水量: number | null;
  监测血压是否低于百分之30: boolean;
  监测血压是否高于百分之30: boolean;
  监测记录列表: any[];
  穿刺针列表: PunctureNeedle[] | null;
  第一条血压: number | null;
  管路列表: Piping[] | null;
  置换方式: string;
  脉搏列表: any[] | null;
  血压低值列表: any[] | null;
  血管通路列表: VascularAccess[] | null;
  设备分区位置: any;
  设备分区类型: number | null;
  设备号: string;
  设备名称: string;
  设备序列号: string;
  设备状态列表: IotInfoStatus[] | null;
  设备编号: string;
  超滤速度过快: boolean;
  跨膜压列表: any[] | null;
  跨膜压是否大于200: boolean;
  跨膜压是否小于0: boolean;
  透前称重: number | null;
  透前脉搏: number | null;
  透前血压_伸缩压: number | null;
  透前血压_舒张压: number | null;
  透析单医嘱列表: number | null;
  透析单编号: string | null;
  透析器: string;
  透析器列表: Dialyzer[] | null;
  透析处方是否已确认: number;
  透析处方的时长: number | null;
  透析处方的时长_分钟: string;
  透析处方的时长_小时: string;
  透析开始时间: number | null;
  透析方案: string;
  透析液列表: any[];
  透析状态: string; // '0.0'这种格式的,得格式化一下
  透析结束时间: string | null;
}
export interface VascularAccess {
  位置: string;
  类型: string;
}
export interface Dialyzer extends Anticoagulant {}
export interface Piping extends Anticoagulant {}
export interface PunctureNeedle extends Anticoagulant {}
export interface Anticoagulant {
  name: string;
  单位: string;
  数量: number | null;
}
export interface AnomalyIndex {
  单位: string;
  参考值: string;
  结果标记: string;
  项目名称: string;
  项目结果: string;
}
export interface SseMsgData {
  IOT信息: IotInfo | null;
  使用耗材字典: ConsumablesCollection | null; // 当透析状态为治疗中时该字段为null
  倒计时: "";
  推送类型: PushType;
  透析状态: "";
}
export interface BedsideAuxiliaryScreen {
  devicdeNo: string | number;
  recordCode: string;
  patientCode: string;
  patientName: string;
  patientPhone: string;
  age: string;
  gender: string;
  patForm: PatForm;
  patFormNumber: string;
  treatmentStatus: MedStatus;
  consumablesCollection: ConsumablesCollection;
  pageType: PageType;
  notSignedIn: NotSignedIn;
}
export enum EPageType {
  NOT_INIT = 0, // 未初始化(没有设备编号)
  LOADING = 1, // 加载中
  UNPLANNED_SCHEDULE = 2, // 未排班
  NOT_SIGNED_IN = 3, // 未签到
  SIGNED_IN = 4, // 已签到
  DURING_DIALYSIS = 5, // 透析中
  SPHYGMOMANOMETER = 6, // 床旁血压计
}
export type PageType =
  | EPageType.NOT_INIT
  | EPageType.LOADING
  | EPageType.UNPLANNED_SCHEDULE
  | EPageType.NOT_SIGNED_IN
  | EPageType.SIGNED_IN
  | EPageType.DURING_DIALYSIS
  | EPageType.SPHYGMOMANOMETER;
export enum EMedStatus {
  NOT_CHECKED_IN = 0, // 未签到
  SIGNED_IN = 1, // 已签到
  DURING_DIALYSIS = 2, // 透析中
  END = 2.5, // 已结束
  CHECKED = 3, // 已检查
  ARCHIVED = 4, // 已归档
}
export type MedStatus =
  | EMedStatus.NOT_CHECKED_IN
  | EMedStatus.SIGNED_IN
  | EMedStatus.DURING_DIALYSIS
  | EMedStatus.END
  | EMedStatus.CHECKED
  | EMedStatus.ARCHIVED;
export enum EPatForm {
  OUTPATIENT_SERVICE = 0,
  BE_IN_HOSPITAL = 1,
}
export type PatForm = EPatForm.BE_IN_HOSPITAL | EPatForm.OUTPATIENT_SERVICE;
export interface NotSignedIn {
  dialysisMode: string;
  dialyzerList: Dialyzer[];
  pipingList: Piping[];
  dialysateList: any[];
  anticoagulant: {
    name: string;
    unit: string;
    firstAndAddition: string;
    total: string;
  };
  carePackage: any[];
  punctureNeedle: PunctureNeedle[];
  vascularAccess: VascularAccess[];
}
export const defaultconsumablesCollection = (): ConsumablesCollection => {
@@ -26,10 +229,60 @@
  };
};
export const defaultDeviceData = (): DeviceData => {
export const defalutNotSignedIn = (): NotSignedIn => {
  return {
    devicdeNo: "",
    patientName: "",
    consumablesCollection: defaultconsumablesCollection(),
    dialysisMode: "", // 透析模式
    dialyzerList: [], // 透析器列表
    pipingList: [], // 一次性使用管路列表
    dialysateList: [], // 透析液列表
    anticoagulant: {
      name: "", // 抗凝剂名称
      unit: "", // 抗凝剂单位
      firstAndAddition: "", // 维持/追加剂量
      total: "", // 总量
    }, // 抗凝剂信息
    carePackage: [], // 一次性使用透析护理包列表
    punctureNeedle: [], // 穿刺针列表
    vascularAccess: [], // 血管通路列表
  };
};
export const defaultDeviceData = (): BedsideAuxiliaryScreen => {
  return {
    devicdeNo: "", // 设备号
    recordCode: "", // 透析单code
    patientCode: "", // 患者code
    patientName: "", // 患者姓名
    patientPhone: "", // 患者头像
    age: "", // 年龄
    gender: "", // 性别
    patForm: EPatForm.OUTPATIENT_SERVICE, // 患者来源
    patFormNumber: "", // 住院门诊号
    pageType: EPageType.NOT_INIT, // 当前要展示的页面
    treatmentStatus: EMedStatus.NOT_CHECKED_IN, // 透析状态
    consumablesCollection: defaultconsumablesCollection(), // 未排班时需要的数据
    notSignedIn: defalutNotSignedIn(), // 未签到时需要的数据
  };
};
export const formatDeviceData = (
  seeMsg: SseMsgData
): BedsideAuxiliaryScreen => {
  const result = defaultDeviceData();
  // 默认床号(设备号)
  result.devicdeNo = seeMsg.IOT信息?.床号;
  if (seeMsg.推送类型 === EPushType.SPHYGMOMANOMETR) {
    result.pageType = EPageType.SPHYGMOMANOMETER;
  } else if (seeMsg.推送类型 === EPushType.CENTRAL_MONITORING) {
    // 判断是否存在透析状态,如果不存在就是没有排班
    if (seeMsg.透析状态 === null || !seeMsg.透析状态) {
      result.pageType = EPageType.UNPLANNED_SCHEDULE;
      result.consumablesCollection = seeMsg?.使用耗材字典 || defaultconsumablesCollection()
    } else {
    }
  }
  return result;
};
src/views/mobile/bedsideAuxiliaryScreen/components/NotSignedIn.vue
New file
@@ -0,0 +1,11 @@
<template>
  <div class="not_signed_in_container"></div>
</template>
<script lang="ts" setup name="NotSignedIn">
</script>
<style>
</style>
src/views/mobile/bedsideAuxiliaryScreen/components/UnplannedSchedule.vue
@@ -81,15 +81,35 @@
      <Card
        title="血液透析器"
        :icon="tslImg"
        background-color="#D9F0E2"
        background-color="#F6F5FA"
        class="row2-card"
      />
      >
        <div class="list-4">
          <div
            v-for="(item, index) in consumablesCollection.透析器"
            :key="index"
            class="list-4-item"
          >
            {{ item }}
          </div>
        </div>
      </Card>
      <Card
        title="血液透析滤过器"
        :icon="tslImg"
        background-color="#D9F0E2"
        background-color="#F6F5FA"
        class="row2-card"
      />
      >
        <div class="list-4">
          <div
            v-for="(item, index) in consumablesCollection.滤过器"
            :key="index"
            class="list-4-item"
          >
            {{ item }}
          </div>
        </div>
      </Card>
    </div>
  </div>
</template>
@@ -114,7 +134,7 @@
</script>
<style lang="less" scoped>
*{
* {
  box-sizing: border-box;
}
.unplanned-schedule-container {
@@ -129,7 +149,7 @@
    display: flex;
    width: 100%;
    gap: 4px;
    min-height: 0;
    min-height: 0;
    > .row1-left,
    .row1-right {
      width: 103px;
@@ -154,7 +174,7 @@
    display: flex;
    width: 100%;
    gap: 4px;
    min-height: 0;
    min-height: 0;
    > .row2-card {
      flex: 1;
    }
@@ -199,5 +219,20 @@
      }
    }
  }
  .list-4 {
    .list-4-item {
      display: inline-block;
      font-family: PingFangSC, PingFang SC;
      font-weight: 500;
      font-size: 4px;
      color: #333333;
      text-align: left;
      font-style: normal;
      margin-bottom: 4px;
      &:not(:first-child) {
        margin-right: 2px;
      }
    }
  }
}
</style>