index.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. import React, { useState, useEffect, useRef } from 'react';
  2. import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space, message } from 'antd';
  3. import { getCookie, disabledDate } from '@utils/index'
  4. import '@common/common.less';
  5. import moment from "moment";
  6. import "moment/locale/zh-cn"
  7. import './index.less'
  8. import apiObj from '@api/index';
  9. import EditProblem from './editProblem';
  10. import ProblemContext from './problem-context';
  11. import { getValueFromEvent } from '@utils/index'
  12. const { post, api, xPost } = apiObj;
  13. const { RangePicker } = DatePicker;
  14. const { Option } = Select;
  15. function FieldProblem() {
  16. useEffect(() => {
  17. getColumnResultPage();
  18. getColumnResultNumber(date)
  19. getModeName()
  20. }, []);
  21. const [logList, setLogList] = useState([]);
  22. const [total, setTotal] = useState(0);
  23. const [type, setType] = useState(0);//1新增 2修改
  24. const [visible, setVisible] = useState(false);
  25. const [size, setSize] = useState(15);
  26. const [current, setCurrent] = useState(1);
  27. const [probleData, setProbleData] = useState({});
  28. const [problemDetail, setProblemDetail] = useState(null);//详情数据
  29. const [title, setTitle] = useState();//正则式数据
  30. const [modeList, setModeList] = useState([]);//质控模块
  31. const [params, setParams] = useState({
  32. pages: 1,
  33. current: 1,
  34. size: 15,
  35. solveTimeStart: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
  36. solveTimeEnd: getCurrentData().split('/').join('-') + ' 23:23:59'
  37. });
  38. const [date, setDate] = useState({
  39. solveTimeStart: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
  40. solveTimeEnd: getCurrentData().split('/').join('-') + ' 23:23:59'
  41. });
  42. const [form] = Form.useForm();
  43. let data = {
  44. pages: 1,
  45. current: 1,
  46. size: size,
  47. solveTimeStart: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
  48. solveTimeEnd: getCurrentData().split('/').join('-') + ' 23:23:59'
  49. }
  50. //表格数据
  51. function getColumnResultPage(param) {
  52. post(api.getColumnResultPage, param || params).then((res) => {
  53. if (res.data.code === 200) {
  54. const data = res.data.data;
  55. setLogList(data.records);
  56. setTotal(data.total)
  57. }
  58. })
  59. }
  60. function getColumnResultNumber(param) {
  61. post(api.getColumnResultNumber, {
  62. hospitalId: getCookie('hospitalId'),
  63. ...param
  64. }).then((res) => {
  65. if (res.data.code === 200) {
  66. const data = res.data.data || [];
  67. setProbleData(data)
  68. }
  69. })
  70. }
  71. function getModeName(name) {
  72. post(api.getModeName, {
  73. modeName: name
  74. }).then((res) => {
  75. if (res.data.code === 200) {
  76. const data = res.data.data || [];
  77. setModeList(data)
  78. }
  79. })
  80. }
  81. function onSearch(val) {
  82. getModeName(val)
  83. }
  84. //修改
  85. function showModal(title, row, type) {
  86. setVisible(true)
  87. setProblemDetail(row)
  88. setTitle(title)
  89. setType(type)
  90. }
  91. //返回
  92. function cancel() {
  93. setVisible(false)
  94. setProblemDetail(null)
  95. }
  96. function userChange() {
  97. setVisible(false)
  98. getColumnResultPage();
  99. getColumnResultNumber(date)
  100. setProblemDetail(null)
  101. }
  102. function onSizeChange(current, pageSize) {
  103. params.current = current
  104. params.size = pageSize
  105. setSize(pageSize)
  106. setCurrent(current)
  107. setParams(params)
  108. getColumnResultPage()
  109. }
  110. function changePage(page, pageSize) {
  111. params.current = page
  112. params.size = pageSize
  113. setParams(params)
  114. setCurrent(page)
  115. getColumnResultPage()
  116. }
  117. const onFinish = (value) => {
  118. if (value.time) {
  119. value.solveTimeStart = moment(value.time[0]).format('YYYY-MM-DD 00:00:00');
  120. value.solveTimeEnd = moment(value.time[1]).format('YYYY-MM-DD 23:23:59');
  121. }
  122. delete value.time
  123. const param = {
  124. ...data,
  125. ...value,
  126. }
  127. setDate({ solveTimeStart: value.solveTimeStart, solveTimeEnd: value.solveTimeEnd })
  128. setCurrent(1)
  129. setParams(param)
  130. getColumnResultPage(param);
  131. getColumnResultNumber({ solveTimeStart: value.solveTimeStart, solveTimeEnd: value.solveTimeEnd })
  132. };
  133. const onReset = () => {
  134. setCurrent(1)
  135. setParams(data)
  136. form.resetFields();
  137. getColumnResultPage(data);
  138. };
  139. function getCurrentDataFront() {
  140. let time = new Date((new Date() - 30 * 24 * 3600 * 1000)).toLocaleDateString()
  141. return time
  142. }
  143. // 结束时间
  144. function getCurrentData() {
  145. let time = new Date().toLocaleDateString()
  146. return time
  147. }
  148. const columns = [
  149. { title: '序号', dataIndex: 'index', render: (text, record, index) => (current - 1) * params.size + index + 1 },
  150. { title: '住院序号', dataIndex: 'behospitalCode', key: 'behospitalCode' },
  151. { title: '文书编号', dataIndex: 'hosptialDatatmpCode', key: 'hosptialDatatmpCode' },
  152. { title: '文书标题', dataIndex: 'hosptialDatatmpName', key: 'hosptialDatatmpName' },
  153. { title: '质控模块名称', dataIndex: 'modeName', key: 'modeName' },
  154. { title: '表名称(中文)', dataIndex: 'tableCname', key: 'tableCname' },
  155. { title: '表名称(英文)', dataIndex: 'tableEname', key: 'tableEname' },
  156. { title: '字段名称(中文)', dataIndex: 'columnCname', key: 'columnCname' },
  157. { title: '字段名称(英文)', dataIndex: 'columnEname', key: 'columnEname' },
  158. { title: '上传字段值', dataIndex: 'tableVal', key: 'tableVal' },
  159. {
  160. title: '备注', dataIndex: 'description', key: 'description', render: (text, record) => {
  161. return (record.description || "-").length > 20 ? <span title={record.description}>{record.description.substring(0, 20) + '...'}</span> : record.description;
  162. }
  163. },
  164. {
  165. title: '问题类型', dataIndex: 'type', render: (text, record) => {
  166. return record.type == 1 ? "数据缺失" : record.type == 2 ? "非标准值" : "正则校验失败";
  167. }
  168. },
  169. { title: '更新时间', dataIndex: 'auditTime', key: 'auditTime' },
  170. {
  171. title: '状态', dataIndex: 'isRequired', key: 'isRequired', render: (text, record) => {
  172. return record.isSolved == 1 ? "已解决" : record.isSolved == 0 ? "未解决" : "-";
  173. }
  174. },
  175. {
  176. title: '操作', dataIndex: 'key', render: (text, record) => (
  177. <Space size="middle">
  178. <a onClick={e => showModal('修改字段校验问题明细', record, 3)}>修改</a>
  179. </Space>
  180. )
  181. }
  182. ];
  183. return (
  184. <div className="wrapper">
  185. <div className="filter-box">
  186. <Form
  187. form={form}
  188. name="normal_login"
  189. onFinish={onFinish}
  190. initialValues={{
  191. isSolved: '', type: '', time: [moment(getCurrentDataFront()), moment(getCurrentData())]
  192. }}
  193. >
  194. <Row gutter={24}>
  195. <Col span={6} key={0}>
  196. <Form.Item label="日期" name="time">
  197. <RangePicker
  198. disabledDate={disabledDate}
  199. placeholder={['开始时间', '结束时间']}
  200. />
  201. </Form.Item>
  202. </Col>
  203. <Col span={5} key={1}>
  204. <Form.Item label="住院序号" name="behospitalCode" getValueFromEvent={getValueFromEvent}>
  205. <Input placeholder="住院序号" autoComplete='off' allowClear maxLength='30' />
  206. </Form.Item>
  207. </Col>
  208. <Col span={5} key={2}>
  209. <Form.Item label="文书编号" name="recId" getValueFromEvent={getValueFromEvent}>
  210. <Input placeholder="文书编号" autoComplete='off' allowClear maxLength='30' />
  211. </Form.Item>
  212. </Col>
  213. <Col span={5} key={3}>
  214. <Form.Item label="文书标题" name="recTitle" getValueFromEvent={getValueFromEvent}>
  215. <Input placeholder="文书标题" autoComplete='off' allowClear maxLength='30' />
  216. </Form.Item>
  217. </Col>
  218. <Col span={5} key={4}>
  219. <Form.Item label="质控模块名称" name="modeName" >
  220. <Select showSearch allowClear onSearch={onSearch} placeholder="请选择">
  221. {modeList.map((item,i) => {
  222. return (
  223. <Option value={item} key={i}>{item}</Option>
  224. )
  225. })}
  226. </Select>
  227. </Form.Item>
  228. </Col>
  229. <Col span={5} key={5}>
  230. <Form.Item label="问题类型" name="type">
  231. <Select
  232. placeholder="请选择"
  233. allowClear
  234. >
  235. <Option value="" key={0}>全部</Option>
  236. <Option value="1" key={1}>数据缺失</Option>
  237. <Option value="2" key={2}>非标准值</Option>
  238. <Option value="3" key={3}>正则校验失败</Option>
  239. </Select>
  240. </Form.Item>
  241. </Col>
  242. <Col span={5} key={7}>
  243. <Form.Item label="状态" name="isSolved">
  244. <Select
  245. placeholder="请选择"
  246. allowClear
  247. >
  248. <Option value="" key={3}>全部</Option>
  249. <Option value="0" key={0}>未处理</Option>
  250. <Option value="1" key={1}>已处理</Option>
  251. </Select>
  252. </Form.Item>
  253. </Col>
  254. <Col span={4} key={8}>
  255. <Form.Item>
  256. <Button type="primary" htmlType="submit">
  257. 查询
  258. </Button>
  259. <Button onClick={onReset}>
  260. 重置
  261. </Button>
  262. </Form.Item>
  263. </Col>
  264. </Row>
  265. </Form>
  266. </div>
  267. <div className="table">
  268. <div className="table-header">
  269. <h2 className="table-title">字段校验问题明细</h2>
  270. <Space size="middle">
  271. <Button type="primary" onClick={() => showModal('数据校验设置', { behospitalCode: '', time: '' }, 1)}>数据校验</Button>
  272. </Space>
  273. </div>
  274. <div className="table-data" style={{ justifyContent: 'left' }}>
  275. <Row className="data-box">
  276. <Col span={6} order={1} className="box-item">
  277. <p>{probleData.notSolvedNonnull || probleData.notSolvedNonnull == 0 ? probleData.notSolvedNonnull : '-'}</p>
  278. <p>数据缺失</p>
  279. </Col>
  280. <Col span={6} order={2} className="box-item">
  281. <p>{probleData.notSolvedStandardvalue || probleData.notSolvedStandardvalue == 0 ? probleData.notSolvedStandardvalue : '-'}</p>
  282. <p>非标准值</p>
  283. </Col>
  284. <Col span={6} order={3} className="box-item">
  285. <p>{probleData.notSolvedRegular || probleData.notSolvedRegular == 0 ? probleData.notSolvedRegular : '-'}</p>
  286. <p>正则校验失败</p>
  287. </Col>
  288. <Col span={6} order={4} className="box-item item">
  289. <p>{probleData.notSolved || probleData.notSolved == 0 ? probleData.notSolved : '-'}</p>
  290. <p>未处理</p>
  291. </Col>
  292. </Row>
  293. <Row className="data-box">
  294. <Col span={6} order={1} className="box-item">
  295. <p>{probleData.resolvedNonnull || probleData.resolvedNonnull == 0 ? probleData.resolvedNonnull : '-'}</p>
  296. <p>数据缺失</p>
  297. </Col>
  298. <Col span={6} order={2} className="box-item">
  299. <p>{probleData.resolvedStandardvalue || probleData.resolvedStandardvalue == 0 ? probleData.resolvedStandardvalue : '-'}</p>
  300. <p>非标准值</p>
  301. </Col>
  302. <Col span={6} order={3} className="box-item">
  303. <p>{probleData.resolvedRegular || probleData.resolvedRegular == 0 ? probleData.resolvedRegular : '-'}</p>
  304. <p>正则校验失败</p>
  305. </Col>
  306. <Col span={6} order={4} className="box-item box">
  307. <p>{probleData.resolved || probleData.resolved == 0 ? probleData.resolved : '-'}</p>
  308. <p>已处理</p>
  309. </Col>
  310. </Row>
  311. </div>
  312. <Table
  313. columns={columns}
  314. scroll={{ y: 'calc(100vh - 470px)' }}
  315. dataSource={logList}
  316. rowKey={record => record.id}
  317. pagination={{
  318. pageSize: size,
  319. size: 'small',
  320. current: current,
  321. showSizeChanger: true,
  322. pageSizeOptions: ['15', '30', '60', '120'],
  323. showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条数据`,
  324. onShowSizeChange: (current, pageSize) => onSizeChange(current, pageSize), // 改变每页数量时更新显示
  325. onChange: (page, pageSize) => changePage(page, pageSize),//点击页码事件
  326. total: total
  327. }} />
  328. </div>
  329. {visible && problemDetail ?
  330. <Modal
  331. title={title}
  332. okText='确定'
  333. cancelText='取消'
  334. width="500px"
  335. visible={visible}
  336. onCancel={cancel}
  337. footer={null}
  338. forceRender={true}
  339. maskClosable={false}
  340. >
  341. <ProblemContext.Provider value={{ problemDetail, type }}>
  342. <EditProblem userChange={userChange} />
  343. </ProblemContext.Provider>
  344. </Modal>
  345. : ''}
  346. </div >
  347. )
  348. }
  349. export default FieldProblem;