Browse Source

feat:基础信息

main
wally 2 years ago
parent
commit
93385cc0b5
  1. 1
      .npmrc
  2. 3
      App.vue
  3. 3
      api/modules/user.ts
  4. 3
      components/CreatePatient/CreatePatient.vue
  5. 150
      components/DetailBase/DetailBase.vue
  6. 7
      config/service.ts
  7. 54
      pages/detail2/detail2.vue
  8. 4
      uni.scss

1
.npmrc

@ -0,0 +1 @@
registry=https://registry.npmmirror.com

3
App.vue

@ -7,8 +7,6 @@ const serviceStore = useServiceStoreWidthOut()
export default {
async onLaunch() {
console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!')
console.log('App Launch')
try {
await uni.$u.api.login()
this.getCarInfo()
@ -25,6 +23,7 @@ export default {
methods: {
async getCarInfo() {
try {
if (!userStore.token) return
const res = await uni.$u.api.getCarInfo()
serviceStore.setCurrentCar(res)
setTimeout(() => {

3
api/modules/user.ts

@ -8,7 +8,8 @@ export const userApi = {
login: async () => {
const localDeviceNo = uni.getStorageSync(uni.$u.LOCAL_KEY.DEVICE_NO)
if (!localDeviceNo) {
uni.showModal({ title: '提示', content: '请先设置平板信息' })
// uni.showModal({ title: '提示', content: '请先设置平板信息' })
uni.$u.toast('请先设置平板信息')
return null
}
try {

3
components/CreatePatient/CreatePatient.vue

@ -85,6 +85,3 @@ function onConfirm() {
})
}
</script>
<style lang="scss" scoped>
</style>

150
components/DetailBase/DetailBase.vue

@ -1,9 +1,151 @@
<template>
<div class="DetailBase">DetailBase</div>
<view class="">
<uni-section type="line" title="患者基本信息" titleFontSize="16px"> </uni-section>
<uni-forms :modelValue="baseInfo" :label-width="100" class="white uni-radius-lg uni-pa-10">
<uni-forms-item label="扫描身份证" name="" @click="onScan">
<view class="flex full-height justify-end">
<uni-icons type="scan" color="#70798C" size="24" />
</view>
</uni-forms-item>
<uni-forms-item label="姓名" name="patientName">
<uni-easyinput type="text" v-model="baseInfo.patientName" placeholder="请输入姓名" />
</uni-forms-item>
<uni-forms-item name="patientGender" label="性别">
<uni-data-checkbox v-model="baseInfo.patientGender" :localdata="GENDER_LIST" />
</uni-forms-item>
<uni-forms-item label="民族" name="patientNation">
<uni-data-select :localdata="nationList" v-model="baseInfo.patientNation" :clear="false" />
</uni-forms-item>
<uni-forms-item label="身份证号" name="patientIdCardNo">
<uni-easyinput type="idcard" v-model="baseInfo.patientIdCardNo" placeholder="请输入身份证号" />
</uni-forms-item>
<uni-forms-item name="patientGender" label="发病时间">
<uni-data-checkbox v-model="baseInfo.patientGender" :localdata="GENDER_LIST" />
</uni-forms-item>
<!-- 发病时间已知显示 -->
<uni-forms-item name="patientGender" label="发病时间">
<uni-datetime-picker type="datetime" :value="single" @change="change" />
</uni-forms-item>
<!-- 发病时间 => 醒后卒中 显示 -->
<uni-forms-item name="patientGender" label="最后正常时间">
<uni-datetime-picker type="datetime" :value="single" @change="change" />
</uni-forms-item>
<uni-forms-item name="patientGender" label="是否院内卒中">
<uni-data-checkbox v-model="baseInfo.patientGender" :localdata="GENDER_LIST" />
</uni-forms-item>
<uni-forms-item name="patientGender" label="到达急诊时间">
<uni-datetime-picker type="datetime" :value="single" @change="change" />
</uni-forms-item>
<uni-forms-item name="patientGender" label="通知卒中医生时间">
<uni-datetime-picker type="datetime" :value="single" @change="change" />
</uni-forms-item>
<uni-forms-item name="patientGender" label="卒中到场时间">
<uni-datetime-picker type="datetime" :value="single" @change="change" />
</uni-forms-item>
<uni-forms-item name="patientGender" label="来院方式">
<uni-datetime-picker type="datetime" :value="single" @change="change" />
</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">
</uni-data-checkbox>
<view class="flex uni-px-6 uni-py-10">
<u-button @click="onSubmit" shape="circle" type="primary" class="bg-main" size="medium">完成创建患者</u-button>
</view>
</view>
</template>
<script lang="ts" setup>
const props = defineProps();
</script>
import { reactive, ref } from 'vue';
import { useUserStore } from '@/store/modules/user'
import { GENDER_LIST, FIRST_AID_ZL_TYPE } from '@/config/service'
import { computed } from 'vue';
const baseInfo = reactive({
patientName: '张三',
patientGender: 0,
patientNation: '汉族',
patientIdCardNo: '142222188901120112',
firstAidZlType: 0
})
const nationList = ref([])
const userStore = useUserStore()
<style lang="scss" scoped></style>
const token = computed(() => userStore.token)
//
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)
}
}
});
}
//
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)
}
}
//
getNationList()
</script>

7
config/service.ts

@ -27,3 +27,10 @@ export const FIRST_AID_ZL_TYPE = [
{ value: 2, text: 'ATI急性创伤' },
{ value: 3, text: 'AGB急性消化道出血' },
]
// 是否发病时间已知
export const fbTimeKnown = [
{ value: '已知', text: '已知' },
{ value: '未知', text: '未知' },
{ value: '醒后卒中', text: '醒后卒中' },
]

54
pages/detail2/detail2.vue

@ -8,8 +8,8 @@
</template>
</uni-nav-bar>
<view class="flex u-m-40 u-m-r-40 align-top content">
<view class="flex-2 u-m-r-20 column">
<view class="flex u-m-40 u-m-r-40 align-top content" v-if="currentPatient">
<view class="flex-1 u-m-r-20 column">
<uni-section type="line" title="患者信息" titleFontSize="16px">
<template v-slot:right>
<view class="u-tips-color">
@ -20,7 +20,7 @@
</template>
</uni-section>
<view class="item-card u-m-r-20 bg-white border-success">
<view class="item-card uni-pa-10 u-m-r-20 bg-white border-success">
<view class="flex">
<view class="flex-1">
<view class=" font-bold flex-1 u-tips-color u-m-b-20">
@ -38,15 +38,30 @@
</view>
</view>
<view class="item-card u-m-r-20 u-m-t-30 bg-white border-primary">
<view class="flex">
<view class="item-card u-m-r-20 u-m-t-30 bg-primary">
<view class="flex count-wrap">
NIHSS评分
<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>
</view>
<view class="flex bg-white item-card-content">
<view class="flex-1">
<view class=" font-bold flex-1 u-tips-color u-m-b-20">
<text class="u-m-r-20">急救信息记录</text>
</view>
<view>
<u-tag class="u-m-r-20 u-m-b-12" text="AS急性脑卒中" type="primary" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="AS急性脑卒中" type="primary" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="身高" type="primary" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="体重" type="primary" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="BMI" type="primary" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="脉搏" type="primary" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="mRS" type="primary" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="NIHSS" type="primary" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="知情同意书" type="primary" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="静脉溶栓" type="primary" size="mini" />
</view>
</view>
<uni-icons type="right" color="#999" size="16" />
@ -56,7 +71,6 @@
<!-- right -->
<view class="flex-3">
<uni-section type="line" title="患者基本信息" titleFontSize="16px"> </uni-section>
<DetailBase />
</view>
</view>
@ -117,10 +131,30 @@ async function getAidInfo(firstAidId: string) {
}
.item-card {
padding: 1em 1em 1em 1.2em;
// padding-left: 10rpx;
border-radius: 20rpx;
background-color: #fff;
border-left: 10rpx solid;
.item-card-content {
margin-left: 0.5em;
border-radius: 10px;
padding: 1em;
}
.count-wrap {
color: #fff;
padding: 1em;
font-weight: bold;
.time-item {
background-color: #fff;
color: $u-type-primary;
padding: 0 2px;
border-radius: 4px;
margin: 0 3px;
}
}
}
.head {

4
uni.scss

@ -14,6 +14,10 @@ $u-type-success: #1bb299;
background: linear-gradient(180deg, #4f8bff, rgba(44, 110, 183, 0));
}
.bg-primary {
background-color: $u-type-primary !important;
}
.border-radius-9-up {
border-radius: 18rpx 18rpx 0 0;
}

Loading…
Cancel
Save