Explorar o código

慢病入口引用历史病历

zhangxc %!s(int64=6) %!d(string=hai) anos
pai
achega
97626efc1c
Modificáronse 2 ficheiros con 49 adicións e 5 borrados
  1. 37 4
      src/components/DiagnosticList/index.jsx
  2. 12 1
      src/containers/DiagnosticList.js

+ 37 - 4
src/components/DiagnosticList/index.jsx

@@ -6,6 +6,9 @@ import diagDown from './img/diagDown.png'
 import {ConfirmModal, Message} from '@commonComp';
 import Notify from '@commonComp/Notify';
 import Treat from '@containers/Treat'
+import store from '@store';
+import { pushAllDataList } from '@utils/tools';
+import iconRadioDefault from '@common/images/icon-radio-default.png'
 
 class DiagnosticList extends Component {
     constructor(props) {
@@ -13,7 +16,8 @@ class DiagnosticList extends Component {
         this.state = {
             visible: false,
             delItem: {},
-            treatTitle: ''
+            treatTitle: '',
+            activeHistory: -1
         }
         this.deleteItem = this.deleteItem.bind(this);
         this.cancel = this.cancel.bind(this);
@@ -91,16 +95,45 @@ class DiagnosticList extends Component {
         hideReferRecord && hideReferRecord()
     }
     referCase() {
-        const { hideHistoryCaseModal } = this.props
+        const { hideHistoryCaseModal, items } = this.props
         hideHistoryCaseModal && hideHistoryCaseModal()
+        if (this.state.activeHistory === -1) {
+            return
+        }
+        let baseList = store.getState();
+        
+        let baseObj = items[this.state.activeHistory];
+  
+        // store.dispatch({type: CONFIRM_TYPE, confirmType: baseObj.sign});
+        pushAllDataList(baseObj.sign,'push',baseObj,'history')       //引用
+        store.dispatch(billing())
+        this.setState({
+            activeHistory: -1
+        })
     }
     closeHistoryCaseModal() {
         const { hideHistoryCaseModal } = this.props
+        this.setState({
+            activeHistory: -1
+        })
         hideHistoryCaseModal && hideHistoryCaseModal()
     }
+    handleQuoteClick(item, index) {
+        console.log('asadsd', item)
+        const { handleQuoteClick } = this.props
+        // handleQuoteClick && handleQuoteClick(item)
+        this.setState({
+            activeHistory: index
+        })
+    }
     getHistoryCase() {
+        const { items } = this.props
         return (<div className={style['history-info']}>
-
+            {items.map((item, index) => {
+                return<div onClick={this.handleQuoteClick.bind(this, item, index)} style={this.state.activeHistory === index ? {color: '#abcdef'} : ''}>
+                    <img src={iconRadioDefault}/>{item.diagnose}
+                </div>
+            })}
         </div>)
     }
     
@@ -142,7 +175,7 @@ class DiagnosticList extends Component {
                         <div className={style['confirm-info']}>是否引用往期病历</div> 
                     </ConfirmModal>
                     <ConfirmModal visible={showHistoryCase} noFooter='true' title='请选择历史病历' close={this.closeHistoryCaseModal}>
-                        {this.getHistoryCase}
+                        {this.getHistoryCase()}
                         <div className={style['confirm-history']}><span className={style['confirm-history-btn']} onClick={this.referCase}>确定</span></div>
                     </ConfirmModal>
                 </div>

+ 12 - 1
src/containers/DiagnosticList.js

@@ -5,6 +5,9 @@ import { ADD_DIAGNOSTIC,  DEL_DIAGNOSTIC, UP_DIAGNOSTIC, DOWN_DIAGNOSTIC, GET_DI
 import { getTreatResult } from '@store/async-actions/treat';
 import { SHOW_TREAT } from '../store/types/treat';
 import {billing, getTips} from '../store/async-actions/pushMessage';
+import {keepPushData} from '@store/actions/tabTemplate';
+import { showHistory,sortHistory,activeHistory,visibleHistory } from '@store/actions/historyTemplates'
+
 
 
 
@@ -16,6 +19,7 @@ function mapStateToProps(state) {
         diagnosticStr: state.diagnosticList.diagnosticStr,
         showReferRecord: state.diagnosticList.showReferRecord,
         showHistoryCase: state.diagnosticList.showHistoryCase,
+        items:state.historyTemplates.items,
     }
 }
 
@@ -79,7 +83,14 @@ function mapDispatchToProps(dispatch) {
             dispatch({
                 type: HIDE_HISTORY_CASE
             })
-        }
+        },
+        handleQuoteClick(data){
+            
+            dispatch(keepPushData(data,'his'))      //历史病历引用
+            // dispatch(activeHistory(idx))
+            dispatch(visibleHistory(true))
+           
+        },
         
     }
 }