WXL
11 小时以前 05c363fdd7ab04e3bd9a753e2c5d5bfff04d681c
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_dict = require("../../utils/dict.js");
if (!Array) {
  const _easycom_u_input2 = common_vendor.resolveComponent("u-input");
  const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  const _easycom_u_loading_icon2 = common_vendor.resolveComponent("u-loading-icon");
  (_easycom_u_input2 + _easycom_u_icon2 + _easycom_u_loading_icon2)();
}
const _easycom_u_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_u_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_u_loading_icon = () => "../../uni_modules/uview-plus/components/u-loading-icon/u-loading-icon.js";
if (!Math) {
  (_easycom_u_input + _easycom_u_icon + _easycom_u_loading_icon)();
}
const _sfc_main = {
  __name: "index",
  setup(__props) {
    const loading = common_vendor.ref(false);
    const refreshing = common_vendor.ref(false);
    const hasMore = common_vendor.ref(true);
    const pageNum = common_vendor.ref(1);
    const pageSize = common_vendor.ref(10);
    const dict = common_vendor.ref({});
    const currentStatus = common_vendor.ref("all");
    const searchKeyword = common_vendor.ref("");
    const stats = common_vendor.ref({
      count: 0,
      throughCount: 0,
      rejectCount: 0,
      waiveCount: 0
    });
    const reviewList = common_vendor.ref([]);
    const total = common_vendor.ref(0);
    const statusOptions = common_vendor.ref([
      { label: "全部", value: "all" },
      { label: "待审查", value: "pending" },
      { label: "审查通过", value: "approved" },
      { label: "审查驳回", value: "rejected" },
      { label: "已放弃", value: "abandoned" }
    ]);
    const conclusionDict = {
      0: "未审核",
      1: "审查通过",
      2: "审查驳回",
      3: "放弃",
      4: "修改后同意"
    };
    const getDictLabel = (dictType, dictValue) => {
      if (!dict.value[dictType] || !dictValue)
        return "";
      const dictItem = dict.value[dictType].find(
        (item) => item.dictValue == String(dictValue)
      );
      return dictItem ? dictItem.dictLabel : dictValue;
    };
    const getAgeWithUnit = (review) => {
      if (!review.age)
        return "未知";
      const unit = getDictLabel("sys_AgeUnit", review.ageunit) || "岁";
      return `${review.age}${unit}`;
    };
    const formatDate = (dateString) => {
      if (!dateString)
        return "";
      const date = new Date(dateString);
      return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, "0")}-${date.getDate().toString().padStart(2, "0")} ${date.getHours().toString().padStart(2, "0")}:${date.getMinutes().toString().padStart(2, "0")}`;
    };
    const getReviewStatusText = (review) => {
      if (review.receiveStatus == 0)
        return "待推送";
      if (review.receiveStatus == 1)
        return "未阅读";
      if (review.receiveStatus == 2)
        return "已阅读";
      if (review.receiveStatus == 3)
        return "超时";
      if (review.receiveStatus == 4)
        return "中止";
      if (review.receiveStatus == 5)
        return "完成";
      if (!review.receiveStatus && review.receiveStatus !== 0)
        return "待推送";
      return "待推送";
    };
    const getReviewStatusClass = (review) => {
      if (review.receiveStatus == 0)
        return "abandoned";
      if (review.receiveStatus == 1)
        return "abandoned";
      if (review.receiveStatus == 2)
        return "pending";
      if (review.receiveStatus == 3)
        return "unknown";
      if (review.receiveStatus == 4)
        return "unknown";
      if (review.receiveStatus == 5)
        return "approved";
      if (!review.receiveStatus && review.receiveStatus !== 0)
        return "pending";
      return "unknown";
    };
    const getConclusionText = (conclusion) => {
      return conclusionDict[conclusion] || "未知结论";
    };
    const selectStatus = (status) => {
      currentStatus.value = status;
      resetAndLoad();
    };
    const handleSearch = () => {
      resetAndLoad();
    };
    const resetFilters = () => {
      currentStatus.value = "all";
      searchKeyword.value = "";
      resetAndLoad();
    };
    const buildQueryParams = () => {
      const params = {
        pageNum: pageNum.value,
        pageSize: pageSize.value
        // receiveStatus: "1,2,3,4,5",
      };
      if (searchKeyword.value) {
        params.name = searchKeyword.value;
      }
      if (currentStatus.value !== "all") {
        switch (currentStatus.value) {
          case "pending":
            params.expertconclusion = null;
            break;
          case "approved":
            params.expertconclusion = 1;
            break;
          case "rejected":
            params.expertconclusion = 2;
            break;
          case "abandoned":
            params.expertconclusion = 3;
            break;
        }
      }
      return params;
    };
    const resetAndLoad = () => {
      pageNum.value = 1;
      hasMore.value = true;
      loadCaseData();
    };
    const onRefresh = async () => {
      refreshing.value = true;
      await resetAndLoad();
      refreshing.value = false;
    };
    const onLoadMore = async () => {
      if (!hasMore.value || loading.value)
        return;
      pageNum.value++;
      await loadCaseData(true);
    };
    const stateTotal = async () => {
      const resTotal = await common_vendor.index.$uapi.get(
        `/project/ethicalreviewopinions/stateTotal`
      );
      if (resTotal.code == 200)
        stats.value = resTotal.data[0];
    };
    const loadCaseData = async (isLoadMore = false) => {
      if (loading.value)
        return;
      loading.value = true;
      try {
        const params = buildQueryParams();
        const res = await common_vendor.index.$uapi.get(
          `/project/ethicalreviewopinions/listnew`,
          params
        );
        common_vendor.index.__f__("log", "at pages/ethicalReview/index.vue:419", res, "11");
        if (res.code == 200) {
          const list = res.rows || [];
          const totalCount = res.total || 0;
          if (isLoadMore) {
            reviewList.value = [...reviewList.value, ...list];
          } else {
            reviewList.value = list;
          }
          common_vendor.index.__f__("log", "at pages/ethicalReview/index.vue:430", reviewList.value, "reviewList.value");
          total.value = totalCount;
          hasMore.value = reviewList.value.length < totalCount;
        } else {
          common_vendor.index.showToast({
            title: res.msg || "加载失败",
            icon: "none"
          });
        }
      } catch (error) {
        common_vendor.index.__f__("error", "at pages/ethicalReview/index.vue:441", "加载案例数据失败:", error);
        common_vendor.index.showToast({
          title: "数据加载失败,请重试",
          icon: "none"
        });
      } finally {
        loading.value = false;
        common_vendor.index.stopPullDownRefresh();
      }
    };
    const viewDetail = (review) => {
      common_vendor.index.navigateTo({
        url: `/pages/ethicalReview/ethicalInfo?fcid=${review.fcid}&type=review&status=${review.expertconclusion || "pending"}&id=${review.id}`
      });
    };
    const downloadReport = async (review) => {
      if (!review.conclusionannex) {
        common_vendor.index.showToast({
          title: "暂无报告可下载",
          icon: "none"
        });
        return;
      }
      try {
        const annexes = review.conclusionannex.split(";").filter((item) => item.trim());
        if (annexes.length == 0) {
          common_vendor.index.showToast({
            title: "暂无报告可下载",
            icon: "none"
          });
          return;
        }
        common_vendor.index.showLoading({
          title: "下载中...",
          mask: true
        });
        const fileUrl = annexes[0];
        const downloadTask = common_vendor.index.downloadFile({
          url: fileUrl,
          success: (downloadRes) => {
            if (downloadRes.statusCode == 200) {
              const tempFilePath = downloadRes.tempFilePath;
              common_vendor.index.saveFile({
                tempFilePath,
                success: (saveRes) => {
                  common_vendor.index.hideLoading();
                  common_vendor.index.showToast({
                    title: "下载成功",
                    icon: "success",
                    duration: 2e3
                  });
                  if (common_vendor.index.getSystemInfoSync().platform == "weixin") {
                    common_vendor.index.openDocument({
                      filePath: saveRes.savedFilePath,
                      showMenu: true,
                      success: () => {
                        common_vendor.index.__f__("log", "at pages/ethicalReview/index.vue:516", "打开文档成功");
                      },
                      fail: (err) => {
                        common_vendor.index.__f__("error", "at pages/ethicalReview/index.vue:519", "打开文档失败", err);
                      }
                    });
                  }
                },
                fail: (saveErr) => {
                  common_vendor.index.hideLoading();
                  common_vendor.index.showToast({
                    title: "保存文件失败",
                    icon: "error",
                    duration: 2e3
                  });
                }
              });
            } else {
              common_vendor.index.hideLoading();
              common_vendor.index.showToast({
                title: "下载失败",
                icon: "error",
                duration: 2e3
              });
            }
          },
          fail: (err) => {
            common_vendor.index.hideLoading();
            common_vendor.index.showToast({
              title: "下载失败",
              icon: "error",
              duration: 2e3
            });
            common_vendor.index.__f__("error", "at pages/ethicalReview/index.vue:549", "下载文件失败:", err);
          }
        });
        downloadTask.onProgressUpdate((res) => {
          common_vendor.index.__f__("log", "at pages/ethicalReview/index.vue:555", "下载进度:", res.progress);
        });
      } catch (error) {
        common_vendor.index.hideLoading();
        common_vendor.index.__f__("error", "at pages/ethicalReview/index.vue:559", "下载报告失败:", error);
        common_vendor.index.showToast({
          title: "下载失败",
          icon: "error",
          duration: 2e3
        });
      }
    };
    const submitAppeal = (review) => {
      common_vendor.index.navigateTo({
        url: `/pages/ethics/appeal?id=${review.fcid || review.id}&caseNo=${review.caseNo || ""}&name=${review.name || ""}`
      });
    };
    const restartReview = async (review) => {
      common_vendor.index.showModal({
        title: "重新开始审查",
        content: "确定要重新开始这个审查流程吗?",
        success: async (res) => {
          if (res.confirm) {
            try {
              common_vendor.index.showLoading({
                title: "处理中...",
                mask: true
              });
              const response = await common_vendor.index.$uapi.put(
                `/project/ethicalreviewopinions/reset/${review.fcid || review.id}`
              );
              common_vendor.index.hideLoading();
              if (response.code == 200) {
                common_vendor.index.showToast({
                  title: "审查已重新开始",
                  icon: "success",
                  duration: 2e3
                });
                resetAndLoad();
              } else {
                common_vendor.index.showToast({
                  title: response.msg || "操作失败",
                  icon: "none",
                  duration: 2e3
                });
              }
            } catch (error) {
              common_vendor.index.hideLoading();
              common_vendor.index.__f__("error", "at pages/ethicalReview/index.vue:614", "重新开始审查失败:", error);
              common_vendor.index.showToast({
                title: "操作失败",
                icon: "error",
                duration: 2e3
              });
            }
          }
        }
      });
    };
    common_vendor.onLoad(async () => {
      dict.value = await utils_dict.useDict(
        "sys_IDType",
        "sys_user_sex",
        "sys_Nation",
        "sys_BloodType",
        "sys_Infectious",
        "sys_AgeUnit",
        "ReviewForm_status",
        "sys_ethical",
        "expert_Conclusion"
      );
      await loadCaseData();
      await stateTotal();
    });
    common_vendor.onShow(() => {
      resetAndLoad();
    });
    common_vendor.onPullDownRefresh(() => {
      onRefresh();
    });
    common_vendor.onReachBottom(() => {
      onLoadMore();
    });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.t(stats.value.count),
        b: common_vendor.t(stats.value.throughCount),
        c: common_vendor.t(stats.value.rejectCount),
        d: common_vendor.t(stats.value.waiveCount),
        e: common_vendor.f(statusOptions.value, (status, k0, i0) => {
          return {
            a: common_vendor.t(status.label),
            b: status.value,
            c: currentStatus.value == status.value ? 1 : "",
            d: common_vendor.o(($event) => selectStatus(status.value), status.value)
          };
        }),
        f: common_vendor.o(handleSearch),
        g: common_vendor.o(($event) => searchKeyword.value = $event),
        h: common_vendor.p({
          placeholder: "搜索捐献者姓名或住院号",
          ["prefix-icon"]: "search",
          clearable: true,
          modelValue: searchKeyword.value
        }),
        i: common_vendor.f(reviewList.value, (review, index, i0) => {
          return common_vendor.e({
            a: "4d58215f-1-" + i0,
            b: common_vendor.t(review.name || "未填写姓名"),
            c: common_vendor.t(review.inpatientno || "无住院号"),
            d: review.expertname
          }, review.expertname ? {
            e: common_vendor.t(review.expertname)
          } : {}, {
            f: common_vendor.t(getReviewStatusText(review)),
            g: common_vendor.n(getReviewStatusClass(review)),
            h: common_vendor.t(review.sex == 1 ? "男" : "女"),
            i: common_vendor.t(getAgeWithUnit(review)),
            j: common_vendor.t(getDictLabel("sys_BloodType", review.bloodtype) || "未知"),
            k: common_vendor.t(review.diagnosisname || "未填写"),
            l: review.createTime
          }, review.createTime ? {
            m: "4d58215f-2-" + i0,
            n: common_vendor.p({
              name: "clock",
              size: "14",
              color: "#909399"
            }),
            o: common_vendor.t(formatDate(review.createTime))
          } : {}, {
            p: review.conclusiontime
          }, review.conclusiontime ? {
            q: "4d58215f-3-" + i0,
            r: common_vendor.p({
              name: "checkmark-circle",
              size: "14",
              color: "#909399"
            }),
            s: common_vendor.t(formatDate(review.conclusiontime))
          } : {}, {
            t: review.expertname
          }, review.expertname ? {
            v: "4d58215f-4-" + i0,
            w: common_vendor.p({
              name: "account",
              size: "14",
              color: "#909399"
            }),
            x: common_vendor.t(review.expertname)
          } : {}, {
            y: review.expertconclusion && review.expertconclusion !== 2
          }, review.expertconclusion && review.expertconclusion !== 2 ? {
            z: common_vendor.t(getConclusionText(review.expertconclusion))
          } : {}, {
            A: review.expertopinion
          }, review.expertopinion ? {
            B: common_vendor.t(review.expertopinion)
          } : {}, {
            C: "4d58215f-5-" + i0,
            D: common_vendor.o(($event) => viewDetail(review), review.id || index),
            E: review.expertconclusion == 1
          }, review.expertconclusion == 1 ? {
            F: "4d58215f-6-" + i0,
            G: common_vendor.p({
              name: "download",
              size: "14",
              color: "#52c41a"
            }),
            H: common_vendor.o(($event) => downloadReport(review), review.id || index)
          } : {}, {
            I: review.expertconclusion == 2
          }, review.expertconclusion == 2 ? {
            J: "4d58215f-7-" + i0,
            K: common_vendor.p({
              name: "arrow-up",
              size: "14",
              color: "#fa8c16"
            }),
            L: common_vendor.o(($event) => submitAppeal(review), review.id || index)
          } : {}, {
            M: review.expertconclusion == 2 || review.expertconclusion == 3
          }, review.expertconclusion == 2 || review.expertconclusion == 3 ? {
            N: "4d58215f-8-" + i0,
            O: common_vendor.p({
              name: "play-circle",
              size: "14",
              color: "#747CF9"
            }),
            P: common_vendor.o(($event) => restartReview(review), review.id || index)
          } : {}, {
            Q: review.id || index,
            R: common_vendor.o(($event) => viewDetail(review), review.id || index)
          });
        }),
        j: common_vendor.p({
          name: "order",
          size: "16",
          color: "#fff"
        }),
        k: common_vendor.p({
          name: "eye",
          size: "14",
          color: "#747CF9"
        }),
        l: common_vendor.p({
          show: loading.value,
          text: "加载中..."
        }),
        m: !loading.value && reviewList.value.length == 0
      }, !loading.value && reviewList.value.length == 0 ? {
        n: common_vendor.t(loading.value),
        o: common_vendor.t(reviewList.value.length),
        p: common_vendor.p({
          name: "file-remove",
          size: "80",
          color: "#C0C4CC"
        }),
        q: common_vendor.o(resetFilters)
      } : {}, {
        r: !hasMore.value && reviewList.value.length > 0
      }, !hasMore.value && reviewList.value.length > 0 ? {} : {}, {
        s: refreshing.value,
        t: common_vendor.o(onRefresh),
        v: common_vendor.o(onLoadMore),
        w: common_vendor.gei(_ctx, "")
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4d58215f"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/ethicalReview/index.js.map