单应用项目,可以创建很多独立工具类页面 ,不用登录 初始化的页面
zhangchen
2025-07-19 7c37eb24f9864d9949e2052abf393d30817c26ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
import { tryConvertToInt } from "@/utils/utils";
import cache from '@/utils/cache';
export interface IotInfo {
  属性历史列表: any[];
  床号: string;
  状态列表: IotInfoStatus[];
  设备唯一编号: string;
  设备序列号: string;
}
 
export interface IotInfoStatus {
  是否为警告标记: number;
  状态名称: string;
  状态类型: string;
  状态颜色: string;
}
 
export interface ConsumablesCollection {
  抗凝剂: string[];
  护理包: string[];
  滤过器: string[];
  穿刺针: string[];
  管路: string[];
  透析器: string[];
  透析模式: string[];
}
 
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;
  透析状态: DialysisStatus | null;
}
 
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 => {
  return {
    抗凝剂: [],
    护理包: [],
    滤过器: [],
    穿刺针: [],
    管路: [],
    透析器: [],
    透析模式: [],
  };
};
 
export const defalutNotSignedIn = (): NotSignedIn => {
  return {
    dialysisMode: "", // 透析模式
    dialyzerList: [], // 透析器列表
    pipingList: [], // 一次性使用管路列表
    dialysateList: [], // 透析液列表
    anticoagulant: [], // 抗凝剂列表
    carePackage: [], // 一次性使用透析护理包列表
    punctureNeedle: [], // 穿刺针列表
    vascularAccess: [], // 血管通路列表
  };
};
 
export const defaultDeviceData = (): BedsideAuxiliaryScreen => {
  const pageType = cache.get('devcieCode') ? EPageType.LOADING : EPatForm.OUTPATIENT_SERVICE;
  return {
    devicdeNo: "", // 设备号
    recordCode: "", // 透析单code
    patientCode: "", // 患者code
    patientName: "", // 患者姓名
    patientPhone: "", // 患者头像
    age: "", // 年龄
    gender: "", // 性别
    patForm: EPatForm.OUTPATIENT_SERVICE, // 患者来源
    patFormNumber: "", // 住院门诊号
    // @ts-ignore
    pageType, // 当前要展示的页面
    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 {
 
      const treatmentStatus = tryConvertToInt(seeMsg.透析状态?.透析状态) as  MedStatus;
 
      // 这里就是有排班的
      result.treatmentStatus = treatmentStatus;
      result.recordCode = seeMsg.透析状态?.透析单编号;
      result.patientCode = seeMsg.透析状态?.患者编号;
      result.patientName = seeMsg.透析状态?.患者姓名;
      result.patientPhone = seeMsg.透析状态?.患者头像;
      result.age = seeMsg.透析状态?.年龄 + '';
      result.gender = seeMsg.透析状态?.性别 + '';
      result.patForm = seeMsg.透析状态?.患者来源;
      result.patFormNumber = seeMsg.透析状态?.患者门诊住院号;
 
      switch(treatmentStatus) {
        case EMedStatus.NOT_CHECKED_IN:
          result.pageType = EPageType.NOT_SIGNED_IN;
          const notSignedIn = {
            dialysisMode: seeMsg.透析状态?.透析方案,
            dialyzerList: seeMsg.透析状态?.透析器列表,
            pipingList: seeMsg.透析状态?.管路列表,
            dialysateList: seeMsg.透析状态?.透析液列表,
            carePackage: seeMsg.透析状态?.护理包列表,
            punctureNeedle: seeMsg.透析状态?.穿刺针列表,
            vascularAccess: seeMsg.透析状态?.血管通路列表,
            anticoagulant: [],
          }
          result.notSignedIn = notSignedIn;
          break
      }
 
    }
  }
  return result;
};