index.js 16 KB

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