index.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. import React, { useState, useEffect, useRef } from 'react';
  2. import { useSelector, useDispatch } from 'react-redux';
  3. import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space, message, Spin } from 'antd';
  4. import moment from "moment";
  5. import "moment/locale/zh-cn"
  6. import '@common/common.less';
  7. import './index.less'
  8. import apiObj from '@api/index';
  9. import EditBlock from './editBlock';
  10. import BlockContext from './block-context';
  11. import { getValueFromEvent, disabledDate, getDaysBetween } from '@utils/index'
  12. const { post, api, xPost } = apiObj;
  13. const { Option } = Select;
  14. function BlockLossManage() {
  15. const [blockList, setBlockList] = useState([]);
  16. const [total, setTotal] = useState(0);
  17. const [title, setTitle] = useState(0);
  18. const [visible, setVisible] = useState(false);
  19. const [size, setSize] = useState(15);
  20. const [loading, setLoading] = useState(false);
  21. const [current, setCurrent] = useState(1);
  22. const [type, setType] = useState(null);
  23. const [blockData, setBlockData] = useState({});
  24. const [blockDetail, setBlockDetail] = useState(null);//详情数据
  25. const [params, setParams] = useState({
  26. pages: 1,
  27. current: 1,
  28. size: 15,
  29. asc: ['status'],
  30. desc: ['gmt_modified'],
  31. startDate: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
  32. endDate: getCurrentData().split('/').join('-') + ' 23:59:59'
  33. });
  34. const [form] = Form.useForm();
  35. let data = {
  36. pages: 1,
  37. current: 1,
  38. size: 15,
  39. asc: ['status'],
  40. desc: ['gmt_modified'],
  41. startDate: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
  42. endDate: getCurrentData().split('/').join('-') + ' 23:59:59'
  43. }
  44. let date = {
  45. startDate: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
  46. endDate: getCurrentData().split('/').join('-') + ' 23:59:59'
  47. }
  48. const { lossNum } = useSelector((state) => {
  49. return state.userInfo;
  50. });
  51. useEffect(() => {
  52. setCurrent(1)
  53. setParams(data)
  54. form.resetFields();
  55. getBlockLossPage(data);
  56. blockLossTypeGather(date)
  57. }, [lossNum]);
  58. //表格数据
  59. function getBlockLossPage(param) {
  60. const hide = message.loading('加载中...', 0);
  61. post(api.getBlockLossPage, param || params).then((res) => {
  62. hide()
  63. if (res.data.code === 200) {
  64. const data = res.data.data;
  65. setBlockList(data.records);
  66. setTotal(data.total)
  67. }
  68. }).catch((err) => {
  69. hide()
  70. })
  71. }
  72. //丢失量分类汇总
  73. function blockLossTypeGather(param) {
  74. post(api.blockLossTypeGather, param).then((res) => {
  75. if (res.data.code === 200) {
  76. const data = res.data.data;
  77. setBlockData(data)
  78. }
  79. })
  80. }
  81. //修改
  82. function showModal(title, row, type) {
  83. setVisible(true)
  84. setBlockDetail(row)
  85. setTitle(title)
  86. setType(type)
  87. }
  88. function onSizeChange(current, pageSize) {
  89. params.current = current
  90. params.size = pageSize
  91. setSize(pageSize)
  92. setCurrent(current)
  93. setParams(params)
  94. }
  95. function changePage(page, pageSize) {
  96. params.current = page
  97. params.size = pageSize
  98. setParams(params)
  99. setCurrent(page)
  100. getBlockLossPage()
  101. }
  102. //返回
  103. function cancel() {
  104. setVisible(false)
  105. setBlockDetail(null)
  106. }
  107. function userChange(type) {
  108. if (type == 2) {
  109. params.current = 1
  110. setParams(params)
  111. setCurrent(1)
  112. getBlockLossPage();
  113. }
  114. setVisible(false)
  115. blockLossTypeGather({ startDate: params.startDate, endDate: params.endDate })
  116. setBlockDetail(null)
  117. }
  118. const onFinish = (value) => {
  119. value.startDate = moment(value.startDate).format('YYYY-MM-DD 00:00:00');
  120. value.endDate = moment(value.endDate).format('YYYY-MM-DD 23:59:59');
  121. if (value.startDate > value.endDate) {
  122. message.warning('开始时间不能大于结束时间');
  123. return
  124. } else if (getDaysBetween(value.startDate, value.endDate) > 364) {
  125. message.warning('开始时间与结束时间相差不能超过一年');
  126. return
  127. }
  128. const param = {
  129. ...params,
  130. ...value,
  131. }
  132. setCurrent(1)
  133. setParams(param)
  134. getBlockLossPage(param);
  135. blockLossTypeGather({ startDate: value.startDate, endDate: value.endDate })
  136. };
  137. const onReset = () => {
  138. setCurrent(1)
  139. setSize(15)
  140. setParams(data)
  141. form.resetFields();
  142. getBlockLossPage(data);
  143. blockLossTypeGather(date)
  144. };
  145. function getCurrentDataFront() {
  146. let time = new Date((new Date() - 30 * 24 * 3600 * 1000)).toLocaleDateString()
  147. return time
  148. }
  149. // 结束时间
  150. function getCurrentData() {
  151. let time = new Date().toLocaleDateString()
  152. return time
  153. }
  154. const columns = [
  155. { title: '序号', dataIndex: 'index', render: (text, record, index) => (current - 1) * params.size + index + 1 },
  156. { title: '住院序号', dataIndex: 'behospitalCode', key: 'behospitalCode' },
  157. {
  158. title: '文书编号', dataIndex: 'recId', key: 'recId', render: (text, record) => {
  159. return record.recId || '-';
  160. }
  161. },
  162. {
  163. title: '文书标题', dataIndex: 'recTitle', key: 'recTitle', render: (text, record) => {
  164. return record.recTitle || '-';
  165. }
  166. },
  167. {
  168. title: '丢失原因', dataIndex: 'lossCause', key: 'lossCause', render: (text, record) => {
  169. return record.lossCause ? record.lossCause.length > 15 ? <span title={record.lossCause}>{record.lossCause.substring(0, 15) + '...'}</span> : record.lossCause : '-';
  170. }
  171. },
  172. {
  173. title: '丢失类型', dataIndex: 'lossType', key: 'lossType', render: (text, record) => {
  174. return (<span>{record.lossType == 0 ? '文书丢失' : record.lossType == 1 ? '病案首页丢失' : record.lossType == 2 ? '患者信息丢失' : '-'}</span>);
  175. }
  176. },
  177. {
  178. title: '丢失途径', dataIndex: 'lossWay', key: 'lossWay', render: (text, record) => {
  179. return (<span>{record.lossWay == 0 ? '外部丢失' : record.lossWay == 1 ? '内部丢失' : '-'}</span>);
  180. }
  181. },
  182. {
  183. title: '更新时间', dataIndex: 'gmtModified', key: 'gmtModified', render: (text, record) => {
  184. return record.gmtModified || '-';
  185. }
  186. },
  187. {
  188. title: '状态', key: 'status', render: (text, record) => {
  189. return (<span className={record.status === '0' ? 'Delete' : 'Adopt'}>{record.status == 0 ? '已丢失' : record.status == 1 ? '已恢复' : '-'}</span>);
  190. }
  191. },
  192. {
  193. title: '核查结果', key: 'isAudited', render: (text, record) => {
  194. return (<span className={(record.isAudited === '0') ? 'delete' : (record.isAudited === '1') ? 'adopt' : 'disable'}>{record.isAudited == 0 ? '核查未通过' : record.isAudited == 1 ? '核查通过' : record.isAudited == 2 ? '未核查' : '-'}</span>);
  195. }
  196. },
  197. {
  198. title: '操作', dataIndex: 'key', render: (text, record) => (
  199. <Space size="middle">
  200. <a onClick={e => showModal('修改病历数据块丢失明细', record, 3)}>修改</a>
  201. </Space>
  202. )
  203. }
  204. ];
  205. return (
  206. <div className="wrapper">
  207. <div className="filter-box">
  208. <Form
  209. form={form}
  210. name="normal_login"
  211. onFinish={onFinish}
  212. initialValues={{ lossType: '', lossWay: '', isAudited: '', status: '', startDate: moment(getCurrentDataFront()), endDate: moment(getCurrentData()) }}
  213. >
  214. <Row gutter={24}>
  215. <Col span={7} key={0}>
  216. <Form.Item label="日期" >
  217. <Form.Item name="startDate" className='times'>
  218. <DatePicker
  219. allowClear={false}
  220. disabledDate={disabledDate}
  221. placeholder="请选择开始日期"
  222. />
  223. </Form.Item>
  224. <span style={{ margin: '0 5px', position: 'relative', top: '2px' }}>-</span>
  225. <Form.Item name="endDate" className='times'>
  226. <DatePicker
  227. allowClear={false}
  228. disabledDate={disabledDate}
  229. placeholder="请选择结束日期"
  230. />
  231. </Form.Item>
  232. </Form.Item>
  233. </Col>
  234. <Col span={5} key={1}>
  235. <Form.Item label="住院序号" name="behospitalCode" getValueFromEvent={getValueFromEvent}>
  236. <Input placeholder="请输入" autoComplete='off' allowClear maxLength='30' />
  237. </Form.Item>
  238. </Col>
  239. <Col span={5} key={2}>
  240. <Form.Item label="文书编号" name="recId" getValueFromEvent={getValueFromEvent}>
  241. <Input placeholder="请输入" autoComplete='off' allowClear maxLength='30' />
  242. </Form.Item>
  243. </Col>
  244. <Col span={5} key={3}>
  245. <Form.Item label="文书标题" name="recTitle" getValueFromEvent={getValueFromEvent}>
  246. <Input placeholder="请输入" autoComplete='off' allowClear maxLength='30' />
  247. </Form.Item>
  248. </Col>
  249. <Col span={5} key={4}>
  250. <Form.Item label="丢失类型" name="lossType">
  251. <Select
  252. placeholder="请选择"
  253. >
  254. <Option value="" key={3}>全部</Option>
  255. <Option value="0" key={0}>文书丢失</Option>
  256. <Option value="1" key={1}>病案首页丢失</Option>
  257. <Option value="2" key={2}>患者信息丢失</Option>
  258. </Select>
  259. </Form.Item>
  260. </Col>
  261. <Col span={5} key={5}>
  262. <Form.Item label="丢失途径" name="lossWay">
  263. <Select
  264. placeholder="请选择"
  265. >
  266. <Option value="" key={2}>全部</Option>
  267. <Option value="0" key={0}>外部丢失</Option>
  268. <Option value="1" key={1}>内部丢失</Option>
  269. </Select>
  270. </Form.Item>
  271. </Col>
  272. <Col span={5} key={6}>
  273. <Form.Item label="核查结果" name="isAudited">
  274. <Select
  275. placeholder="请选择"
  276. >
  277. <Option value="" key={3}>全部</Option>
  278. <Option value="0" key={0}>核查未通过</Option>
  279. <Option value="1" key={1}>核查通过</Option>
  280. <Option value="2" key={2}>未核查</Option>
  281. </Select>
  282. </Form.Item>
  283. </Col>
  284. <Col span={5} key={7}>
  285. <Form.Item label="状态" name="status">
  286. <Select
  287. placeholder="请选择"
  288. >
  289. <Option value="" key={3}>全部</Option>
  290. <Option value="0" key={0}>已丢失</Option>
  291. <Option value="1" key={1}>已恢复</Option>
  292. </Select>
  293. </Form.Item>
  294. </Col>
  295. <Col span={4} key={8}>
  296. <Form.Item>
  297. <Button type="primary" htmlType="submit">
  298. 查询
  299. </Button>
  300. <Button onClick={onReset}>
  301. 重置
  302. </Button>
  303. </Form.Item>
  304. </Col>
  305. </Row>
  306. </Form>
  307. </div>
  308. <div className="table">
  309. <div className="table-header">
  310. <h2 className="table-title">病历数据块丢失明细</h2>
  311. <Space size="middle">
  312. <Button type="primary" onClick={() => showModal('数据补录设置', { behospitalCode: '', time: '' }, 1)}>数据补录</Button>
  313. <Button type="primary" onClick={() => showModal('数据对比设置', { behospitalCode: '', time: '' }, 2)}>数据对比</Button>
  314. </Space>
  315. </div>
  316. <div className="table-data">
  317. <Row className="data-box">
  318. <Col span={6} order={1} className="data-item">
  319. <p>{blockData.hisNum || blockData.hisNum == 0 ? blockData.hisNum : '-'}</p>
  320. <p>HIS</p>
  321. </Col>
  322. <Col span={6} order={2} className="data-item">
  323. <p>{blockData.logNum || blockData.logNum == 0 ? blockData.logNum : '-'}</p>
  324. <p>接口日志</p>
  325. </Col>
  326. <Col span={6} order={3} className="data-item">
  327. <p>{blockData.realNum || blockData.realNum == 0 ? blockData.realNum : '-'}</p>
  328. <p>实际</p>
  329. </Col>
  330. <Col span={6} order={4} className="data-item item" >
  331. <p>{blockData.allLossNum || blockData.allLossNum == 0 ? blockData.allLossNum : '-'}</p>
  332. <p>合计丢失</p>
  333. </Col>
  334. </Row>
  335. <Row className="data-box">
  336. <Col span={6} order={1} className="box-item">
  337. <p>{blockData.outRecNum || blockData.outRecNum == 0 ? blockData.outRecNum : '-'}</p>
  338. <p>文书丢失</p>
  339. </Col>
  340. <Col span={6} order={2} className="box-item">
  341. <p>{blockData.outHomePageNum || blockData.outHomePageNum == 0 ? blockData.outHomePageNum : '-'}</p>
  342. <p>病案首页丢失</p>
  343. </Col>
  344. <Col span={6} order={3} className="box-item">
  345. <p>{blockData.outCodeNum || blockData.outCodeNum == 0 ? blockData.outCodeNum : '-'}</p>
  346. <p>患者信息丢失</p>
  347. </Col>
  348. <Col span={6} order={4} className="box-item box">
  349. <p>{blockData.outLossNum || blockData.outLossNum == 0 ? blockData.outLossNum : '-'}</p>
  350. <p>外部丢失</p>
  351. </Col>
  352. </Row>
  353. <Row className="data-box">
  354. <Col span={6} order={1} className="box-item">
  355. <p>{blockData.inRecNum || blockData.inRecNum == 0 ? blockData.inRecNum : '-'}</p>
  356. <p>文书丢失</p>
  357. </Col>
  358. <Col span={6} order={2} className="box-item">
  359. <p>{blockData.inHomePageNum || blockData.inHomePageNum == 0 ? blockData.inHomePageNum : '-'}</p>
  360. <p>病案首页丢失</p>
  361. </Col>
  362. <Col span={6} order={3} className="box-item">
  363. <p>{blockData.inCodeNum || blockData.inCodeNum == 0 ? blockData.inCodeNum : '-'}</p>
  364. <p>患者信息丢失</p>
  365. </Col>
  366. <Col span={6} order={4} className="box-item box">
  367. <p>{blockData.inLossNum || blockData.inLossNum == 0 ? blockData.inLossNum : '-'}</p>
  368. <p>内部丢失</p>
  369. </Col>
  370. </Row>
  371. </div>
  372. <Table
  373. columns={columns}
  374. scroll={{ y: 'calc(100vh - 520px)' }}
  375. dataSource={blockList}
  376. rowKey={record => record.id}
  377. pagination={{
  378. pageSize: size,
  379. size: 'small',
  380. current: current,
  381. showSizeChanger: true,
  382. pageSizeOptions: ['15', '30', '60', '120'],
  383. showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条数据`,
  384. onShowSizeChange: (current, pageSize) => onSizeChange(current, pageSize), // 改变每页数量时更新显示
  385. onChange: (page, pageSize) => changePage(page, pageSize),//点击页码事件
  386. total: total
  387. }} />
  388. </div>
  389. {visible && blockDetail ?
  390. <Modal
  391. title={title}
  392. okText='确定'
  393. cancelText='取消'
  394. width="500px"
  395. visible={visible}
  396. onCancel={cancel}
  397. footer={null}
  398. forceRender={true}
  399. maskClosable={false}
  400. >
  401. <BlockContext.Provider value={{ blockDetail, type }}>
  402. <EditBlock cancel={cancel} userChange={userChange} />
  403. </BlockContext.Provider>
  404. </Modal>
  405. : ''}
  406. </div >
  407. )
  408. }
  409. export default BlockLossManage;