aBin 5 years ago
parent
commit
c4f0ecebe5
  1. 137
      src/components/PatientInfo/PatientTable.vue
  2. 59
      src/components/PatientInfo/Search.vue
  3. 3
      src/config/api.js
  4. 54
      src/views/SelectPatient/SelectPatient.vue

137
src/components/PatientInfo/PatientTable.vue

@ -0,0 +1,137 @@
<template>
<div>
<!-- search -->
<div style="width:100%" v-if="lists && lists.list && lists.list.length > 0">
<a-table
:columns="columns"
:data-source="lists.list"
:loading="loading"
:pagination="pagination"
:row-key="record => record.id"
@change="handleTableChange"
bordered
class="white pa-3"
>
<template slot="id" slot-scope="text, record, index">
<span>{{ index + 1 }}</span>
</template>
<template slot="inputStatus" slot-scope="text, record">
<span>
{{ record.inputStatus === 0 ? '新建'
: record.inputStatus === 1 ? '数据搜集中'
: record.inputStatus === 2 ? '数据搜集完成'
: record.inputStatus === 3 ? '数据搜集超时'
: '废弃' }}
</span>
</template>
<template slot="edit" slot-scope="text, record">
<a-button @click="chooseItem(record.id)" class="ml-4" size="small" type="primary">选择</a-button>
</template>
</a-table>
</div>
<a-empty v-else />
</div>
</template>
<script>
const columns = [
{
title: '序号',
align: 'center',
dataIndex: 'id',
key: 'id',
scopedSlots: { customRender: 'id' },
},
{
title: '住院号',
align: 'center',
dataIndex: 'hospitalization',
key: 'hospitalization',
},
{
title: '对照组',
align: 'center',
dataIndex: 'inpatientId',
key: 'inpatientId',
},
{
title: '状态',
align: 'center',
dataIndex: 'inputStatus',
key: 'inputStatus',
scopedSlots: { customRender: 'inputStatus' },
},
{
title: '编辑',
align: 'center',
dataIndex: 'edit',
key: 'edit',
width: 200,
scopedSlots: { customRender: 'edit' },
},
];
export default {
name: 'PatientTable',
props: { lists: { type: Object, default: null } },
data() {
return {
columns,
loading: false,
};
},
computed: {
pagination() {
const { pageNum, pageSize, total } = this.lists;
return {
current: pageNum,
pageSize,
total: +total,
};
},
},
methods: {
//
chooseItem() {
console.log();
},
handleTableChange(pagination) {
const { current } = pagination;
this.$emit('handleSelPatientMes', current);
},
//
// async handleSelPatientMes(pageNum = 1) {
// try {
// const params = {
// param: {
// hospitalization: '',
// id: 0,
// inpatientId: '',
// inputStatus: 0,
// pageNum,
// pageSize: 10,
// },
// };
// const res = await selPatientMes(params);
// const { code, msg, data } = res.data;
// if (code === 200) {
// this.lists = data;
// } else {
// this.$message.error(msg || '');
// throw msg;
// }
// } catch (error) {
// throw new Error(`CaseSearch.vue method selSearchCriteriaList: ${error}`);
// }
// },
},
};
</script>

59
src/components/PatientInfo/Search.vue

@ -0,0 +1,59 @@
<template>
<!-- search -->
<a-form
:form="form"
@submit="handleSubmit"
class="d-flex flex-nowrap align-center"
layout="inline"
>
<a-form-item>
<a-input placeholder="住院号" style="width: 14em" v-decorator="['inpatientNumber']" />
</a-form-item>
<a-form-item>
<a-select
@change="handleGroupChange"
class="flex-1"
v-decorator="['groupValue',{ initialValue: groupValue }]"
>
<a-select-option :key="item.id" :value="item.value" v-for="item in groups">{{ item.name }}</a-select-option>
</a-select>
</a-form-item>
<a-button class="mr-4" html-type="submit" icon="search" type="primary">搜索</a-button>
<div class="flex-1"></div>
<a-button html-type="submit" icon="plus" type="primary">新增</a-button>
</a-form>
</template>
<script>
export default {
name: 'Search',
data() {
return {
form: this.$form.createForm(this, { name: 'search' }),
groups: [
{ id: '1', value: '1', name: '对照组一' },
{ id: '2', value: '2', name: '对照组二' },
{ id: '3', value: '3', name: '对照组三' },
],
groupValue: '对照组一',
};
},
methods: {
//
handleGroupChange(value) {
console.log('value: ', value);
},
//
handleSubmit(e) {
e.preventDefault();
this.form.validateFields(async (err, values) => {
if (!err) {
this.$emit('searchPatientMes', values);
}
});
},
},
};
</script>

3
src/config/api.js

@ -10,6 +10,9 @@ export const saveCaseMes = params => axios.post(`${patient}/saveCaseMes`, params
// 添加患者基本信息
export const savePatientMes = params => axios.post(`${patient}/savePatientMes`, params);
// 查询患者基本信息
export const selPatientMes = params => axios.post(`${patient}/selPatientMes`, params);
// 通过搜索条件查询患者病例的信息
export const selPatientMesList = params => axios.post(`${patient}/selPatientMesList`, params);

54
src/views/SelectPatient/SelectPatient.vue

@ -1,15 +1,63 @@
<template>
<div>选择患者信息</div>
<div class="d-flex flex-column">
<search @searchPatientMes="searchPatientMes" />
<patient-table :lists="lists" @handleSelPatientMes="handleSelPatientMes" class="mt-3" />
</div>
</template>
<script>
import Search from 'components/PatientInfo/Search.vue';
import PatientTable from 'components/PatientInfo/PatientTable.vue';
import { selPatientMes } from 'config/api';
export default {
name: 'SelectPatient',
components: { Search, PatientTable },
data() {
return {};
return {
lists: { pageNum: 1, pageSize: 10, total: 1, list: [] },
hospitalization: '',
inpatientId: '',
};
},
created() {
this.handleSelPatientMes();
},
methods: {},
methods: {
searchPatientMes(value) {
this.hospitalization = value.inpatientNumber;
this.inpatientId = value.groupValue;
this.handleSelPatientMes();
},
async handleSelPatientMes(pageNum = 1) {
try {
const { hospitalization, inpatientId } = this;
const params = {
param: {
hospitalization,
id: 0,
inpatientId,
inputStatus: 0,
pageNum,
pageSize: 10,
},
};
const res = await selPatientMes(params);
const { code, msg, data } = res.data;
if (code === 200) {
this.lists = data;
} else {
this.$message.error(msg || '查询失败');
throw msg;
}
} catch (error) {
throw new Error(`CaseSearch.vue method selSearchCriteriaList: ${error}`);
}
},
},
};
</script>

Loading…
Cancel
Save