Bladeren bron

脉诊报告

cc12458 1 maand geleden
bovenliggende
commit
19ae021ff6

+ 28 - 0
@types/bridge.d.ts

@@ -0,0 +1,28 @@
+interface HandSummary {
+  chi: string;
+  cun: string;
+  guan: string;
+  summary: string[];
+}
+
+type HandKeys = 'chen' | 'chi' | 'fu' | 'hua' | 'kong' | 'ruan' | 'shi' | 'shu' | 'xi' | 'xian';
+
+export class Bridge extends EventTarget {
+  public static getInstance(): Bridge;
+
+  public static pulse(userId: string): Promise<{
+    measureId: string;
+    summaryLabel: {
+      summary?: HandSummary['summary'];
+      left?: HandSummary;
+      right?: HandSummary;
+    };
+    summaryValue: Record<HandKeys, number[]>;
+    time: string;
+
+    appId?: string;
+    userId?: string;
+    url: string;
+    report: string;
+  }>;
+}

+ 6 - 0
@types/global.d.ts

@@ -1,5 +1,8 @@
 export {};
+
 declare global {
+  declare const Bridge: typeof import('./bridge').Bridge;
+
   export interface Platform extends EventTarget {
     pulse(userId?: string): Promise<{
       id: string;
@@ -23,6 +26,9 @@ declare global {
   }
 
   interface Window {
+    /* six-aio 设备注入 */
+    bridge: InstanceType<typeof import('./bridge').Bridge>;
+
     platform: Platform;
     /**
      * webview 设备注入的 全局对象

+ 1 - 0
package.json

@@ -8,6 +8,7 @@
     "build": "run-p type-check \"build-aio {@}\" --",
     "preview": "vite preview --base=/aio/",
     "build-aio": "vite build --base=/aio/",
+    "device": "run-s build-aio preview",
     "type-check": "vue-tsc --build --force",
     "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
     "format": "prettier --write src/"

BIN
src/assets/images/pulse-hand-left.png


BIN
src/assets/images/pulse-hand-right.png


File diff suppressed because it is too large
+ 42 - 0
src/modules/pulse/pulse.page.vue


+ 0 - 17
src/pages/screen.page.vue

@@ -14,7 +14,6 @@ const Visitor = useVisitor();
 
 const title = import.meta.env.SIX_APP_TITLE;
 const { data: visitor, loading: registering, send: register } = useRequest(registerVisitorMethod, { immediate: false, });
-const { data: pulseConfig } = useRequest(pulseMethod, { initialData: { show: false } });
 const { data: copyright, send: load } = useRequest(copyrightMethod).onError(async ({ error }) => {
   await Dialog.show({
     message: error.message,
@@ -181,16 +180,6 @@ onBeforeRouteLeave((to, from) => {
   if (to.path === '/register' || Visitor.patientId) return true;
   return register().then((data) => !!data, () => false);
 });
-
-async function handlePulse() {
-  try {
-    const result = await window.platform.pulse('user-test');
-    Toast.show(`脉诊:${result.id}`, { position: 'bottom' });
-    console.log('log-->', result);
-  } catch (e: any) {
-    Notify.warning(e?.message);
-  }
-}
 </script>
 <template>
   <div class="wrapper">
@@ -208,12 +197,6 @@ async function handlePulse() {
               <span v-else class="van-button__text">开始检测</span>
             </div>
           </div>
-          <div v-if="pulseConfig.show" class="van-button decorate" @click="!(loading || registering) && handlePulse()">
-            <div class="van-button__content">
-              <van-loading v-if="loading || registering" />
-              <span v-else class="van-button__text">脉诊</span>
-            </div>
-          </div>
         </div>
         <div class="flex-none text-xl p-8 text-center" v-html="copyright"></div>
       </div>

+ 18 - 0
src/request/api/flow.api.ts

@@ -60,3 +60,21 @@ export function processMethod2() {
   });
 }
 
+
+export function processMethod3() {
+  const path = unref(Router.currentRoute).path;
+  return HTTP.Post<{ current: Flow; prev: Flow; next: Flow }, { tabletProcessModules?: string[]; }>(`/fdhb-tablet/warrantManage/getPageSets`, {}, {
+    cacheFor, name: `variate:process`,
+    params: { k: 'process', p: path },
+    transform(data) {
+      const options = data.tabletProcessModules ?? [];
+      const ref = fromFlowData(options);
+      const [key, current] = [...ref.entries()].find(([,flow]) => flow.route === path) || [];
+      const prev = [...ref.values()].find(flow => flow.route === key);
+      const next = ref.get(path);
+      if ( !next ) throw { message: `[路由] 配置异常无法解析正确路径,请联系管理员 (${ data?.tabletProcessModules?.join(' -> ') }})` };
+      return { current, prev, next } as any;
+    }
+  })
+}
+

+ 11 - 0
src/request/api/pulse.api.ts

@@ -0,0 +1,11 @@
+import HTTP from '@/request/alova';
+
+export type PulseResult = Awaited<ReturnType<typeof Bridge.pulse>> & { patientId: string; results: string };
+
+export function putPulseMethod(data: PulseResult) {
+  return HTTP.Post<PulseResult, any>(`/fdhb-tablet/analysisManage/savePulseAnalysisReport`, data, {
+    transform() {
+      return data;
+    },
+  });
+}

+ 2 - 0
src/request/model/flow.model.ts

@@ -5,6 +5,8 @@ const Routes = {
   'tongueface_analysis': /* 问卷页 */ '/questionnaire',
   'tongueface_analysis_result': /* 舌面象分析报告页 */ '/report/analysis',
   'health_analysis': /* 健康报告页 */ '/report',
+  'pulse_upload': /* 脉诊页 */ '/pulse',
+  'pulse_upload_result': /* 脉诊结果页 */ '/pulse/result',
 
   'screen': '/screen',
 } as const;

+ 1 - 0
src/router/index.ts

@@ -6,6 +6,7 @@ const router = createRouter({
   routes: [
     { path: '/screen', component: () => import('@/pages/screen.page.vue'), meta: { scan: true } },
     { path: '/register', component: () => import('@/pages/register.page.vue'), meta: { title: '建档', scan: true } },
+    { path: '/pulse', component: () => import('@/modules/pulse/pulse.page.vue'), meta: { title: '脉诊' } },
     { path: '/camera', component: () => import('@/modules/camera/camera.page.vue'), meta: { title: '拍摄' } },
     { path: '/camera/result', component: () => import('@/modules/camera/camera-result.page.vue'), meta: { title: '拍摄完成' } },
     { path: '/questionnaire', component: () => import('@/modules/questionnaire/page.vue'), meta: { title: '问卷' } },

+ 10 - 0
vite.config.ts

@@ -56,5 +56,15 @@ export default defineConfig((configEnv) => {
         },
       },
     },
+    preview: {
+      proxy: {
+        '/manager': {
+          target: "https://wx.hzliuzhi.com:4433",
+          secure: false,
+          changeOrigin: false,
+          logLevel: 'debug',
+        },
+      },
+    }
   };
 });

Some files were not shown because too many files changed in this diff