123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- import React, { useState, useEffect, useRef } from 'react';
- import { useSelector, useDispatch } from 'react-redux';
- import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space, message } from 'antd';
- import '@common/common.less';
- import moment from "moment";
- import "moment/locale/zh-cn"
- import './index.less'
- import apiObj from '@api/index';
- import EditProblem from './editProblem';
- import ProblemContext from './problem-context';
- import { getValueFromEvent, disabledDate, getDaysBetween } from '@utils/index'
- const { post, api, xPost } = apiObj;
- const { Option } = Select;
- function FieldProblem() {
-
- const [logList, setLogList] = useState([]);
- const [total, setTotal] = useState(0);
- const [type, setType] = useState(0);//1新增 2修改
- const [visible, setVisible] = useState(false);
- const [size, setSize] = useState(15);
- const [current, setCurrent] = useState(1);
- const [probleData, setProbleData] = useState({});
- const [problemDetail, setProblemDetail] = useState(null);//详情数据
- const [title, setTitle] = useState();//正则式数据
- const [modeList, setModeList] = useState([]);//质控模块
- const [params, setParams] = useState({
- pages: 1,
- current: 1,
- size: 15,
- asc: ['isSolved'],
- desc: ['solveTime', 'behospitalCode'],
- behospitalStartDate: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
- behospitalEndDate: getCurrentData().split('/').join('-') + ' 23:59:59'
- });
- const [form] = Form.useForm();
- let data = {
- pages: 1,
- current: 1,
- size: size,
- asc: ['isSolved'],
- desc: ['solveTime', 'behospitalCode'],
- behospitalStartDate: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
- behospitalEndDate: getCurrentData().split('/').join('-') + ' 23:59:59'
- }
- let date = {
- behospitalStartDate: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
- behospitalEndDate: getCurrentData().split('/').join('-') + ' 23:59:59'
- }
- const { problemNum } = useSelector((state) => {
- return state.userInfo;
- });
- useEffect(() => {
- form.resetFields();
- getColumnResultPage();
- getColumnResultNumber(date)
- getModeName()
- }, [problemNum]);
- //表格数据
- function getColumnResultPage(param) {
- post(api.getColumnResultPage, param || params).then((res) => {
- if (res.data.code === 200) {
- const data = res.data.data;
- setLogList(data.records);
- setTotal(data.total)
- }
- })
- }
- function getColumnResultNumber(param) {
- post(api.getColumnResultNumber, {
- hospitalId: localStorage.getItem('hospitalId'),
- ...param
- }).then((res) => {
- if (res.data.code === 200) {
- const data = res.data.data || [];
- setProbleData(data)
- }
- })
- }
- function getModeName(name) {
- post(api.getModeName, {
- modeName: name
- }).then((res) => {
- if (res.data.code === 200) {
- const data = res.data.data || [];
- setModeList(data)
- }
- })
- }
- function onSearch(val) {
- getModeName(val)
- }
- function showModal(title, row, type) {
- setVisible(true)
- setProblemDetail(row)
- setTitle(title)
- setType(type)
- }
- //返回
- function cancel() {
- setVisible(false)
- setProblemDetail(null)
- }
- function userChange() {
- params.current = 1
- setParams(params)
- setCurrent(1)
- setVisible(false)
- getColumnResultPage();
- getColumnResultNumber({ behospitalStartDate: params.behospitalStartDate, behospitalEndDate: params.behospitalEndDate })
- setProblemDetail(null)
- }
- function onSizeChange(current, pageSize) {
- params.current = current
- params.size = pageSize
- setSize(pageSize)
- setCurrent(current)
- setParams(params)
- getColumnResultPage()
- }
- function changePage(page, pageSize) {
- params.current = page
- params.size = pageSize
- setParams(params)
- setCurrent(page)
- getColumnResultPage()
- }
- const onFinish = (value) => {
- value.behospitalStartDate = moment(value.behospitalStartDate).format('YYYY-MM-DD 00:00:00');
- value.behospitalEndDate = moment(value.behospitalEndDate).format('YYYY-MM-DD 23:59:59');
- if (value.behospitalStartDate > value.behospitalEndDate) {
- message.warning('开始时间不能大于结束时间');
- return
- } else if (getDaysBetween(value.behospitalStartDate, value.behospitalEndDate) > 364) {
- message.warning('开始时间与结束时间相差不能超过一年');
- return
- }
- const param = {
- ...data,
- ...value,
- }
- setCurrent(1)
- setParams(param)
- getColumnResultPage(param);
- getColumnResultNumber({ behospitalStartDate: value.behospitalStartDate, behospitalEndDate: value.behospitalEndDate })
- };
- const onReset = () => {
- setCurrent(1)
- setParams(data)
- form.resetFields();
- getColumnResultPage(data);
- getColumnResultNumber(date)
- };
- function getCurrentDataFront() {
- let time = new Date((new Date() - 30 * 24 * 3600 * 1000)).toLocaleDateString()
- return time
- }
- // 结束时间
- function getCurrentData() {
- let time = new Date().toLocaleDateString()
- return time
- }
- const columns = [
- { title: '序号', dataIndex: 'index', render: (text, record, index) => (current - 1) * params.size + index + 1 },
- { title: '住院序号', dataIndex: 'behospitalCode', key: 'behospitalCode' },
- {
- title: '文书编号', dataIndex: 'hosptialDatatmpCode', key: 'hosptialDatatmpCode', render: (text, record) => {
- return record.hosptialDatatmpCode || '-';
- }
- },
- {
- title: '文书标题', dataIndex: 'hosptialDatatmpName', key: 'hosptialDatatmpName', render: (text, record) => {
- return record.hosptialDatatmpName || '-';
- }
- },
- { title: '质控模块名称', dataIndex: 'modeName', key: 'modeName' },
- { title: '表名称(中文)', dataIndex: 'tableCname', key: 'tableCname' },
- { title: '表名称(英文)', dataIndex: 'tableEname', key: 'tableEname' },
- { title: '字段名称(中文)', dataIndex: 'columnCname', key: 'columnCname' },
- { title: '字段名称(英文)', dataIndex: 'columnEname', key: 'columnEname' },
- {
- title: '上传字段值', dataIndex: 'tableVal', key: 'tableVal', render: (text, record) => {
- return record.tableVal ? record.tableVal.length > 8 ? <span title={record.tableVal}>{record.tableVal.substring(0, 8) + '...'}</span> : record.tableVal : '-';
- }
- },
- {
- title: '备注', dataIndex: 'description', key: 'description', render: (text, record) => {
- return record.description ? record.description.length > 20 ? <span title={record.description}>{record.description.substring(0, 20) + '...'}</span> : record.description : '-';
- }
- },
- {
- title: '问题类型', dataIndex: 'type', render: (text, record) => {
- return record.type == 1 ? "数据缺失" : record.type == 2 ? "非标准值" : "正则校验失败";
- }
- },
- {
- title: '更新时间', dataIndex: 'gmtModified', key: 'gmtModified', render: (text, record) => {
- return record.gmtModified || '-';
- }
- },
- {
- title: '状态', dataIndex: 'isRequired', key: 'isRequired', render: (text, record) => {
- return record.isSolved == 1 ? "已处理" : record.isSolved == 0 ? "未处理" : "-";
- }
- },
- {
- title: '操作', dataIndex: 'key', render: (text, record) => (
- <Space size="middle">
- <a onClick={e => showModal('修改字段校验问题明细', record, 3)}>修改</a>
- </Space>
- )
- }
- ];
- return (
- <div className="wrapper">
- <div className="filter-box">
- <Form
- form={form}
- name="normal_login"
- onFinish={onFinish}
- initialValues={{
- isSolved: '', type: '', behospitalStartDate: moment(getCurrentDataFront()), behospitalEndDate: moment(getCurrentData())
- }}
- >
- <Row gutter={24}>
- <Col span={7} key={0}>
- <Form.Item label="日期" >
- <Form.Item name="behospitalStartDate" className='times'>
- <DatePicker
- allowClear={false}
- disabledDate={disabledDate}
- placeholder="请选择开始日期"
- />
- </Form.Item>
- <span style={{ margin: '0 5px', position: 'relative', top: '2px' }}>-</span>
- <Form.Item name="behospitalEndDate" className='times'>
- <DatePicker
- allowClear={false}
- disabledDate={disabledDate}
- placeholder="请选择结束日期"
- />
- </Form.Item>
- </Form.Item>
- </Col>
- <Col span={5} key={1}>
- <Form.Item label="住院序号" name="behospitalCode" getValueFromEvent={getValueFromEvent}>
- <Input placeholder="请输入" autoComplete='off' allowClear maxLength='30' />
- </Form.Item>
- </Col>
- <Col span={5} key={2}>
- <Form.Item label="文书编号" name="hosptialDatatmpCode" getValueFromEvent={getValueFromEvent}>
- <Input placeholder="请输入" autoComplete='off' allowClear maxLength='30' />
- </Form.Item>
- </Col>
- <Col span={5} key={3}>
- <Form.Item label="文书标题" name="hosptialDatatmpName" getValueFromEvent={getValueFromEvent}>
- <Input placeholder="请输入" autoComplete='off' allowClear maxLength='30' />
- </Form.Item>
- </Col>
- <Col span={5} key={4}>
- <Form.Item label="质控模块名称" name="modeName" >
- <Select showSearch allowClear onSearch={onSearch} placeholder="请选择">
- {modeList.map((item, i) => {
- return (
- <Option value={item} key={i}>{item}</Option>
- )
- })}
- </Select>
- </Form.Item>
- </Col>
- <Col span={4} key={5}>
- <Form.Item label="问题类型" name="type">
- <Select
- placeholder="请选择"
- allowClear
- >
- <Option value="" key={0}>全部</Option>
- <Option value="1" key={1}>数据缺失</Option>
- <Option value="2" key={2}>非标准值</Option>
- <Option value="3" key={3}>正则校验失败</Option>
- </Select>
- </Form.Item>
- </Col>
- <Col span={4} key={7}>
- <Form.Item label="状态" name="isSolved">
- <Select
- placeholder="请选择"
- allowClear
- >
- <Option value="" key={3}>全部</Option>
- <Option value="0" key={0}>未处理</Option>
- <Option value="1" key={1}>已处理</Option>
- </Select>
- </Form.Item>
- </Col>
- <Col span={4} key={8}>
- <Form.Item>
- <Button type="primary" htmlType="submit">
- 查询
- </Button>
- <Button onClick={onReset}>
- 重置
- </Button>
- </Form.Item>
- </Col>
- </Row>
- </Form>
- </div>
- <div className="table">
- <div className="table-header">
- <h2 className="table-title">字段校验问题明细</h2>
- <Space size="middle">
- <Button type="primary" onClick={() => showModal('数据校验设置', { behospitalCode: '', time: '' }, 1)}>数据校验</Button>
- </Space>
- </div>
- <div className="table-data" style={{ justifyContent: 'left' }}>
- <Row className="data-box">
- <Col span={6} order={1} className="box-item">
- <p>{probleData.notSolvedNonnull || probleData.notSolvedNonnull == 0 ? probleData.notSolvedNonnull : '-'}</p>
- <p>数据缺失</p>
- </Col>
- <Col span={6} order={2} className="box-item">
- <p>{probleData.notSolvedStandardvalue || probleData.notSolvedStandardvalue == 0 ? probleData.notSolvedStandardvalue : '-'}</p>
- <p>非标准值</p>
- </Col>
- <Col span={6} order={3} className="box-item">
- <p>{probleData.notSolvedRegular || probleData.notSolvedRegular == 0 ? probleData.notSolvedRegular : '-'}</p>
- <p>正则校验失败</p>
- </Col>
- <Col span={6} order={4} className="box-item item">
- <p>{probleData.notSolved || probleData.notSolved == 0 ? probleData.notSolved : '-'}</p>
- <p>未处理</p>
- </Col>
- </Row>
- <Row className="data-box">
- <Col span={6} order={1} className="box-item">
- <p>{probleData.resolvedNonnull || probleData.resolvedNonnull == 0 ? probleData.resolvedNonnull : '-'}</p>
- <p>数据缺失</p>
- </Col>
- <Col span={6} order={2} className="box-item">
- <p>{probleData.resolvedStandardvalue || probleData.resolvedStandardvalue == 0 ? probleData.resolvedStandardvalue : '-'}</p>
- <p>非标准值</p>
- </Col>
- <Col span={6} order={3} className="box-item">
- <p>{probleData.resolvedRegular || probleData.resolvedRegular == 0 ? probleData.resolvedRegular : '-'}</p>
- <p>正则校验失败</p>
- </Col>
- <Col span={6} order={4} className="box-item box">
- <p>{probleData.resolved || probleData.resolved == 0 ? probleData.resolved : '-'}</p>
- <p>已处理</p>
- </Col>
- </Row>
- </div>
- <Table
- columns={columns}
- scroll={{ y: 'calc(100vh - 570px)' }}
- dataSource={logList}
- rowKey={record => record.id}
- pagination={{
- pageSize: size,
- size: 'small',
- current: current,
- 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
- }} />
- </div>
- {visible && problemDetail ?
- <Modal
- title={title}
- okText='确定'
- cancelText='取消'
- width="500px"
- visible={visible}
- onCancel={cancel}
- footer={null}
- forceRender={true}
- maskClosable={false}
- >
- <ProblemContext.Provider value={{ problemDetail, type }}>
- <EditProblem cancel={cancel} userChange={userChange} />
- </ProblemContext.Provider>
- </Modal>
- : ''}
- </div >
- )
- }
- export default FieldProblem;
|