index.js 19 KB

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