Browse Source

feat: 患者信息获取

main
wally 2 years ago
parent
commit
e4ac13bb87
  1. 1
      .vscode/settings.json
  2. 15
      api/modules/service.ts
  3. 0
      config/api.ts
  4. 8
      config/service.ts
  5. 21
      manifest.json
  6. 100
      pages.json
  7. 123
      pages/create-aid/create-aid.vue
  8. 47
      pages/detail2/detail2.vue
  9. 3
      pages/patient-list/patient-list.vue
  10. 3
      store/modules/service.ts

1
.vscode/settings.json

@ -3,6 +3,7 @@
"dcloudio",
"easyinput",
"FILESYSTEMS",
"idcard",
"localdata",
"NIHSS",
"nvue",

15
api/modules/service.ts

@ -9,4 +9,19 @@ export const serviceApi = {
// 查急救列表
getAidList: (keywords: string, pageNum = 1, pageSize = 20, sort = '') =>
post('/firstAid/list', { param: { keywords }, pageSize, pageNum, sort }),
// 查数据字典
getDict: (dictType: string) => post('/sys/dict/data/list', { param: { dictType } }),
// 查民族
getNationList: () => post('/sys/nation/list', { param: {} }),
// 扫描身份证
ocrIdCard: (idcardUrl: string) => post('/sys/ocr/idcardInfo', { param: { idcardUrl } }),
// 创建急救
createAid: param => post('/firstAid/create', { param }),
// 查病历数据
getAidInfo: (firstAidId: string, codeList = []) => post('/firstAid/queryAidRecord', { param: { firstAidId, codeList } }),
}

0
config/api.ts

8
config/service.ts

@ -19,3 +19,11 @@ export const AID_STATUS = { 0: '创建', 1: '待审核', 2: '审核通过', 3: '
// 平车状态
export const CAR_STATUS = { 0: '离线', 1: '在线' }
// 疑似诊断
export const FIRST_AID_ZL_TYPE = [
{ value: 0, text: 'AS急性脑卒中' },
{ value: 1, text: 'AMI急性心肌梗死' },
{ value: 2, text: 'ATI急性创伤' },
{ value: 3, text: 'AGB急性消化道出血' },
]

21
manifest.json

@ -101,6 +101,27 @@
"pathRewrite": {
"^/firstAid": ""
}
},
"/sys": {
"target": "http://test.tall.wiki:9002",
"changeOrigin": true,
"pathRewrite": {
"^/sys": ""
}
},
"/common": {
"target": "http://test.tall.wiki:9002",
"changeOrigin": true,
"pathRewrite": {
"^/common": ""
}
},
"/external": {
"target": "http://test.tall.wiki:9002",
"changeOrigin": true,
"pathRewrite": {
"^/external": ""
}
}
}
}

100
pages.json

@ -1,48 +1,54 @@
{
"pages": [
{
"path": "pages/loading/loading",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": ""
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
{
"path": "pages/patient-list/patient-list",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "患者列表"
}
},
{
"path": "pages/detail1/detail1",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "患者详情"
}
},
{
"path": "pages/detail2/detail2",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "患者详情"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "暴风眼质控",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"app-plus": {
"background": "#efeff4"
}
}
}
"pages": [
{
"path": "pages/loading/loading",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": ""
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
{
"path": "pages/patient-list/patient-list",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "患者列表"
}
},
{
"path": "pages/detail1/detail1",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "患者详情"
}
},
{
"path": "pages/detail2/detail2",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "患者详情"
}
},
{
"path": "pages/create-aid/create-aid",
"style": {
"navigationBarTitleText": "create-aid"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "暴风眼质控",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"app-plus": {
"background": "#efeff4"
}
}
}

123
pages/create-aid/create-aid.vue

@ -0,0 +1,123 @@
<template>
<view class="uni-px-10 ">
<uni-section title="患者信息" type="line"> </uni-section>
<uni-forms :modelValue="baseInfo" :label-width="100" class="white uni-radius-lg uni-pa-6">
<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>
<uni-section title="疑似诊断" type="line"> </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>
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()
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>

47
pages/detail2/detail2.vue

@ -13,9 +13,9 @@
<uni-section type="line" title="患者信息" titleFontSize="16px">
<template v-slot:right>
<view class="u-tips-color">
<text class="u-m-r-20">{{ '藏寨' }}</text>
<text class="u-m-r-20">{{ '男' }}</text>
<text>{{ '24' }}</text>
<text class="u-m-r-20">{{ currentPatient?.patientName }}</text>
<text class="u-m-r-20">{{ GET_GENDER_TEXT_BY_CODE(currentPatient!.patientGender) }}</text>
<text>{{ currentPatient?.patientAge }}</text>
</view>
</template>
</uni-section>
@ -27,10 +27,11 @@
<text class="u-m-r-20">患者基本信息</text>
</view>
<view>
<u-tag class="u-m-r-20 u-m-b-12" text="AS急性脑卒中" type="success" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="AS急性脑卒中" type="success" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="AS急性脑卒中" type="success" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="AS急性脑卒中" type="success" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="姓名" type="success" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="性别" type="success" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="民族" type="success" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="身份证" type="success" size="mini" />
<u-tag class="u-m-r-20 u-m-b-12" text="来院方式" type="success" size="mini" />
</view>
</view>
<uni-icons type="right" color="#999" size="16" />
@ -66,9 +67,41 @@
</template>
<script lang="ts" setup>
import { onLoad } from '@dcloudio/uni-app'
import { useServiceStore } from '@/store/modules/service';
import { computed } from 'vue';
import { GET_GENDER_TEXT_BY_CODE } from '@/config/service';
const serviceStore = useServiceStore()
const currentPatient = computed(() => serviceStore.currentPatient)
function onClickRight() {
}
onLoad((option) => {
console.log(option);
if (option?.firstAidId) {
//
getAidInfo(option.firstAidId)
} else {
}
})
//
async function getAidInfo(firstAidId: string) {
try {
const data = await uni.$u.api.getAidInfo(firstAidId)
serviceStore.setCurrentPatient(data)
} catch (error) {
serviceStore.setCurrentPatient(null)
uni.$u.alertError(error)
}
}
</script>
<style lang="scss" scoped>

3
pages/patient-list/patient-list.vue

@ -65,11 +65,10 @@ const searchHeight = ref(100)
const currentAidId = computed(() => serviceStore.currentPatient?.firstAidId)
function onClickItem(event) {
console.log(event.detail);
const { index } = event.detail
if (index === 0) {
//
uni.$u.openPage('detail2')
uni.$u.openPage('create-aid')
} else {
//
const item = data.value[index - 1]

3
store/modules/service.ts

@ -45,10 +45,11 @@ export const useServiceStore = defineStore({
deviceNo: ({ device }) => device?.deviceNo || '',
host: ({ device }) => device?.host || '',
carNo: ({ currentCar }) => currentCar?.carNo || '', // 平车编号
currentFirstAidId: ({ currentPatient }) => currentPatient?.firstAidId,
},
actions: {
setCurrentPatient(patient: IPatient) {
setCurrentPatient(patient: IPatient | null) {
this.currentPatient = patient
},

Loading…
Cancel
Save