Browse Source

feat: 详情1

main
wally 2 years ago
parent
commit
5e5665f5f9
  1. 2
      .vscode/settings.json
  2. 208
      components/DetailAidRecord/DetailAidRecord.vue
  3. 82
      config/code.ts
  4. 18
      pages/detail1/detail1.vue
  5. 50
      pages/detail2/detail2.vue
  6. 2
      pages/patient-list/patient-list.vue
  7. BIN
      static/images/plus-white.png

2
.vscode/settings.json

@ -9,11 +9,13 @@
"FILESYSTEMS",
"idcard",
"JBXX",
"JCWB",
"localdata",
"LYFS",
"NIHSS",
"nvue",
"plusempty",
"RYPG",
"SFXHCZ",
"SFYNCZ",
"splashscreen",

208
components/DetailAidRecord/DetailAidRecord.vue

@ -0,0 +1,208 @@
<template>
<view class="">
<uni-section type="line" title="患者急救记录" titleFontSize="16px"> </uni-section>
<uni-forms :modelValue="baseInfo" :label-width="160" class="white uni-radius-lg uni-pa-10">
<uni-forms-item label="身高" name="patientName">
<uni-easyinput type="digit" v-model="baseInfo.patientName" placeholder="请输入姓名" @change="onBaseChange('patientName', $event)" />
</uni-forms-item>
<uni-forms-item name="patientGender" label="性别">
<uni-data-checkbox v-model="baseInfo.patientGender" :localdata="GENDER_LIST"
@change="onBaseChange('patientGender', $event.detail.value)" />
</uni-forms-item>
<uni-forms-item label="民族" name="patientNation">
<uni-data-select :localdata="nationList" v-model="baseInfo.patientNation" :clear="false"
@change="onBaseChange('patientNation', $event)" />
</uni-forms-item>
<uni-forms-item label="身份证号" name="patientIdCardNo">
<uni-easyinput type="idcard" v-model="baseInfo.patientIdCardNo" placeholder="请输入身份证号"
@change="onBaseChange('patientIdCardNo', $event)" />
</uni-forms-item>
<template v-for="(item, key) in codeForm" :key="key">
<uni-forms-item :name="key" :label="CODE_DICT[key].text" v-if="computeShow(key)">
<CodeFormItem :code="key" :value="item" :show="computeShow(key)" @on-change="onChange(key, $event)" />
</uni-forms-item>
</template>
</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>
</view>
</template>
<script lang="ts" setup>
import { reactive, ref, computed, inject } from 'vue';
import type { Ref } from 'vue'
import { useUserStore } from '@/store/modules/user'
import { GENDER_LIST, FIRST_AID_ZL_TYPE } from '@/config/service'
import { CODE_DICT } from '@/config/code';
import { useServiceStore } from '@/store/modules/service';
const firstAidId = inject<Ref<string>>('firstAidId')
const userStore = useUserStore()
const serviceStore = useServiceStore()
const baseInfo = reactive({
patientName: '张三',
patientGender: 0,
patientNation: '汉族',
patientIdCardNo: '142222188901120112',
firstAidZlType: 0
})
const codeForm = reactive({
'JBXX-SFXHCZ': '已知',
'JBXX-FBSJ': '',
'JBXX-ZHZC-TIME': '',
'JBXX-SFYNCZ': '是',
'JBXX-DDJZ-TIME': '',
'JBXX-TZCZYS-TIME': '',
'JBXX-CZYSDC-TIME': '',
'JBXX-LYFS': ''
})
const nationList = ref([])
const token = computed(() => userStore.token)
const currentPatient = computed(() => serviceStore.currentPatient)
//
async function onSubmit() {
const param = { ...baseInfo, }
try {
const { firstAidId, firstAidStatus } = await uni.$u.api.createAid(param)
uni.$u.toast('创建成功')
uni.$u.openPage('detail2', false, `firstAidId=${firstAidId}&firstAidStatus=${firstAidStatus}`)
} catch (error) {
uni.$u.alertError(error)
}
}
//
function onScan() {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
upload(res.tempFilePaths[0])
}
});
}
//
function upload(tempPath: string) {
const host = uni.getStorageSync(uni.$u.LOCAL_KEY.HOST)
if (!host) {
uni.showModal({ title: '提示', content: '请先配置服务器地址' })
return
}
uni.uploadFile({
url: `${host}/sys/ocr/idcardInfo`, //
filePath: tempPath,
name: 'file',
header: { Authorization: `Bearer ${token.value}` },
success: (uploadFileRes) => {
if (!uploadFileRes?.data) {
uni.$u.toast('请求失败')
return
}
const { msg, code, data } = JSON.parse(uploadFileRes.data) as any
if (code === 200) {
const { name, sex, idCardNo, nation } = data
baseInfo.patientName = name || ''
baseInfo.patientGender = sex || ''
baseInfo.patientNation = nation || ''
baseInfo.patientIdCardNo = idCardNo || ''
// handleScan(url)
} else if (code === 401) {
uni.$u.api.login().then(upload(tempPath))
} else {
uni.$u.toast(msg)
}
}
});
}
/**
* 基础信息更新
* @param {string} type 字段名
* @param {string} event 值信息
*/
async function onBaseChange(type: string, event: string) {
console.log(firstAidId?.value);
if (!firstAidId?.value) {
uni.$u.alertError('缺少急救id参数')
return
}
const param = { [type]: event, firstAidId: firstAidId?.value }
try {
await uni.$u.api.updateAidBase(param)
uni.$u.toast('更新成功')
} catch (error) {
uni.$u.alertError(error)
}
}
// code form item change
async function onChange(code: string, value: string) {
codeForm[code] = value
try {
if (!firstAidId?.value) {
uni.$u.alertError('缺少急救id参数')
return
}
const param = { codeAndAnswerList: [{ questionCode: code, answer: [value], time: '' }], firstAidId: firstAidId?.value, sourceId: '', sourceType: '' }
await uni.$u.api.updateAidCode(param)
uni.$u.toast('更新成功')
} catch (error) {
uni.$u.alertError(error)
}
}
// code form
function computeShow(code: string) {
const { showType } = CODE_DICT[code]
if (!showType) return true
return (showType.type === 'value' && codeForm[showType.code] === showType.value)
}
//
async function getNationList() {
try {
const data = await uni.$u.api.getNationList()
nationList.value = data.map((item: string) => ({ value: item, text: item }))
} catch (error) {
uni.$u.alertError(error)
}
}
function init() {
//
getNationList()
// store
if (!currentPatient.value) return
for (const key in baseInfo) {
baseInfo[key] = currentPatient.value[key]
}
// code
const { recordValDict } = currentPatient.value
if (!recordValDict) return
for (const key in codeForm) {
if (!recordValDict[key]) continue
codeForm[key] = recordValDict[key][0]?.answer[0] || ''
}
}
init()
</script>

82
config/code.ts

@ -1,4 +1,5 @@
export const CODE_DICT = {
// 患者基本信息
export const BASE_CODE_DICT = {
'JBXX-SFXHCZ': {
// 是否醒后卒中
text: '发病时间',
@ -72,3 +73,82 @@ export const CODE_DICT = {
default: '',
},
}
export const AID_RECORD_DICT = {
'RYPG-HEIGHT': {
text: '身高',
description: '(cm)',
type: 'input',
inputType: 'digit',
default: '',
},
'RYPG-WEIGHT': {
text: '体重',
description: '(kg)',
type: 'text',
default: '',
},
'RYPG-BMI': {
text: 'BMI',
description: '',
type: 'text',
default: '',
},
'RYPG-SYSTOLIC-PRESSURE': {
text: '收缩压',
description: '(mmHg)',
type: 'input',
inputType: 'digit',
default: '',
},
'RYPG-DIASTOLIC-PRESSURE': {
text: '舒张压',
description: '(mmHg)',
type: 'input',
inputType: 'digit',
default: '',
},
'RYPG-PULSE': {
text: '脉搏',
description: '(次/分)',
type: 'input',
inputType: 'digit',
default: '',
},
'RYPG-MRS': {
text: '本次入院mRS评分',
description: '',
type: 'text',
rightArrow: true,
default: '',
},
'RYPG-NIHSS': {
text: '本次入院NIHSS评分',
description: '',
type: 'text',
rightArrow: true,
default: '',
},
'RYPG-BLOOD-REPORT-TIME': {
text: '血样完成时间',
type: 'datetime',
default: '',
valueType: 'string',
},
'RYPG-BLOOD-SUGAR': {
text: '血糖',
description: '(mol/L)',
type: 'input',
inputType: 'digit',
default: '',
},
'RYPG-CT-JCWB-TIME': {
text: 'CT完成时间',
type: 'datetime',
default: '',
valueType: 'string',
},
}
// all, you know?
export const CODE_DICT = { ...BASE_CODE_DICT }

18
pages/detail1/detail1.vue

@ -2,6 +2,7 @@
<view class="bg-main-r">
<uni-nav-bar dark left-icon="left" background-color="transparent" :border="false" title="患者详情" @clickRight="onClickRight"
@clickLeft="onClickLeft">
<!-- 切换至详情 -->
<template v-slot:right>
<view class="flex nav-right">
切换至详情 <u-image class="icon-change" src="@/static/images/change.png" mode="aspectFill"></u-image>
@ -144,6 +145,11 @@
</template>
<script lang="ts" setup>
import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue';
const firstAidId = ref('')
function onClickLeft() {
console.log('left');
@ -151,7 +157,7 @@ function onClickLeft() {
}
function onClickRight() {
uni.$u.openPage('detail2')
uni.$u.openPage('detail2', true, `firstAidId=${firstAidId.value}`)
}
function uploadImage() {
@ -164,6 +170,16 @@ function uploadImage() {
}
});
}
onLoad((option) => {
if (!option?.firstAidId) {
uni.$u.toast('url中缺少急救id参数')
firstAidId.value = ''
return
}
firstAidId.value = option.firstAidId
})
</script>
<style lang="scss" scoped>

50
pages/detail2/detail2.vue

@ -20,7 +20,8 @@
</template>
</uni-section>
<view class="item-card uni-pa-10 u-m-r-20 bg-white border-success">
<!-- 患者基本信息 -->
<view class="item-card uni-pa-10 u-m-r-20 bg-white border-success" @click="showMode = 'base'">
<view class="flex">
<view class="flex-1">
<view class=" font-bold flex-1 u-tips-color u-m-b-20">
@ -38,7 +39,8 @@
</view>
</view>
<view class="item-card u-m-r-20 u-m-t-30 bg-primary">
<!-- 急救信息记录 -->
<view class="item-card u-m-r-20 u-m-t-30 bg-primary" @click="showMode = 'record'">
<view class="flex count-wrap" v-if="nextNode?.nextStepName">
{{ nextNode.nextStepName }}
@ -67,10 +69,21 @@
<uni-icons type="right" color="#999" size="16" />
</view>
</view>
<view class="btn-create" @click="onCreateRecord">
<image class="icon-plus" src="@/static/images/plus-white.png" mode="scaleToFill" />
急诊溶栓记录
</view>
</view>
<!-- right -->
<view class="flex-3">
<DetailBase />
<!-- 患者基本信息 -->
<DetailBase v-if="showMode === 'base'" />
<!-- 患者急救记录 -->
<DetailAidRecord v-else />
</view>
</view>
@ -88,19 +101,11 @@ const serviceStore = useServiceStore()
const { nextNode, intervalGetNextCode } = useNextNode()
const firstAidId = ref('')
const showMode = ref('base') // base , record
const currentPatient = computed(() => serviceStore.currentPatient)
provide('firstAidId', firstAidId)
onLoad((option) => {
if (option?.firstAidId) {
firstAidId.value = option.firstAidId
//
getAidInfo(option.firstAidId)
} else {
firstAidId.value = ''
}
})
//
async function getAidInfo(firstAidId: string) {
@ -117,6 +122,20 @@ function onClickRight() {
}
function onCreateRecord() {
}
onLoad((option) => {
if (option?.firstAidId) {
firstAidId.value = option.firstAidId
//
getAidInfo(option.firstAidId)
} else {
firstAidId.value = ''
}
})
intervalGetNextCode()
</script>
@ -166,12 +185,15 @@ intervalGetNextCode()
}
.btn-create {
background-color: #fff;
@extend .bg-main;
height: 3em;
padding: 0 3em;
margin: 2em;
// padding: 0 2em;
display: flex;
justify-content: center;
align-items: center;
border-radius: 1.5em;
color: #fff;
.icon-plus {
width: 32rpx;

2
pages/patient-list/patient-list.vue

@ -73,7 +73,7 @@ function onClickItem(event) {
//
const item = data.value[index - 1]
serviceStore.setCurrentPatient(item)
uni.$u.openPage('detail1')
uni.$u.openPage('detail1', false, `firstAidId=${currentAidId.value}`)
}
}

BIN
static/images/plus-white.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

Loading…
Cancel
Save