Browse Source

图片识别

master
aBin 4 years ago
parent
commit
407dbbffd9
  1. 7
      src/App.vue
  2. 5
      src/config/api.js
  3. 11
      src/store/modules/home/state.js
  4. 89
      src/views/PatientInfo/PatientInfo.vue

7
src/App.vue

@ -1,3 +1,10 @@
<!--
* @Author: wally
* @email: 18603454788@163.com
* @Date: 2021-02-22 09:20:03
* @LastEditors: wally
* @LastEditTime: 2021-04-01 22:02:43
-->
<template>
<a-config-provider :locale="zh_CN">
<div class="d-flex flex-row flex-nowrap" id="app">

5
src/config/api.js

@ -3,7 +3,7 @@
* @email: 18603454788@163.com
* @Date: 2021-01-29 11:16:27
* @LastEditors: wally
* @LastEditTime: 2021-02-19 18:01:03
* @LastEditTime: 2021-04-01 19:25:20
*/
import axios from 'axios';
let { proxyUrl } = require('@/config/setting');
@ -99,3 +99,6 @@ export const generatePatientReport = params => axios.post(`${question}/generateP
// 查询认知量表的搜索条件
export const searchParam = params => axios.post(`${question}/patientReport/searchParam`, params);
// 图像识别
export const basic = params => axios.post(`${tcm}/ocr/general/basic`, params);

11
src/store/modules/home/state.js

@ -1,12 +1,19 @@
/*
* @Author: wally
* @email: 18603454788@163.com
* @Date: 2021-02-22 09:20:03
* @LastEditors: wally
* @LastEditTime: 2021-04-01 19:58:27
*/
const state = {
anyringToken: '',
user: { id: '', phone: '', account: '' },
controlGroups: [], // 对照组
patientId: '', // 病患id
patientId: '1369189040502611968', // 病患id
hospitalization: '', // 病患住院号
previewInfo: { host: '', place: '', startTime: '', endTime: '', participants: '', meetingMinutes: '', discussionContent: '' }, // 预览信息
ptProps: null, // 接受PT传过来的 pluginId,projectId,roleId,taskId,userId
hospitalId: '', // 医院Id
hospitalId: 1, // 医院Id
caseData: null, // 病例 搜索/分析 下的认知量表所做的每道题,每次改变重新存一次
};

89
src/views/PatientInfo/PatientInfo.vue

@ -16,6 +16,7 @@
<!-- 一级标题下的各种问题questionVos判断类型1-12展示不同需要填写的内容 -->
<div v-for="a in item.questionVos" :key="a.name">
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" :label="a.question">
<a-button type="primary" v-if="a.reportType === 1">123</a-button>
<a-input v-model="a.answer" :max-length="500" v-if="a.type === 1" @change="onChange($event, a.type, a.id, a.recordId)" />
<a-textarea
v-model="a.answer"
@ -473,12 +474,30 @@
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
<!-- 二级大标题 -->
<span class="hhh2"> {{ w.name }}</span>
<a-upload
v-if="w.recordType"
name="files"
:multiple="true"
:action="action"
:headers="headers"
@change="handleChange($event, w.code, w.recordId)"
>
<!-- <a-upload :multiple="true" :action="action" :headers="headers" @change="handleChange"> -->
<a-button> <a-icon type="upload" />上传图片</a-button>
</a-upload>
</a-form-item>
<!-- 二级标题下的各种类型 -->
<div v-for="e in w.questionVos" :key="e.name">
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" :label="e.question">
<a-input :max-length="500" v-model="e.answer" v-if="e.type === 1" @change="onChange($event, e.type, e.id, e.recordId)" />
<a-input
:id="e.id"
:max-length="500"
v-model="e.answer"
v-if="e.type === 1"
@change="onChange($event, e.type, e.id, e.recordId)"
/>
<a-textarea
:id="e.id"
:max-length="500"
v-model="e.answer"
v-else-if="e.type === 2"
@ -966,7 +985,7 @@
<script>
import { mapState } from 'vuex';
import { queryAll, saveCaseMes, upload } from 'config/api';
import { queryAll, saveCaseMes, upload, basic } from 'config/api';
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 12 },
@ -1006,23 +1025,31 @@ export default {
getCode: '',
visible: false,
confirmLoading: false,
recordTypeList: [],
};
},
computed: {
...mapState('home', ['patientId', 'hospitalization']),
...mapState('home', ['patientId', 'hospitalization', 'hospitalId']),
//
headers() {
const token = sessionStorage.getItem('anyringToken');
return { Authorization: `Bearer ${token}` };
},
},
watch: {
tabNums(val) {
if (typeof val === 'number') {
this.getQuery();
}
},
recordTypeList() {
for (let i = 0; i < this.recordTypeList.length; i++) {
var dom = document.getElementById(`${this.recordTypeList[i].questionId}`);
dom.value = this.recordTypeList[i].content;
}
},
},
async created() {
console.log(this.patientId);
@ -1095,6 +1122,7 @@ export default {
}
},
onChange(e, type, id, recordId) {
console.log(e);
//
if (this.contentList.find(item => item.testQuestionsId === id)) {
if (type === 1) {
@ -1355,6 +1383,61 @@ export default {
}
}
},
//
async handleChange(info, title, recordId) {
if (info.file.status === 'done') {
console.log(info.file.response.data[0].visitUrl);
const params = {
param: {
hospitalId: this.hospitalId,
code: title,
url: info.file.response.data[0].visitUrl,
},
};
const res = await basic(params);
const { code, msg, data } = res.data;
if (code === 200) {
this.changeType(data, recordId);
this.changeType(data, recordId);
console.log(this.contentList);
} else {
console.log(msg);
}
}
},
async changeType(data) {
await this.changeTypeList(data);
// // contentList
for (let i = 0; i < data.length; i++) {
if (this.contentList.length > 0) {
for (let k = 0; k < this.contentList.length; k++) {
//
if (data[i].questionId === this.contentList[k].testQuestionsId) {
this.contentList[k].contents = data[i].content;
break;
//
} else if (k === this.contentList.length - 1) {
let obj = {
testQuestionsId: data[i].questionId,
contents: data[i].content,
};
this.contentList.push(obj);
break;
}
}
} else {
let obj = {
testQuestionsId: data[i].questionId,
contents: data[i].content,
};
this.contentList.push(obj);
}
}
},
changeTypeList(data) {
this.recordTypeList = data;
},
//
// changeDate(date) {
// this.subDateTime = this.$moment(date._d).format('YYYY-MM-DD HH:mm:ss');

Loading…
Cancel
Save