index.js 17 KB

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