index.js 15 KB

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