|
@@ -1,44 +1,49 @@
|
|
|
import React, {
|
|
|
- useState, useEffect, useContext
|
|
|
+ useState, useEffect
|
|
|
} from 'react';
|
|
|
-import { Form, Input, Select, Button, Switch, TreeSelect, message, Space,Table } from 'antd';
|
|
|
+import { Input, Table,Row,Col } from 'antd';
|
|
|
import apiObj from '@api/index';
|
|
|
import { getCookie,setCookie } from '@utils/index';
|
|
|
import DiagContext from './Diag-context';
|
|
|
import { useSelector } from 'react-redux'
|
|
|
-import Item from 'antd/lib/list/Item';
|
|
|
const { post, api } = apiObj;
|
|
|
-const { TextArea } = Input;
|
|
|
+const { Search } = Input;
|
|
|
|
|
|
-function AddDiag(props) {
|
|
|
+function MatchDiag(props) {
|
|
|
+ const [DiagList, setDiagList] = useState([]);//当前页列表数据
|
|
|
const [size, setSize] = useState(15);//每页显示条数
|
|
|
const [total, setTotal] = useState(0);
|
|
|
const [current, setCurrent] = useState(1);//当前页
|
|
|
+ const [text,setText] = useState(props.row.name);//输入框中内容
|
|
|
+ const [diagId,setDiagId] = useState(props.row.id);//诊断id
|
|
|
const [params, setParams] = useState({
|
|
|
pages: 1,
|
|
|
current: 1,
|
|
|
- size: 15
|
|
|
+ size: 15,
|
|
|
+ name:""
|
|
|
});
|
|
|
- const [form] = Form.useForm();
|
|
|
- const staticInfo = useSelector(state => {
|
|
|
- return state.staticInfo;
|
|
|
- });
|
|
|
-console.log(props.row)
|
|
|
|
|
|
const columns = [
|
|
|
{ title: 'ICD-10编码', dataIndex: 'icd10',},
|
|
|
{ title: '标准诊断名称', dataIndex: 'standard',},
|
|
|
- { title: '同义词', dataIndex: 'isMapping',},
|
|
|
- ]
|
|
|
+ { title: '同义词', dataIndex: 'synonym',},
|
|
|
+ ];
|
|
|
+ useEffect(() => {
|
|
|
+ //默认显示诊断
|
|
|
+ const param = {...params,name:text.trim(),current:1};
|
|
|
+ getPage(param);
|
|
|
+ }, []);
|
|
|
const rowSelection = {
|
|
|
onChange: (selectedRowKeys, selectedRows) => {
|
|
|
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
|
|
|
+ const param = {icd10:selectedRows[0].icd10,
|
|
|
+ standard:selectedRows[0].standard,
|
|
|
+ synonym:selectedRows[0].synonym,
|
|
|
+ id:diagId
|
|
|
+ };
|
|
|
+ //setParams(param);
|
|
|
+ props.onChange(param);
|
|
|
},
|
|
|
- getCheckboxProps: (record) => ({
|
|
|
- disabled: record.name === 'Disabled User',
|
|
|
- // Column configuration not to be checked
|
|
|
- name: record.name,
|
|
|
- }),
|
|
|
};
|
|
|
//每页显示条数切换
|
|
|
function onSizeChange(current, pageSize) {
|
|
@@ -57,20 +62,38 @@ console.log(props.row)
|
|
|
setParams(params)
|
|
|
getPage()
|
|
|
}
|
|
|
- function getPage() {
|
|
|
-
|
|
|
+ function onSearch(){
|
|
|
+ const param = {...params,name:text.trim(),current:1};
|
|
|
+ setParams({...params,name:text.trim(),current:1});
|
|
|
+ getPage(param);
|
|
|
+ }
|
|
|
+ function onChange(e){
|
|
|
+ const val = e.target.value;
|
|
|
+ setText(val);
|
|
|
+ }
|
|
|
+ function getPage(param) {
|
|
|
+ post(api.getMatchingDiseasePage, param||params).then((res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ const data = res.data.data;
|
|
|
+ setDiagList(data.records);
|
|
|
+ setTotal(data.total)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- const list=[]
|
|
|
-
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
+ <Row gutter={24}>
|
|
|
+ <Col span={12} key={0}>
|
|
|
+ <Search placeholder="请输入诊断" onSearch={onSearch} value={text} onChange={onChange} enterButton style={{marginBottom:'14px'}}/>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
<Table
|
|
|
- rowSelection={{type: 'checkbox',...rowSelection,}}
|
|
|
+ rowSelection={{type: 'radio',...rowSelection,}}
|
|
|
columns={columns}
|
|
|
scroll={{ y: 'calc(100vh - 320px)' }}
|
|
|
- dataSource={list}
|
|
|
- rowKey={record => record.code}
|
|
|
+ dataSource={DiagList}
|
|
|
+ rowKey={(record,i) => {return i+record.icd10}}
|
|
|
pagination={{
|
|
|
current: current,
|
|
|
pageSize: size,
|
|
@@ -89,4 +112,4 @@ console.log(props.row)
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-export default AddDiag;
|
|
|
+export default MatchDiag;
|