Browse Source

feat: 急救记录

main
wally 2 years ago
parent
commit
8f41134b0f
  1. 5
      .vscode/settings.json
  2. 64
      components/DetailAidRecord/DetailAidRecord.vue
  3. 36
      config/code.ts
  4. 8
      config/service.ts
  5. 20
      hooks/useNextNode.ts
  6. 4
      main.js
  7. 8
      pages/detail2/detail2.vue
  8. 13
      utils/common.ts

5
.vscode/settings.json

@ -4,12 +4,14 @@
"datetime",
"dcloudio",
"DDJZ",
"DUAN",
"easyinput",
"FBSJ",
"FILESYSTEMS",
"idcard",
"JBXX",
"JCWB",
"JMRS",
"localdata",
"LYFS",
"NIHSS",
@ -23,6 +25,9 @@
"uniui",
"uview",
"vueuse",
"WRSYY",
"WRSYYYPG",
"ZDJG",
"ZHZC"
]
}

64
components/DetailAidRecord/DetailAidRecord.vue

@ -2,7 +2,7 @@
<view class="">
<uni-section type="line" title="患者急救记录" titleFontSize="16px"> </uni-section>
<uni-forms :modelValue="codeAidForm" :label-width="160" class="white uni-radius-lg uni-pa-10">
<uni-forms-item :name="key" v-for="(item, key) in codeAidForm" :key="key">
<uni-forms-item :name="key" v-for="key in part1" :key="key">
<template v-slot:label>
<view class="full-height flex" style="width: 135px">
<!-- @ts-ignore -->
@ -11,27 +11,55 @@
</view>
</template>
<!-- {{ key }} -->
<CodeFormItem :code="key" :value="item" @on-change="onChange(key, $event)" />
<CodeFormItem :code="key" :value="codeAidForm[key]" @on-change="onChange(key, $event)" />
</uni-forms-item>
</uni-forms>
<uni-section type="line" title="疑似诊断" titleFontSize="16px"> </uni-section>
<!-- <uni-data-checkbox mode="list" v-model="baseInfo.firstAidZlType" :localdata="FIRST_AID_ZL_TYPE" class="white uni-radius-lg uni-pa-6"
@change="onBaseChange('firstAidZlType', $event.detail.value)">
</uni-data-checkbox> -->
<uni-section type="line" title="初步判断" titleFontSize="16px"> </uni-section>
<view class="white">
<uni-data-checkbox mode="list" v-model="codeAidForm['RYPG-ZDJG']" :localdata="CHU_BU_PAN_DUAN" class="white uni-radius-lg uni-pa-6"
@change="onChange('RYPG-ZDJG', $event.detail.value)">
</uni-data-checkbox>
<view class="u-p-b-20 u-p-l-30 u-p-r-30" v-if="codeAidForm['RYPG-ZDJG'] === '其他'">
<uni-easyinput v-model="codeAidForm['RYPG-ZDJG-ELSE']" type="text" placeholder="请输入其他" @change="onChange('RYPG-ZDJG-ELSE', $event)" />
</view>
</view>
<uni-section type="line" title="主要治疗操作" titleFontSize="16px"> </uni-section>
<uni-forms :modelValue="codeAidForm" :label-width="160" class="white uni-radius-lg uni-pa-10">
<uni-forms-item label="是否进行静脉溶栓" name="JMRS-Y">
<uni-data-checkbox v-model="codeAidForm['JMRS-Y']" :localdata="CODE_DICT['JMRS-Y'].range"
@change="onChange('JMRS-Y', $event.detail.value)">
</uni-data-checkbox>
</uni-forms-item>
<view class="white">
<view>未溶栓原因</view>
<uni-data-checkbox mode="list" :multiple="true" v-model="codeAidForm['JMRS-WRSYY']" :localdata="CODE_DICT['JMRS-WRSYY'].range"
class="white uni-radius-lg uni-pa-6" @change="onChange('JMRS-WRSYY', $event.detail.value)">
</uni-data-checkbox>
<view class="u-p-b-20 u-p-l-30 u-p-r-30" v-if="codeAidForm['JMRS-WRSYY'].includes('其他')">
<uni-easyinput v-model="codeAidForm['JMRS-WRSYY-ELSE']" type="text" placeholder="请输入其他"
@change="onChange('JMRS-WRSYY-ELSE', $event)" />
</view>
</view>
</uni-forms>
</view>
</template>
<script lang="ts" setup>
import { reactive, computed, inject } from 'vue';
import { reactive, computed, inject, ref } from 'vue';
import type { Ref } from 'vue'
import { GET_GENDER_TEXT_BY_CODE } from '@/config/service'
import { GET_GENDER_TEXT_BY_CODE, CHU_BU_PAN_DUAN } from '@/config/service'
import { useServiceStore } from '@/store/modules/service';
import { CODE_DICT } from '@/config/code';
import { computeBMI } from '@/utils/common'
const firstAidId = inject<Ref<string>>('firstAidId')
const serviceStore = useServiceStore()
const part1 = ['RYPG-HEIGHT', 'RYPG-WEIGHT', 'RYPG-GENDER', 'RYPG-BMI', 'RYPG-SYSTOLIC-PRESSURE', 'RYPG-DIASTOLIC-PRESSURE', 'RYPG-PULSE', 'RYPG-MRS', 'RYPG-NIHSS', 'RYPG-BLOOD-REPORT-TIME', 'RYPG-BLOOD-SUGAR', 'RYPG-CT-LK-TIME']
const codeAidForm = reactive({
'RYPG-HEIGHT': '',
'RYPG-WEIGHT': '',
@ -44,10 +72,18 @@ const codeAidForm = reactive({
'RYPG-NIHSS': '',
'RYPG-BLOOD-REPORT-TIME': '',
'RYPG-BLOOD-SUGAR': '',
'RYPG-CT-LK-TIME': ''
'RYPG-CT-LK-TIME': '',
'RYPG-ZDJG': '', //
'RYPG-ZDJG-ELSE': '', // -
'JMRS-Y': '',
'JMRS-WRSYY': [''],
'JMRS-WRSYY-ELSE': ''
})
const currentPatient = computed(() => serviceStore.currentPatient)
const currentCar = computed(() => serviceStore.currentCar)
// code form item change
async function onChange(code: string, value: string) {
@ -57,7 +93,11 @@ async function onChange(code: string, value: string) {
uni.$u.alertError('缺少急救id参数')
return
}
const param = { codeAndAnswerList: [{ questionCode: code, answer: [value], time: '' }], firstAidId: firstAidId?.value, sourceId: '', sourceType: '' }
if (code === 'RYPG-HEIGHT') {
codeAidForm['RYPG-BMI'] = computeBMI(value, codeAidForm['RYPG-WEIGHT'])
}
const answer = typeof value === 'string' ? [value] : value
const param = { codeAndAnswerList: [{ questionCode: code, answer, time: '' }], firstAidId: firstAidId?.value, sourceId: '', sourceType: '' }
await uni.$u.api.updateAidCode(param)
uni.$u.toast('更新成功')
} catch (error) {
@ -79,7 +119,9 @@ function init() {
codeAidForm[key] = recordValDict[key][0]?.answer[0] || ''
}
codeAidForm['RYPG-GENDER'] = GET_GENDER_TEXT_BY_CODE[patientGender]
codeAidForm['RYPG-GENDER'] = GET_GENDER_TEXT_BY_CODE(patientGender) || ''
codeAidForm['RYPG-WEIGHT'] = currentCar.value?.sensorWeight?.toString() || ''
codeAidForm['RYPG-BMI'] = computeBMI(codeAidForm['RYPG-HEIGHT'], codeAidForm['RYPG-WEIGHT'])
}

36
config/code.ts

@ -158,6 +158,42 @@ export const AID_RECORD_DICT = {
default: '',
valueType: 'string',
},
'JMRS-Y': {
text: '是否进行静脉溶栓',
type: 'radio',
default: '是',
range: [
{ value: '是', text: '是' },
{ value: '否', text: '否' },
],
},
'JMRS-WRSYY': {
text: '未溶栓原因',
type: 'checkbox',
default: '',
range: [
{ value: '超时间创', text: '超时间创' },
{ value: '禁忌症', text: '禁忌症' },
{ value: '患者/家属拒绝', text: '患者/家属拒绝' },
{ value: '其他', text: '其他' },
],
showType: {
type: 'value',
code: 'JMRS-Y',
value: '否',
},
},
'JMRS-WRSYY-ELSE': {
text: '',
type: 'input',
default: '',
showType: {
type: 'valueInclude',
code: 'JMRS-WRSYY',
value: '其他',
},
},
}
// all, you know?

8
config/service.ts

@ -34,3 +34,11 @@ export const fbTimeKnown = [
{ value: '未知', text: '未知' },
{ value: '醒后卒中', text: '醒后卒中' },
]
// 初步判断
export const CHU_BU_PAN_DUAN = [
{ value: '缺血性脑卒中', text: '缺血性脑卒中' },
{ value: '出血性脑卒中', text: '出血性脑卒中' },
{ value: '短暂性脑缺血发作', text: '短暂性脑缺血发作' },
{ value: '其他', text: '其他' },
]

20
hooks/useNextNode.ts

@ -1,8 +1,13 @@
import { computed, onUnmounted, ref } from 'vue'
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import { onUnload } from '@dcloudio/uni-app'
import { toDouble } from '@/utils/common'
import { useServiceStore } from '@/store/modules/service'
dayjs.extend(duration)
export interface INextNode {
countDownInSeconds: string
firstAidId: number
@ -30,6 +35,19 @@ export function useNextNode() {
}
}
// 距下一个节点的剩余时间
const leftTime = computed(() => {
const res = { hours: '00', minutes: '00', seconds: '' }
if (!nextNode.value?.countDownInSeconds) return res
const totalSeconds = Number(nextNode.value.countDownInSeconds)
res.seconds = toDouble(dayjs.duration(totalSeconds).seconds())
res.minutes = toDouble(dayjs.duration(totalSeconds).minutes())
res.hours = toDouble(dayjs.duration(totalSeconds).hours())
return res
})
// 循环查下个节点
function intervalGetNextCode() {
timer && clearInterval(timer)
@ -50,5 +68,5 @@ export function useNextNode() {
timer && clearInterval(timer)
timer = 0
})
return { nextNode, getNextNode, intervalGetNextCode }
return { nextNode, getNextNode, intervalGetNextCode, leftTime }
}

4
main.js

@ -1,7 +1,7 @@
import * as Pinia from 'pinia'
import * as service from '@/config/service'
import { alertError, openPage } from '@/utils/common'
import { alertError, openPage, toDouble } from '@/utils/common'
import App from './App.vue'
import { LOCAL_KEY } from '@/config/local'
@ -13,6 +13,8 @@ import uView from './uni_modules/vk-uview-ui'
uni.$u.openPage = openPage
uni.$u.alertError = alertError
uni.$u.toDouble = toDouble
uni.$u.LOCAL_KEY = LOCAL_KEY
uni.$u.service = { ...service }

8
pages/detail2/detail2.vue

@ -45,9 +45,9 @@
{{ nextNode.nextStepName }}
<view class="flex-1 flex justify-end">
<view class="time-item">00</view> :
<view class="time-item">00</view> :
<view class="time-item">00</view>
<view class="time-item">{{ leftTime.hours }}</view> :
<view class="time-item">{{ leftTime.minutes }}</view> :
<view class="time-item">{{ leftTime.seconds }}</view>
</view>
</view>
<view class="flex bg-white item-card-content">
@ -98,7 +98,7 @@ import { GET_GENDER_TEXT_BY_CODE } from '@/config/service';
import { useNextNode } from '@/hooks/useNextNode'
const serviceStore = useServiceStore()
const { nextNode, intervalGetNextCode } = useNextNode()
const { nextNode, intervalGetNextCode, leftTime } = useNextNode()
const firstAidId = ref('')
const showMode = ref('base') // base , record

13
utils/common.ts

@ -25,3 +25,16 @@ export function alertError(error: any) {
}
uni.showModal({ title: '提示', content: msg, showCancel: false })
}
// 时间数字统一成两位
export function toDouble(num: number): string {
return num.toString().padStart(2, '0')
}
// 计算bmi
export function computeBMI(height: string, weight: string): string {
if (!height || !weight || height === '0') return ''
const h = Number(height)
const w = Number(weight)
return (w / ((h * h) / 100 / 100)).toFixed(2)
}

Loading…
Cancel
Save