Bläddra i källkod

以主诉为慢病入口,写死糖尿病

liucf 6 år sedan
förälder
incheckning
196c6205f8

+ 86 - 3
src/components/MainSuit/index.jsx

@@ -1,13 +1,19 @@
 import React,{Component} from 'react';
 import style from './index.less';
-import {Button,InlineTag,ItemBox,DropDown,DropList,Textarea,Notify} from '@commonComp';
+import {Button,InlineTag,ItemBox,DropDown,DropList,Textarea,Notify,ConfirmModal} from '@commonComp';
 import TailInlineTag from '@commonComp/TailInlineTag';
 import SearchDrop from '@components/SearchDrop';
 import CommonSymptom from '@components/CommonSymptom';
 import chooseType from '@containers/eleType.js';
 import config from "@config/index";
 import {isIE,getPageCoordinate,windowEventHandler,filterDataArr} from "@utils/tools.js"
+import { initItemList } from '@store/async-actions/historyTemplates';
+import tableIcon from '@common/images/table.png';
+import iconRadioDefault from '@common/images/icon-radio-default.png'
+import iconRadioActive from '@common/images/icon-radio-active.png'
+import { pushAllDataList } from '@utils/tools';
 import $ from 'jquery';
+import store from '@store';
 
 class MainSuit extends Component{
   constructor(props){
@@ -29,6 +35,9 @@ class MainSuit extends Component{
       overFlag:false,
       tmpScroll:0,
       tmpTop:0,
+      showRecord:false,
+      activeHistory: -1,
+      showHistoryCase:false
     };
     this.toggleEditable = this.toggleEditable.bind(this);
     this.handleFocus = this.handleFocus.bind(this);
@@ -37,6 +46,11 @@ class MainSuit extends Component{
     this.handleChange = this.handleChange.bind(this);
     this.handleClick = this.handleClick.bind(this);
     this.handleBlur = this.handleBlur.bind(this);
+    this.referRecord = this.referRecord.bind(this);
+    this.noReferRecord = this.noReferRecord.bind(this);
+    this.referCase = this.referCase.bind(this);
+    this.closeHistoryCaseModal = this.closeHistoryCaseModal.bind(this);
+    this.handleQuoteClick = this.handleQuoteClick.bind(this);
   }
   componentWillReceiveProps(nextProps){
     this.setState({boxLeft:nextProps.boxLeft})
@@ -232,7 +246,7 @@ class MainSuit extends Component{
   }
 
   handleBlur(e){//隐藏常见症状下拉、存自由输入的值
-    const {freeText,saveText,datas,clearSearch,getSymptomFeature,currentData} = this.props;
+    const {freeText,saveText,datas,clearSearch,getSymptomFeature,currentData,saveChronic} = this.props;
     const that = this;
     let data = this.state.inpText;
     if(!isIE()){
@@ -241,6 +255,13 @@ class MainSuit extends Component{
       } 
       e.target.innerText?(e.target.innerText=""):(e.target.innerHTML="")
       freeText && freeText(data.trim());
+      // 慢病模板获取:精确匹配"糖尿病复诊",储存慢病字段
+      if(data.trim()=='糖尿病复诊'){
+        saveChronic && saveChronic({name:'糖尿病',id:21773});
+        this.setState({
+          showRecord:true
+        })
+      }
     }else{
       if(datas.length==0){
         const ev = e || window.event;
@@ -259,10 +280,65 @@ class MainSuit extends Component{
       },config.delayTime-200); 
   }
 
+  // 慢病
+  referRecord() {//是否引用历史病例弹窗
+    const { chronicDesease } = this.props
+    // hideReferRecord && hideReferRecord()
+    // showHistoryCaseModal && showHistoryCaseModal()
+    this.setState({
+      showRecord:false,
+      showHistoryCase:true
+    })
+    store.dispatch(initItemList(chronicDesease));
+  }
+  noReferRecord() {
+    this.setState({
+      showRecord:false
+    })
+  }
+  referCase() {
+        const { items } = this.props
+        this.setState({
+          showHistoryCase:false
+        })
+        if (this.state.activeHistory === -1) {
+            return
+        }
+        // let baseList = store.getState(); 
+        let baseObj = items[this.state.activeHistory];
+        pushAllDataList(baseObj.sign,'push',baseObj,'history')       //引用
+        this.props.getBilling();
+        this.setState({
+            activeHistory: -1
+        })
+    }
+  closeHistoryCaseModal() {
+      this.setState({
+        activeHistory: -1,
+        showHistoryCase:false
+      })
+  }
+  handleQuoteClick(item, index) {
+      console.log('asadsd', 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={this.state.activeHistory === index ? iconRadioActive : iconRadioDefault}/>{item.diagnose}
+                </div>
+            })}
+        </div>)
+    }
+
 
   render(){
     const {type,CommonSymptoms,searchData,fetchPushInfos,isRead,totalHide,handleInput,fuzhen,saveText,editClear,datas,commSymHide,boxLeft,boxTop} = this.props;
-    const {showModule,show,symptom,search} = this.state;
+    const {showModule,show,symptom,search,showRecord,showHistoryCase} = this.state;
     const symptomFlag = CommonSymptoms.length>0 ? true : false;
     const searchFlag = searchData.length>0 ? true : false;
     const boxTop1 = datas.length>0?boxTop:45;
@@ -286,6 +362,13 @@ class MainSuit extends Component{
       </ItemBox>
       {/*没有推送结果就不显示*/}
       {symptomFlag && !searchFlag ? <CommonSymptom data={CommonSymptoms} show={!totalHide&&symptom} onSelect={this.handleSelect} /> : ( searchFlag ? <SearchDrop data={searchData} show={!commSymHide} onSelect={this.handleSearchSelect} left={boxLeft1} top={boxTop1} mainEmpty={datas.length==0?true:false}/>:"")}
+      <ConfirmModal visible={showRecord} okText='是' cancelText='否' confirm={this.referRecord}  cancel={this.noReferRecord} close={this.noReferRecord}>
+          <div className={style['confirm-info']}>是否引用往期病历</div> 
+      </ConfirmModal>
+      <ConfirmModal visible={showHistoryCase} noFooter='true' title='请选择历史病历' close={this.closeHistoryCaseModal} titleBg="#DFEAFE" icon={tableIcon} height={300}>
+        {this.getHistoryCase()}
+        <div className={style['confirm-history']}><span className={style['confirm-history-btn']} onClick={this.referCase}>确定</span></div>
+    </ConfirmModal>
     </div>
   }
 }

+ 33 - 0
src/components/MainSuit/index.less

@@ -22,4 +22,37 @@
             border: 1px solid red !important;
         }
     }
+}
+.confirm-info {
+    height: 70px;
+    font-size: 16px;
+    line-height: 16px;
+    text-align: center;
+    padding: 10px 30px;
+}
+.history-info {
+    height: 185px;
+    overflow-y: auto;
+    padding: 15px;
+    >div{
+        line-height: 26px;
+        img{
+            vertical-align: middle;
+            margin-right: 5px;
+        }
+    }
+}
+.confirm-history-btn {
+    position: absolute;
+    right: 15px;
+    // bottom: 10px;
+    display: inline-block;
+    width: 66px;
+    height: 32px;
+    line-height: 32px;
+    text-align: center;
+    color: #3B9ED0;
+    border: 1px solid #3B9ED0;
+    border-radius: 4px;
+    cursor: pointer;
 }

+ 23 - 3
src/containers/MainSuit.js

@@ -1,8 +1,8 @@
 import React from 'react';
 import { connect } from 'react-redux';
 import MainSuit from '@components/MainSuit';
-import {CLEAR_COMSYMPTOMS,SHOW_TAIL,INSERT_MAIN,CLEAR_SEARCH,SET_SEARCH,SAVE_FREE,SET_DATA,INSERT_SEARCH,SETTEXTMODEVALUE,SET_FEATURE} from '@store/types/mainSuit';
-import {RESET,CLICKCOUNT,ISREAD,SEARCH_DROP_LOCATION} from '@store/types/homePage.js';
+import {CLEAR_COMSYMPTOMS,SHOW_TAIL,INSERT_MAIN,CLEAR_SEARCH,SET_SEARCH,SAVE_FREE,SET_DATA,INSERT_SEARCH,SETTEXTMODEVALUE,SET_FEATURE,SAVE_CHRONIC} from '@store/types/mainSuit';
+import {RESET,CLICKCOUNT,ISREAD,SEARCH_DROP_LOCATION,MODI_LOADING} from '@store/types/homePage.js';
 import {getCommSymptoms,getCommSymptomPush} from '@store/async-actions/mainSuit.js'
 import {SET_MAIN_SUIT} from '@store/types/fillInfo';
 import {CLEAR_DIAGNOSE} from '@store/types/diagnosticList';
@@ -11,6 +11,7 @@ import {billing} from '@store/async-actions/pushMessage';
 import {filterArr,didPushParamChange,filterDataArr} from '@utils/tools.js';
 import config from '@config/index.js';
 import {Notify} from '@commonComp';
+import {getInitModules} from '@store/async-actions/homePage.js';
 
 function mapStateToProps(state) {//console.log(11,state);
   return {
@@ -38,6 +39,8 @@ function mapStateToProps(state) {//console.log(11,state);
     boxLeft:state.homePage.boxLeft,
     currentData:state.currentIll.data,
     allModules:state.homePage.allModules,
+    chronicDesease:state.mainSuit.chronicDesease,
+    items:state.historyTemplates.items,
   }
 }
 
@@ -182,7 +185,24 @@ function mapDispatchToProps(dispatch) {
             data:data
           })
         }
-      }
+      },
+      async saveChronic(item){//储存慢病信息
+        // loading
+        dispatch({type:MODI_LOADING,flag:true});
+        dispatch({
+          type:SAVE_CHRONIC,
+          data:item
+        })
+        // 弹窗是否引用历史病例?
+
+        // 取模板
+        await dispatch(getInitModules);
+        // 模板回来关闭;loading
+        dispatch({type:MODI_LOADING,flag:false});
+      },
+      getBilling: () => {
+        dispatch(billing())
+      },
     }
 }
 

+ 4 - 2
src/store/async-actions/homePage.js

@@ -31,7 +31,9 @@ function modulesParseJson(data){
 export const getInitModules= (dispatch,getStore)=>{
   const state = getStore();
   const {message} = state.patInfo;
-  const chronicMagItem = state.diagnosticList.chronicMagItem;
+  // const chronicMagItem = state.diagnosticList.chronicMagItem;
+  // const chronicId = chronicMagItem?chronicMagItem.id:'';//诊断为慢病复诊时储存慢病信息到store
+  const chronicMagItem = state.mainSuit.chronicDesease;
   const chronicId = chronicMagItem?chronicMagItem.id:'';//诊断为慢病复诊时储存慢病信息到store
   const param = {
     age:message.patientAge,
@@ -42,7 +44,7 @@ export const getInitModules= (dispatch,getStore)=>{
   // return json(api.getModules,{age:message.patientAge,sexType:message.sex}).then((res) => {
   return json(api.getModules,param).then((res) => {
       dispatch(initHistoryDetails(message));      //历史病历回读
-      if (res.data.code == '0') {
+      if (res.data.code == '0') {//console.log('糖尿病模板',chronicId,res.data.data);
         const newObj = modulesParseJson(res.data.data);
         const initData = newObj.json;
         const initSaveText = newObj.saveTextJson;

+ 2 - 2
src/store/async-actions/patInfo.js

@@ -60,9 +60,9 @@ export const initHistoryDetails = (dispatch) => {
                 }else{
                   dispatch(initItemList(baseList.typeConfig.typeConfig))
                 }
-                dispatch({type:MODI_LOADING});
+                dispatch({type:MODI_LOADING,flag:false});
             } else {
-                dispatch({type:MODI_LOADING});
+                dispatch({type:MODI_LOADING,flag:false});
                 console.log(res)
             }
         })

+ 2 - 1
src/store/reducers/homePage.js

@@ -64,7 +64,8 @@ export default function (state=initState,action) {
       res.windowHeight = action.obj.height;
       return res;
     case MODI_LOADING:
-      res.loadingFlag = false;
+      // res.loadingFlag = false;
+      res.loadingFlag = action.flag;
       return res;
     case SEARCH_DROP_LOCATION:
       return searchDropLocation(state,action);

+ 4 - 1
src/store/reducers/mainSuit.js

@@ -2,7 +2,7 @@ import {COMM_SYMPTOMS,CLEAR_COMSYMPTOMS,SHOW_TAIL,INSERT_MAIN,
   SET_SEARCH,CLEAR_SEARCH,GET_BIGDATAPUSH,SET_MAINSUIT,MIX_CONFIRM,NUMBER_SELECT,
   RADIO_SELECT,COMM_CONFIRM,CHANGE_LABELVAL,SAVE_FREE,CLEAR_MAIN_SUIT,SET_DATA,
   INSERT_SEARCH,MAIN_FOCUS_INDEX,SETTEXTMODEVALUE,SETMAINTEXT,MAINADDLABELITEM,SETMAININPUT,DEL_MAIN,CHANGE_LABELVAL_NUMBER,
-  REMOVE_MAIN_ID,MAINSUIT_MUL,DEL_MAIN_LABLE,SET_FEATURE,SET_MS_RADIO_INPUT_VAL} from '../types/mainSuit'
+  REMOVE_MAIN_ID,MAINSUIT_MUL,DEL_MAIN_LABLE,SET_FEATURE,SET_MS_RADIO_INPUT_VAL,SAVE_CHRONIC} from '../types/mainSuit'
 import {getCommSymptoms,handleTailClick,insertMain,setSearch,getBigSymptom,setMainMoudle,confirm,
   setNumberValue,setRadioValue,commConfirm,changeLabelVal,saveFreeVal,clearMainSuit,insertSearch,setTextModeValue,setCheckText,
   addLabelItem,setInputLabel,backspaceText,changeNumLabelVal,removeId,multipleComfirn,delSingleLable,
@@ -99,6 +99,9 @@ export default function(state=initState,action){
       return getSymptomFeature(state,action);
     case SET_MS_RADIO_INPUT_VAL:
       return setRadioInputValue(state,action);
+    case SAVE_CHRONIC:
+      res.chronicDesease = action.data;
+      return res;
     default:
       return state;
   }

+ 2 - 1
src/store/types/mainSuit.js

@@ -27,4 +27,5 @@ export const REMOVE_MAIN_ID = 'REMOVE_MAIN_ID';     //移除id
 export const MAINSUIT_MUL = 'MAINSUIT_MUL';     //单列多选
 export const DEL_MAIN_LABLE = 'DEL_MAIN_LABLE';     
 export const SET_FEATURE = 'SET_FEATURE';  //主诉分词
-export const SET_MS_RADIO_INPUT_VAL = 'SET_MS_RADIO_INPUT_VAL'
+export const SET_MS_RADIO_INPUT_VAL = 'SET_MS_RADIO_INPUT_VAL';
+export const SAVE_CHRONIC = 'SAVE_CHRONIC'; //储存慢病信息