|
@@ -1,5 +1,5 @@
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
-import { Empty,ConfigProvider,Spin,Form, Input, Button, Table, Select, Space, Modal, message, Row, Col } from 'antd';
|
|
|
+import { Empty, ConfigProvider, Spin, Form, Input, Button, Table, Select, Space, Modal, message, Row, Col } from 'antd';
|
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
|
import { useSelector } from 'react-redux';
|
|
|
import AddDiag from './addDiag'
|
|
@@ -10,15 +10,15 @@ const { post, api } = apiObj;
|
|
|
const { Option } = Select;
|
|
|
//获取列表
|
|
|
function DiagManager() {
|
|
|
- const { diagNum } = useSelector((state) => {
|
|
|
- return state.userInfo;
|
|
|
- });
|
|
|
- useEffect(() => {
|
|
|
- setSize(15)
|
|
|
- setCurrent(1)
|
|
|
- form.resetFields();
|
|
|
- getDiseasePage();
|
|
|
- }, [diagNum]);
|
|
|
+ const { diagNum } = useSelector((state) => {
|
|
|
+ return state.userInfo;
|
|
|
+ });
|
|
|
+ useEffect(() => {
|
|
|
+ setSize(15)
|
|
|
+ setCurrent(1)
|
|
|
+ form.resetFields();
|
|
|
+ getDiseasePage();
|
|
|
+ }, [diagNum]);
|
|
|
const [DiagList, setDiagList] = useState([]);//当前页列表数据
|
|
|
const [Diagid, setDiagid] = useState([]);//当前操作行id
|
|
|
const [title, setTitle] = useState("");//新增/修改的弹窗标题
|
|
@@ -45,52 +45,52 @@ function DiagManager() {
|
|
|
//新增/修改 弹窗flag=1新增,3修改
|
|
|
const showModal = (name, flag1, Diagrow) => {
|
|
|
setVisible(true);
|
|
|
- setFlag(flag1)
|
|
|
+ setFlag(flag1)
|
|
|
setTitle(name);
|
|
|
if (flag1 === 1) {
|
|
|
setFormData({
|
|
|
status: 1,
|
|
|
- uniqueName:'',
|
|
|
- hisName:''
|
|
|
+ uniqueName: '',
|
|
|
+ hisName: ''
|
|
|
})
|
|
|
- }else if (flag1 === 3) {
|
|
|
- console.log(33,Diagrow)
|
|
|
+ } else if (flag1 === 3) {
|
|
|
+ console.log(33, Diagrow)
|
|
|
setFormData(Diagrow)
|
|
|
}
|
|
|
}
|
|
|
//表格数据
|
|
|
function getDiseasePage(param) { //type(必填): 类型:1-化验、3-辅检、4-诊断、5-药品、6-手术和操作
|
|
|
- const hide = message.loading('加载中...',0);
|
|
|
- const hospitalId = localStorage.getItem('hospitalId')
|
|
|
- setloading(true)
|
|
|
- post(api.getTermPage, {...(param || params),type:4,hospitalId:hospitalId}).then((res) => {
|
|
|
+ const hide = message.loading('加载中...', 0);
|
|
|
+ const hospitalId = localStorage.getItem('hospitalId')
|
|
|
+ setloading(true)
|
|
|
+ post(api.getTermPage, { ...(param || params), type: 4, hospitalId: hospitalId }).then((res) => {
|
|
|
hide()
|
|
|
- if (res.data.code === 200) {
|
|
|
+ if (res.data.code === 200) {
|
|
|
const data = res.data.data;
|
|
|
setDiagList(data.records);
|
|
|
setTotal(data.total)
|
|
|
- setloading(false)
|
|
|
+ setloading(false)
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- function showDelModal(id){
|
|
|
- setDelvisible(true);
|
|
|
- setDiagid(id);
|
|
|
+ function showDelModal(id) {
|
|
|
+ setDelvisible(true);
|
|
|
+ setDiagid(id);
|
|
|
}
|
|
|
//删除
|
|
|
function delDiseaseById() {
|
|
|
post(api.deleteRecord, { id: Diagid }).then((res) => {
|
|
|
- setDelvisible(false);
|
|
|
+ setDelvisible(false);
|
|
|
if (res.data.code === 200) {
|
|
|
- //刷新列表
|
|
|
- const totalPage = Math.ceil((total-1) / size);
|
|
|
- //将当前页码与删除数据之后的总页数进行比较,避免当前页码不存在
|
|
|
- const pagenum =
|
|
|
- params.current > totalPage ? totalPage : params.current;
|
|
|
- //避免pagenum变为0
|
|
|
- params.current = pagenum < 1 ? 1 : pagenum;
|
|
|
- setParams(params)
|
|
|
+ //刷新列表
|
|
|
+ const totalPage = Math.ceil((total - 1) / size);
|
|
|
+ //将当前页码与删除数据之后的总页数进行比较,避免当前页码不存在
|
|
|
+ const pagenum =
|
|
|
+ params.current > totalPage ? totalPage : params.current;
|
|
|
+ //避免pagenum变为0
|
|
|
+ params.current = pagenum < 1 ? 1 : pagenum;
|
|
|
+ setParams(params)
|
|
|
getDiseasePage();
|
|
|
setDiagid("");
|
|
|
message.success("删除成功");
|
|
@@ -121,7 +121,7 @@ function DiagManager() {
|
|
|
//筛选查询
|
|
|
const onFinish = (value) => {
|
|
|
const param = {
|
|
|
- ...data,
|
|
|
+ ...params,
|
|
|
...value
|
|
|
}
|
|
|
setCurrent(1)
|
|
@@ -131,7 +131,7 @@ function DiagManager() {
|
|
|
//重置
|
|
|
const onReset = () => {
|
|
|
setCurrent(1)
|
|
|
- setSize(15)
|
|
|
+ setSize(15)
|
|
|
setParams(data)
|
|
|
form.resetFields();
|
|
|
getDiseasePage(data);
|
|
@@ -144,8 +144,8 @@ function DiagManager() {
|
|
|
|
|
|
//新增修改 取消或关闭
|
|
|
function cancel() {
|
|
|
- setVisible(false)
|
|
|
- setFormData([])
|
|
|
+ setVisible(false)
|
|
|
+ setFormData([])
|
|
|
}
|
|
|
|
|
|
function saveMatching(saveParams) {
|
|
@@ -153,7 +153,7 @@ function DiagManager() {
|
|
|
if (res.data.code === 200) {
|
|
|
message.success("匹配成功");
|
|
|
setVisible(false);
|
|
|
- setFormData([])
|
|
|
+ setFormData([])
|
|
|
getDiseasePage();
|
|
|
} else {
|
|
|
message.warning(res.data.message || "匹配失败,请重试");
|
|
@@ -162,32 +162,36 @@ function DiagManager() {
|
|
|
message.warning(error.message || "接口出错,请重试",);
|
|
|
})
|
|
|
}
|
|
|
- const renderEmpty = () => (
|
|
|
- <Empty
|
|
|
- imageStyle={{
|
|
|
- height: 0,
|
|
|
- }}
|
|
|
- description={<span></span>}
|
|
|
- >
|
|
|
- </Empty>
|
|
|
- )
|
|
|
+ const renderEmpty = () => (
|
|
|
+ <Empty
|
|
|
+ imageStyle={{
|
|
|
+ height: 0,
|
|
|
+ }}
|
|
|
+ description={<span></span>}
|
|
|
+ >
|
|
|
+ </Empty>
|
|
|
+ )
|
|
|
const columns = [
|
|
|
{ title: '序号', dataIndex: 'index', render: (text, record, index) => (current - 1) * params.size + index + 1 },
|
|
|
- { title: '操作时间', dataIndex: 'gmtModified', },
|
|
|
+ { title: '操作时间', dataIndex: 'gmtModified', },
|
|
|
{ title: '医院诊断名称', dataIndex: 'hisName', },
|
|
|
{ title: 'ICD-10编码', dataIndex: 'code', },
|
|
|
{ title: '标准诊断名称', dataIndex: 'uniqueName', },
|
|
|
- { title: '标准术语状态', dataIndex: 'status',render: (text, record) => {
|
|
|
- return record.status===1?'启用':record.status===0?'禁用':'';
|
|
|
- }},
|
|
|
- { title: '是否匹配', dataIndex: 'isMatch',render: (text, record) => {
|
|
|
- return record.isMatch===1?'已匹配':'未匹配';
|
|
|
- }},
|
|
|
+ {
|
|
|
+ title: '标准术语状态', dataIndex: 'status', render: (text, record) => {
|
|
|
+ return record.status === 1 ? '启用' : record.status === 0 ? '禁用' : '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '是否匹配', dataIndex: 'isMatch', render: (text, record) => {
|
|
|
+ return record.isMatch === 1 ? '已匹配' : '未匹配';
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
title: '操作', dataIndex: 'key', render: (text, record) => (
|
|
|
<Space size="middle">
|
|
|
- <a onClick={e => showModal('修改诊断信息',3, record)}>修改</a>
|
|
|
- <a style={{color:"#FF4D4D"}} onClick={() => showDelModal(record.id)}>删除</a>
|
|
|
+ <a onClick={e => showModal('修改诊断信息', 3, record)}>修改</a>
|
|
|
+ <a style={{ color: "#FF4D4D" }} onClick={() => showDelModal(record.id)}>删除</a>
|
|
|
</Space>
|
|
|
)
|
|
|
}
|
|
@@ -203,12 +207,12 @@ function DiagManager() {
|
|
|
<Row gutter={24}>
|
|
|
<Col span={5} key={0}>
|
|
|
<Form.Item label="医院诊断名称" name="hisName">
|
|
|
- <Input placeholder="请输入" autoComplete='off' allowClear maxLength='30'/>
|
|
|
+ <Input placeholder="请输入" autoComplete='off' allowClear maxLength='30' />
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
<Col span={5} key={1}>
|
|
|
<Form.Item label="标准诊断名称" name="uniqueName">
|
|
|
- <Input placeholder="请输入" autoComplete='off' allowClear maxLength='30'/>
|
|
|
+ <Input placeholder="请输入" autoComplete='off' allowClear maxLength='30' />
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
<Col span={5} key={2}>
|
|
@@ -226,19 +230,19 @@ function DiagManager() {
|
|
|
</Select>
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
- <Col span={5} key={3}>
|
|
|
- <Form.Item label="标准术语状态" name="status">
|
|
|
- <Select
|
|
|
- showSearch
|
|
|
- optionFilterProp="children"
|
|
|
- placeholder="全部"
|
|
|
- >
|
|
|
- <Option value={''} key={-1}>全部</Option>
|
|
|
- <Option value={0} key={0}>禁用</Option>
|
|
|
- <Option value={1} key={1}>启用</Option>
|
|
|
- </Select>
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
+ <Col span={5} key={3}>
|
|
|
+ <Form.Item label="标准术语状态" name="status">
|
|
|
+ <Select
|
|
|
+ showSearch
|
|
|
+ optionFilterProp="children"
|
|
|
+ placeholder="全部"
|
|
|
+ >
|
|
|
+ <Option value={''} key={-1}>全部</Option>
|
|
|
+ <Option value={0} key={0}>禁用</Option>
|
|
|
+ <Option value={1} key={1}>启用</Option>
|
|
|
+ </Select>
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
<Col span={4} key={4}>
|
|
|
<Form.Item>
|
|
|
<Button type="primary" htmlType="submit">
|
|
@@ -258,33 +262,33 @@ function DiagManager() {
|
|
|
<h2 className="table-title">诊断信息维护</h2>
|
|
|
<Row gutter={12}>
|
|
|
<Col key={0}>
|
|
|
- <Button type="primary" icon={<PlusOutlined />} onClick={e => showModal('新增诊断信息',1)}>新增</Button>
|
|
|
+ <Button type="primary" icon={<PlusOutlined />} onClick={e => showModal('新增诊断信息', 1)}>新增</Button>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
</div>
|
|
|
- <ConfigProvider renderEmpty={loading?renderEmpty:""}>
|
|
|
- <Table
|
|
|
- /*rowSelection={{ type: 'checkbox', ...rowSelection, }}*/
|
|
|
- columns={columns}
|
|
|
- scroll={{ y: 'calc(100vh - 400px)' }}
|
|
|
- dataSource={DiagList}
|
|
|
- rowKey={record => record.id}
|
|
|
-
|
|
|
- pagination={{
|
|
|
- current: current,
|
|
|
- pageSize: size,
|
|
|
- size: 'small',
|
|
|
- showSizeChanger: true,
|
|
|
- pageSizeOptions: ['15', '30', '60', '120'],
|
|
|
- showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条数据`,
|
|
|
- onShowSizeChange: (current, pageSize) => onSizeChange(current, pageSize), // 改变每页数量时更新显示
|
|
|
- onChange: (page, pageSize) => changePage(page, pageSize),//点击页码事件
|
|
|
- total: total
|
|
|
- }} />
|
|
|
- </ConfigProvider>
|
|
|
+ <ConfigProvider renderEmpty={loading ? renderEmpty : ""}>
|
|
|
+ <Table
|
|
|
+ /*rowSelection={{ type: 'checkbox', ...rowSelection, }}*/
|
|
|
+ columns={columns}
|
|
|
+ scroll={{ y: 'calc(100vh - 400px)' }}
|
|
|
+ dataSource={DiagList}
|
|
|
+ rowKey={record => record.id}
|
|
|
+
|
|
|
+ pagination={{
|
|
|
+ current: current,
|
|
|
+ pageSize: size,
|
|
|
+ size: 'small',
|
|
|
+ showSizeChanger: true,
|
|
|
+ pageSizeOptions: ['15', '30', '60', '120'],
|
|
|
+ showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条数据`,
|
|
|
+ onShowSizeChange: (current, pageSize) => onSizeChange(current, pageSize), // 改变每页数量时更新显示
|
|
|
+ onChange: (page, pageSize) => changePage(page, pageSize),//点击页码事件
|
|
|
+ total: total
|
|
|
+ }} />
|
|
|
+ </ConfigProvider>
|
|
|
</div>
|
|
|
{/*<DiagContext.Provider value={{ formData }}>*/}
|
|
|
- <AddDiag formData={formData} termSType={4} termType={4} onOk={saveMatching} title={title} visible={visible} cancel={cancel} flag={flag}/>
|
|
|
+ <AddDiag formData={formData} termSType={4} termType={4} onOk={saveMatching} title={title} visible={visible} cancel={cancel} flag={flag} />
|
|
|
{/*</DiagContext.Provider>*/}
|
|
|
<Modal
|
|
|
maskClosable={false}
|