index.js 16 KB

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