index.jsx 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. import React, { Component } from "react";
  2. import axios from '@utils/ajax';
  3. import PatInfoContainer from '@containers/PatInfoContainer.js';
  4. import style from "./index.less";
  5. import { connect } from 'react-redux';
  6. import AnalysisResult from '@components/AnalysisResult';
  7. import historyCase from '@common/images/history.png';
  8. import sysResult from '@common/images/result.png';
  9. import store from '@store';
  10. import { getEMRParams,getUrlArgObject } from '@utils/tools';
  11. import { showHistory } from '@store/actions/historyTemplates';
  12. import { initItemList, setInitHistory, getHospitalInfo } from '@store/async-actions/historyTemplates';
  13. import HistoryCases from '@containers/HistoryCases';
  14. import {Notify,Loading} from '@commonComp';
  15. import {SHOW_LOADING} from '@store/types/copyRight.js';
  16. class InfoTitle extends Component {
  17. constructor(props){
  18. super(props);
  19. this.state = {
  20. resShow:false,
  21. analysisRes:{}, //解析结果数据
  22. };
  23. this.showHistoryBox = this.showHistoryBox.bind(this)
  24. this.showSysBox = this.showSysBox.bind(this);
  25. }
  26. showSysBox(flg){
  27. this.setState({resShow:flg});
  28. const param = getEMRParams(); // 获取推送参数
  29. param.dept = [{name:param.deptName,uniqueName:param.hospitalId==-1?param.deptName:''}]
  30. param.deptName = undefined;
  31. param.ruleType="1,2,3,4";
  32. axios.json('/sys/push/indicationPush',param).then((res)=>{
  33. const data =res.data;
  34. if(data.code == 0){
  35. this.setState({analysisRes:data.data.debug["数据"]})
  36. //this.structAnalysisData(data.data.debug["数据"])
  37. }else{
  38. Notify.error(data.msg);
  39. }
  40. })
  41. }
  42. showHistoryBox(){
  43. const {showLoading,hideLoading}=this.props;
  44. showLoading();
  45. initItemList().then(res=>{
  46. const result = res.data
  47. if (result.code === '0' && result.data.records.length !== 0) {
  48. hideLoading();
  49. store.dispatch(setInitHistory(result.data));
  50. store.dispatch(showHistory(true));
  51. document.body.style.overflow = 'hidden';
  52. }else{
  53. hideLoading();
  54. Notify.info("暂无历史病历");
  55. }
  56. })
  57. }
  58. componentWillReceiveProps(next){
  59. /*const that = this;
  60. if(next.winWidth <= 1024){
  61. $(window).scroll(function(){
  62. let scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;
  63. let left = -(scrollLeft - 10) +'px';
  64. that.setState({
  65. le:left
  66. })
  67. })
  68. }*/
  69. }
  70. render() {
  71. const {loading,loadingText,loadingType} = this.props;
  72. const {resShow,analysisRes}=this.state;
  73. const showSysBtn = getUrlArgObject("sysBtn")==='1';
  74. return <div className={style['title-wrapper']} style={{paddingRight:'198px'}}>
  75. <PatInfoContainer />
  76. {
  77. <div className={style['activeWrap']}>
  78. <div className={style["operations"]}>
  79. <span onClick={this.showHistoryBox}><img src={historyCase} />&nbsp;历史病历</span>
  80. {showSysBtn?<span onClick={()=>this.showSysBox(true)}><img src={sysResult} />&nbsp;解析结果</span>:""}
  81. </div>
  82. </div>
  83. }
  84. <HistoryCases></HistoryCases>
  85. <AnalysisResult show={resShow} data={analysisRes} onClose={this.showSysBox}></AnalysisResult>
  86. <Loading show={loading} text={loadingText} type={loadingType}/>
  87. </div>;
  88. }
  89. }
  90. function mapStateToProps(state) {
  91. return {
  92. disVisible: state.copyRight.disVisible,
  93. copyVisible:state.copyRight.copyVisible,
  94. winWidth:state.homePage.windowWidth,
  95. loading:state.copyRight.loading,
  96. loadingText:state.copyRight.loadingText,
  97. loadingType:state.copyRight.loadingType
  98. }
  99. }
  100. function mapDispatchToProps(dispatch){
  101. return{
  102. showLoading(){
  103. // dispatch({type:MODI_LOADING,flag:true});
  104. dispatch({type:SHOW_LOADING,flag:true});
  105. },
  106. hideLoading(){
  107. // dispatch({type:MODI_LOADING,flag:false});
  108. dispatch({type:SHOW_LOADING,flag:false});
  109. }
  110. }
  111. }
  112. const InfoTitleCont = connect(
  113. mapStateToProps,
  114. mapDispatchToProps
  115. )(InfoTitle);
  116. export default InfoTitleCont;