Browse Source

feat: 添加药物使用记录api

develop
song 4 years ago
parent
commit
7ce9b7b4b3
  1. 1
      CHANGELOG.md
  2. 7
      src/apis/yanyuan.js
  3. 14
      src/config/yyInfo.js
  4. 18
      src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue
  5. 2
      src/pagesProject/project/components/ConfigInfo/components/Family.vue
  6. 101
      src/pagesProject/project/components/ConfigInfo/components/Medicine.vue
  7. 4
      src/pagesProject/project/components/GuidePage/GuidePage.vue

1
CHANGELOG.md

@ -64,6 +64,7 @@
- | 添加训练计划详情 | [49f64ca](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/49f64ca)
- | 添加设置界面 | [7ca0c59](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/7ca0c59)
- | 添加输入工具码界面 | [8c120bc](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/8c120bc)
- | 添加选择工具接口 | [98ee58e](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/98ee58e)
- | 添加项目排序 | [a0b491b](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a0b491b)
- | 添加首页弹出按钮及界面 | [edd56cd](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/edd56cd)
- | 点击日历日期查询项目列表 | [c458385](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c458385)

7
src/apis/yanyuan.js

@ -33,6 +33,13 @@ const install = (Vue, vm) => {
// 试题答案保存
vm.$u.api.chooseTool = param => vm.$u.post(`${yanyuan}/trainPlan/chooseTool`, param);
// 添加药物使用
vm.$u.api.addMedicine = param => vm.$u.post(`${yanyuan}/medicine/add`, param);
// 查询药物使用
vm.$u.api.queryMedicine = param => vm.$u.post(`${yanyuan}/medicine/query`, param);
// 修改药物使用
vm.$u.api.updateMedicine = param => vm.$u.post(`${yanyuan}/medicine/update`, param);
};
export default { install };

14
src/config/yyInfo.js

@ -383,32 +383,38 @@ export const medicineInfo = [
date: [
{
name: '是否测评',
label: 'isTest',
type: 1,
value: null,
radioList: ['已测评', '未作测评'],
radioList: ['未作测评', '已测评'],
},
{
name: 'Mmse得分',
label: 'mmseScore',
type: 3,
value: null,
},
{
name: 'Moca得分',
label: 'mocaScore',
type: 3,
value: null,
},
{
name: 'Adi得分',
label: 'adiScore',
type: 3,
value: null,
},
{
name: 'Npi得分',
label: 'npiScore',
type: 3,
value: null,
},
{
name: '总分',
label: 'totalScore',
type: 3,
value: null,
},
@ -419,36 +425,42 @@ export const medicineInfo = [
date: [
{
name: '多奈哌齐',
label: 'firstMedicine',
type: 4,
value: null,
checked: false,
},
{
name: '卡巴拉汀',
label: 'secondMedicine',
type: 4,
value: null,
checked: false,
},
{
name: '石杉碱甲',
label: 'thirdMedicine',
type: 4,
value: null,
checked: false,
},
{
name: '盐酸美金刚片',
label: 'forthMedicine',
type: 4,
value: null,
checked: false,
},
{
name: '奥拉西坦',
label: 'fifthMedicine',
type: 4,
value: null,
checked: false,
},
{
name: '银杏片叶',
label: 'sixthMedicine',
type: 4,
value: null,
checked: false,

18
src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue

@ -20,9 +20,9 @@
<view style="border: 1px solid #e5e5e5" v-if="index === 0">
<Info />
</view>
<Medicine v-if="index === 1" />
<Caregiver v-if="index === 2" />
<Family v-if="index === 3" />
<Medicine @showToast="showToast" v-if="index === 1" />
<Caregiver @showToast="showToast" v-if="index === 2" />
<Family @showToast="showToast" v-if="index === 3" />
</view>
</view>
</view>
@ -31,6 +31,7 @@
<view class="mt-2" style="color: #999">扫码添加客服微信</view>
</view>
</view>
<u-toast ref="uToast"></u-toast>
</scroll-view>
</template>
@ -47,7 +48,7 @@ export default {
itemList: [
{ head: '基本信息', open: true, body: '123', img: 'https://www.tall.wiki/staticrec/yanyuan/menu1.png' },
{ head: '药物使用记录', open: false, body: '123', img: 'https://www.tall.wiki/staticrec/yanyuan/menu2.png' },
{ head: 'Zarit照顾者担量表', open: false, body: '123', img: 'https://www.tall.wiki/staticrec/yanyuan/menu3.png' },
{ head: 'Zarit照顾者担量表', open: false, body: '123', img: 'https://www.tall.wiki/staticrec/yanyuan/menu3.png' },
{ head: '家属成员', open: false, body: '123', img: 'https://www.tall.wiki/staticrec/yanyuan/menu4.png' },
],
headStyle: {
@ -70,6 +71,15 @@ export default {
}
});
},
//
showToast(type, title) {
console.log('type, title: ', type, title);
this.$refs.uToast.show({
type,
title,
});
},
},
};
</script>

2
src/pagesProject/project/components/ConfigInfo/components/Family.vue

@ -7,9 +7,11 @@
<text v-else class="text-gray-400">{{ family.value }}</text>
</view>
</view>
<view class="p-4">
<u-button type="primary" class="m-4">通过</u-button>
<u-button type="error" class="m-4">不通过</u-button>
</view>
</view>
</template>
<script>

101
src/pagesProject/project/components/ConfigInfo/components/Medicine.vue

@ -9,7 +9,7 @@
<view v-if="colItem.type === 1">
<u-radio-group v-model="colItem.value" class="flex items-center">
<u-radio
@change="change($event, index, itemIndex, colItem.type)"
@change="change(radioIndex, index, itemIndex, colItem.type)"
v-for="(radioItem, radioIndex) in colItem.radioList"
:key="radioIndex"
:name="radioItem"
@ -20,7 +20,13 @@
</view>
<!-- 数字输入框 -->
<view v-if="colItem.type === 3" class="pr-7">
<u-input v-model="colItem.value" type="number" :clearable="false" input-align="right" />
<u-input
v-model="colItem.value"
type="number"
:clearable="false"
input-align="right"
@blur="change(colItem.value, index, itemIndex, colItem.type)"
/>
</view>
<!-- 数字输入框+单选 -->
<view v-if="colItem.type === 4" class="flex flex-nowrap items-center">
@ -32,8 +38,9 @@
type="number"
input-align="center"
@focus="cancelChecked(index, itemIndex)"
@blur="change(colItem.value, index, itemIndex, colItem.type)"
/>
<u-checkbox-group @change="change($event, index, itemIndex, colItem.type)">
<u-checkbox-group @change="change($event, index, itemIndex, 99)">
<u-checkbox v-model="colItem.checked" shape="circle">未服用</u-checkbox>
</u-checkbox-group>
</view>
@ -41,10 +48,14 @@
</template>
<view class="w-full h-2 bg-gray-100" v-if="index !== medicineInfo.length - 1"></view>
</view>
<view class="p-4">
<u-button type="primary" v-if="show" @click="addMedicine">添加</u-button>
</view>
</view>
</template>
<script>
import { mapGetters } from 'vuex';
import { medicineInfo } from '@/config/yyInfo';
export default {
@ -59,16 +70,96 @@ export default {
},
bodyStyle: { paddingLeft: '1rem' },
medicineInfo,
show: true,
params: {},
};
},
computed: mapGetters('project', ['projectId']),
mounted() {
this.queryMedicine();
},
methods: {
cancelChecked(index, itemIndex) {
this.medicineInfo[index].date[itemIndex].checked = false;
},
change(e, index, itemIndex, type) {
console.log('e, index, itemIndex, type: ', e, index, itemIndex, type);
this.medicineInfo[index].date[itemIndex].value = e;
let item = this.medicineInfo[index].date[itemIndex];
if (type === 99) {
item.checked = true;
item.value = null;
this.params[item.label] = '未服用';
} else {
item.value = e;
this.params[item.label] = item.value;
}
},
/**
* 查询药物使用
* @param { String } projectId 项目id
*/
async queryMedicine() {
try {
const params = { projectId: this.projectId };
const data = await this.$u.api.queryMedicine(params);
if (!data || !data.id) {
this.show = true;
} else {
this.show = false;
}
} catch (error) {
console.error('error: ', error);
}
},
/**
* 添加药物使用
* @param { Object } params
*/
async addMedicine() {
try {
const params = this.params;
if (!this.validationRequired(params)) return;
params.projectId = this.projectId;
await this.$u.api.addMedicine(params);
this.$emit('showToast', 'success', '药物使用添加成功');
this.show = false;
} catch (error) {
console.error('error: ', error);
this.$emit('showToast', 'error', '药物使用添加失败');
}
},
//
validationRequired() {
let isComplete = true;
for (let i = 0; i < this.medicineInfo.length; i++) {
const info = this.medicineInfo[i];
for (let j = 0; j < info.date.length; j++) {
const item = info.date[j];
if (item.type !== 4) {
if (!item.value) {
this.$t.ui.showToast(`请填写${item.name}`);
isComplete = false;
break;
}
} else {
if (!item.value && !item.checked) {
this.$t.ui.showToast(`请填写${item.name}`);
isComplete = false;
break;
}
}
}
if (!isComplete) {
break;
}
}
if (isComplete) return true;
},
},
};

4
src/pagesProject/project/components/GuidePage/GuidePage.vue

@ -1,5 +1,5 @@
<template>
<swiper @change="changePic" class="swiper" :indicator-dots="true" :autoplay="false">
<swiper @change="changePic" class="swiper" :indicator-dots="true" :autoplay="true" :interval="3000">
<swiper-item v-for="(item, index) in list" :key="index">
<view
class="img h-full"
@ -46,7 +46,7 @@ export default {
if (index === this.list.length - 1) {
setTimeout(() => {
this.$emit('quitGuide');
}, 1500);
}, 3000);
}
},
},

Loading…
Cancel
Save