index.js 18 KB

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