index.js 16 KB

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