Commit 062c2498 authored by songrui's avatar songrui

包名称修改

parent 123fdba7
<template>
<div class="h-full chronic-home">
<div class="h-full resident-home">
<router-view v-slot="{ Component }">
<Transition name="route" mode="out-in">
<component :is="Component" v-if="visible"/>
......
......@@ -33,7 +33,7 @@
</template>
<script>
import { useStore } from '@/chronic/store/index.js'
import { useStore } from '@/resident/store/index.js'
import { idCardRule } from '@/utils/commonReg.js'
export default {
......
......@@ -2,26 +2,14 @@ import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
{
path: '/tumour',
name: 'tumour',
component: () => import(/* webpackChunkName: "page-tumour" */ '@/tumour/Tumour.vue'),
children: [
{
path: 'screening/simple/form',
name: 'tumour-screening-simple-form',
component: () => import(/* webpackChunkName: "page-tumour" */ '@/tumour/screening/simple/form/Index.vue')
}
]
},
{
path: '/chronic',
name: 'chronic',
component: () => import(/* webpackChunkName: "page-chronic" */ '@/chronic/Chronic.vue'),
path: '/resident',
name: 'resident',
component: () => import(/* webpackChunkName: "page-resident" */ '@/resident/Resident.vue'),
children: [
{
path: 'screening/first/form',
name: 'chronic-screening-first-form',
component: () => import(/* webpackChunkName: "page-chronic" */ '@/chronic/screening/first/form/Index.vue')
name: 'resident-screening-first-form',
component: () => import(/* webpackChunkName: "page-resident" */ '@/resident/screening/first/form/Index.vue')
}
]
},
......
<template>
<div class="h-full tumour-home">
<router-view v-slot="{ Component }">
<Transition name="route" mode="out-in">
<component :is="Component"/>
</Transition>
</router-view>
</div>
</template>
<script>
import { getDict } from './api/base.js'
import { useStore } from './store/index.js'
export default {
created() {
this.init()
},
setup() {
const store = useStore()
return { store }
},
methods: {
init() {
getDict().then(res => {
this.store.$patch({ dict: res.data })
})
}
}
}
</script>
<style lang="less" scoped>
</style>
import { fetchBase } from '@/utils/fetch.js'
import { setSessionStorage, getSessionStorage } from '@/utils/common.js'
// 获取字典
export function getDict() {
return fetchBase({ url: `/tumour-admin/v1/h5-app/dict`, loading: true })
}
// 区划编码查询下级
export function getAreaChild(parentCode, loading = true) {
const key = 'tumour-area-cache'
return new Promise((resolve, reject) => {
const result = getSessionStorage(key) || {}
if (result[parentCode]) {
resolve(result[parentCode])
return
}
fetchBase({ url: `/tumour-admin/v1/h5-app/child-area/${parentCode}`, loading }).then(res => {
result[parentCode] = res.data
setSessionStorage(key, result)
resolve(res.data)
}).catch(err => {
reject(err)
})
})
}
// 居民基本信息查询
export function getResidentInfo(idCard) {
return fetchBase({ url: `/tumour-admin/v1/h5-app/residents/${idCard}`, loading: true })
}
import { fetchBase } from '@/utils/fetch.js'
// 简易筛查 新增
export function addSimpleScreen(params, loading = true) {
return fetchBase({ url: `/tumour-admin/v1/h5-app/add-simple-screen`, body: params, loading })
}
This diff is collapsed.
<template>
<div class="h-full flex flex-col ">
<div class="p-3 text-16 text-black text-center shrink-0 top-bar">
<span class="back-bt" @click="onBack" v-if="setp === 2">
<doc-icon type="doc-left" />
</span>
<span>肿瘤风险评估</span>
</div>
<div class="grow overflow-y-auto pb-5">
<BaseForm ref="base" v-show="setp === 1"/>
<QuestionForm ref="question" v-if="setp === 2"
:species="species"/>
<Result v-if="setp === 3" :info="resultInfo"/>
<div class="bt-group">
<van-button type="primary" block v-if="setp === 1"
@click="onNext">下一步</van-button>
<van-button type="primary" block v-else-if="setp === 2"
@click="submit">提交</van-button>
</div>
</div>
<div class="pb-5"></div>
</div>
</template>
<script>
import BaseForm from './base.vue'
import QuestionForm from './Question.vue'
import Result from './Result.vue'
import { showNotify } from 'vant'
import { addSimpleScreen } from '@/tumour/api/screening.js'
import { fetchDataHandle } from '@/utils/common.js'
export default {
components: {
BaseForm,
QuestionForm,
Result
},
data() {
return {
// 操作步骤
setp: 1,
// 步骤1中选中的癌种
species: [],
// 基础用户信息
baseInfo: {},
// 提交结果信息
resultInfo: {}
}
},
computed: {
routeQuery() {
return this.$route.query
},
doctorId() {
return this.routeQuery.doctorId
}
},
created() {
if (!this.doctorId) {
showNotify({ type: 'warning', message: '未获取到医生信息', duration: 0 })
}
},
methods: {
init() {
},
onBack() {
this.setp = 1
},
onNext() {
if (!this.doctorId) return
this.$refs.base.submit().then(res => {
console.log(res)
this.baseInfo = res
this.species = res.species || []
this.setp = 2
})
},
submit() {
this.$refs.question.submit().then(res => {
const result = {
...this.baseInfo,
details: res,
createdUserId: this.doctorId
}
const query = fetchDataHandle(result, {
species: 'arrToStr'
})
console.log(query)
addSimpleScreen(query).then(res => {
this.resultInfo = {
species: result.species,
details: result.details,
unitName: res.data
}
this.setp = 3
})
})
}
}
}
</script>
<style lang="less" scoped>
.top-bar {
position: relative;
border-bottom: 1px solid #0000001A;
.back-bt {
position: absolute;
left: .16rem;
}
}
.bt-group {
padding: 0 10%;
}
</style>
<template>
<div class="question-form">
<span ref="top"></span>
<van-form label-width="100%" ref="form">
<template v-for="(item, index) in formData" :key="index">
<div class="px-4 py-2 title">{{item.title}}</div>
<van-field :name="q.key" v-for="(q, i) in item.issue" :key="i"
:label="q.title"
:rules="[{ required: true, message: '请选择' }]">
<template #input>
<van-radio-group v-model="q.value" @change="onChange($event, item)" class="pl-2">
<van-radio v-for="a in q.answer.cont" shape="dot" class="mt-2"
:name="a.value" :key="a.value">{{a.name}}</van-radio>
</van-radio-group>
</template>
</van-field>
<van-field name="highRisk" label="筛查结论" label-width="4.5em">
<template #input>
<van-radio-group v-model="item.highRisk" direction="horizontal">
<van-radio v-for="r in store.getDict('DC00071')" shape="dot"
:name="r.value" :key="r.value">{{r.name}}</van-radio>
</van-radio-group>
</template>
</van-field>
<div class="remark" v-if="item.remark && item.highRisk === 1">
{{ item.remark }}
</div>
</template>
</van-form>
</div>
</template>
<script>
import { getQuestion } from '../config.js'
import { useStore } from '@/tumour/store/index.js'
export default {
props: {
// 筛查癌种 获取对应的问卷
species: Array
},
data() {
return {
formData: [],
}
},
setup() {
const store = useStore()
return { store }
},
created() {
this.init()
},
mounted() {
const dom = this.$refs['top']
if (!dom) return
dom.scrollIntoView()
},
methods: {
init() {
if (!this.species) return
this.species.forEach(e => {
this.formData.push(getQuestion(e))
})
console.log(this.formData)
},
onChange(val, item) {
// console.log(val, item)
// console.log('高危判断', item.check())
item.highRisk = item.check() ? 1 : 2
},
submit() {
return new Promise((resolve) => {
this.$refs.form.validate().then(res => {
console.log(res, this.formData)
const result = {}
this.formData.forEach(e => {
const issue = {}
e.issue.forEach(i => {
issue[i.key] = i.value
})
result[e.key] = {
highRisk: e.highRisk,
...issue
}
})
resolve(result)
}).catch(err => {
console.warn(err)
})
})
}
}
}
</script>
<style lang="less" scoped>
@import '@/tumour/utils/common.less';
.remark {
border: 1px solid #F0F0F0;
padding: 10px;
color: #595959;
background-color: #FAFAFA;
margin: 10px 16px;
line-height: 1.5;
}
</style>
<template>
<div class="p-4 form-result">
<div v-for="item in list" :key="item.key" class="p-3 mb-4 list-item">
<div class="mb-2">
<span class="mr-2 font-semibold">{{ item.title }}</span>
<span v-if="item.status == 1" class="tag-red">高风险</span>
<span v-else class="tag-green">无高风险</span>
</div>
<div style="color: #8C8C8C;" class="mb-2">{{ item.date }}</div>
<div class="mb-2 flex items-center tip" v-if="item.status == 1">
<doc-icon type="doc-exclamation-circle" class="text-16"/>
<span class="ml-2">建议到 {{ item.unitName }} 进行检查</span>
</div>
<div style="line-height: 1.5" v-if="item.status == 1">
备注:{{ item.remark }}
</div>
</div>
</div>
</template>
<script>
import { getDictValue } from '@/tumour/utils/dictionaries.js'
import { getQuestion } from '@/tumour//screening/simple/config.js'
import dayjs from 'dayjs'
export default {
props: {
info: { default: () => ({}) }
},
data() {
return {
list: []
}
},
created() {
const { species = [], details = {}, unitName = '本单位' } = this.info
// console.log(species, details, unitName)
species.forEach(e => {
const q = getQuestion(e)
this.list.push({
key: e,
title: getDictValue('DC00032', e) + '筛查结果',
status: details[e].highRisk,
remark: q.remark,
date: dayjs().format('YYYY.MM.DD'),
unitName
})
})
}
}
</script>
<style lang="less" scoped>
.list-item {
border: 1px solid #F0F0F0;
}
.font-12 {
font-size: 12px;
}
.tip {
background-color: #F8FAFC;
color: #768092;
padding: 4px 12px;
}
.tag-red {
color: #F5222D;
background-color: #FFF1F0;
padding: 4px 6px;
border-radius: 2px;
}
.tag-green {
color: #52C41A;
background-color: #D9F7BE;
padding: 4px 6px;
border-radius: 2px;
}
</style>
This diff is collapsed.
import { defineStore } from 'pinia'
export const useStore = defineStore('tumour', {
state: () => {
return {
// 字典
dict: []
}
},
getters: {},
actions: {
getDict(val) {
if (!val) return []
return this.dict[val] || []
}
}
})
.title {
font-weight: 600;
display: flex;
align-items: center;
&::before {
content: '';
display: inline-block;
background: #1890FF;
height: 16px;
width: 4px;
margin-right: 4px;
}
}
\ No newline at end of file
import { useStore } from '@/tumour/store/index.js'
/**
* 获取字典值
* @param {String | Array} dict
* @param {String} value
* @returns
*/
export function getDictValue(dict, value) {
const store = useStore()
let array = []
if (typeof dict === 'string') {
array = store.getDict(dict)
} else {
array = dict
}
if (!array || !array.length) {
return ''
}
let temp = array.find(e => e.value == value) || {}
return temp.name || ''
}
/**
* 获取字典数组
* @param {String} dict
*/
export function getDict(dict) {
const store = useStore()
return store.getDict(dict) || myDict()[dict] || []
}
// 自定义字典
function myDict() {
return {
MY001: [
{ name: '-', value: '-' },
{ name: '±', value: '±' },
{ name: '+', value: '+' },
{ name: '++', value: '++' },
{ name: '+++', value: '+++' },
{ name: '++++', value: '++++' }
]
}
}
<template>
<van-cascader class="address-select"
:closeable="false"
v-model="innerValue"
title="请选择所在地区"
:options="areaData"
@change="onChange"
@close="() => $emit('close')"
/>
</template>
<script>
import { getAreaChild } from '@/tumour/api/base.js'
import { fetchDataHandle } from '@/utils/common.js'
export default {
name: 'DocAddress',
props: {
value: [String, Number],
viewData: Array,
},
emits: ['update:value', 'change', 'close'],
data() {
return {
innerValue: '',
areaData: []
}
},
created() {
this.init()
},
methods: {
async init() {
if (!this.areaData.length) {
const res = await getAreaChild('0')
this.areaData = this.dataField(res || [])
}
if (this.value) {
const temp = fetchDataHandle({ value: this.value }, {
value: 'addToArr'
})
await this.viewHandle(temp.value)
}
// console.log(this.areaData)
},
loadData(options) {
const targetOption = options[options.length - 1]
targetOption.loading = true
getAreaChild(targetOption.value).then(res => {
targetOption.children = this.dataField(res || [], options.length === 4)
this.areaData = [...this.areaData]
}).finally(() => {
targetOption.loading = false
})
},
dataField(data, last = false) {
return data.map(e => {
return {
text: e.areaName,
value: e.areaCode,
id: e.id,
isLeaf: last
}
})
},
// 回显处理
async viewHandle(val = []) {
try {
const length = val.length
let current = this.areaData.find(e => e.value === val[0])
let index = 1
while (index < length) {
const res = await getAreaChild(current.value)
const result = res || []
if (!result.length) break
current.children = this.dataField(result, index === 4)
current = current.children.find(e => e.value === val[index])
this.areaData = [...this.areaData]
if (!current) break
index++
}
} catch(err) {
console.warn(err)
}
},
onChange(val) {
// console.log(val, this.areaData)
const tabIndex = val.tabIndex
const options = val.selectedOptions
const targetOption = options[options.length - 1]
if (tabIndex < 4 ) {
getAreaChild(val.value).then(res => {
targetOption.children = this.dataField(res || [], options.length === 4)
this.areaData = [...this.areaData]
})
}
this.$emit('update:value', val.value)
this.$emit('change', val)
if (tabIndex === 4 ) {
this.$emit('close')
}
}
},
watch: {
value: {
handler(val) {
this.innerValue = val
},
immediate: true
},
// 地址同步使用
viewData(val) {
this.viewHandle(val)
}
}
}
</script>
<style lang="less" scoped>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment