فهرست منبع

症候添加判断

zhouna 4 سال پیش
والد
کامیت
34eaf7ae32

+ 2 - 2
src/common/components/SearchOption/index.jsx

@@ -111,7 +111,7 @@ class SearchOption extends React.Component {
       this.setState({border:false,val:''})
       this.setState({border:false,val:''})
     }
     }
     render() {
     render() {
-        const { children,visible,searchType } = this.props;
+        const { children,visible,searchType,showSym } = this.props;
         const { show,showInsp,txt } = this.state;
         const { show,showInsp,txt } = this.state;
         return (
         return (
             searchType == 1||searchType == 2?
             searchType == 1||searchType == 2?
@@ -153,7 +153,7 @@ class SearchOption extends React.Component {
                 <div className={styles.autoList}>
                 <div className={styles.autoList}>
                     {children}
                     {children}
                 </div>
                 </div>
-            </div>:<div id="searchOption" className={visible?`${styles.search} ${styles.show} searchOption`:`${styles.search} ${styles.hide} searchOption`}>
+            </div>:<div id="searchOption" className={visible?`${styles.search} ${styles.show} ${showSym?styles.isSym:''} searchOption`:`${styles.search} ${styles.hide} searchOption`}>
                 <img className={styles.searchVal} src={search} alt="搜索" />
                 <img className={styles.searchVal} src={search} alt="搜索" />
                 <img style={{display:show?'block':'none'}} className={styles.clearVal} src={clear} onClick={this.handleClearVal} alt="清空" />
                 <img style={{display:show?'block':'none'}} className={styles.clearVal} src={clear} onClick={this.handleClearVal} alt="清空" />
                 <input
                 <input

+ 3 - 0
src/common/components/SearchOption/index.less

@@ -10,6 +10,9 @@
     top: 30px;
     top: 30px;
     background-color: #fff;
     background-color: #fff;
     // margin-bottom: 80px;
     // margin-bottom: 80px;
+    &.isSym{
+        left: 230px;
+    }
     .llStyle;
     .llStyle;
     .autoList {
     .autoList {
         // max-height: 225px;
         // max-height: 225px;

+ 2 - 2
src/components/DiagResultSearch/index.jsx

@@ -84,8 +84,8 @@ class DiagResultSearch extends Component {
     const barStyle={background:'#777',width:'100%'};
     const barStyle={background:'#777',width:'100%'};
     const idName = showSym?"diagSymSearch":(showTcm?'diagTcmSearch':'diagSearch');
     const idName = showSym?"diagSymSearch":(showTcm?'diagTcmSearch':'diagSearch');
     return (
     return (
-        (showSym||(isTcm&&showTcm)||(show&&!isTcm)) && <div id={idName} className={style['search-box']}>
-        <SearchOption handleChangeValue={handleChangeValue} refreshScroller={refreshScroller} pageTop={pageTop} windowHeight={windowHeight} height={180} visible={true}>
+        ((isTcm&&showSym)||(isTcm&&showTcm)||(show&&!isTcm)) && <div id={idName} className={style['search-box']}>
+        <SearchOption showSym={showSym} handleChangeValue={handleChangeValue} refreshScroller={refreshScroller} pageTop={pageTop} windowHeight={windowHeight} height={180} visible={true}>
             {this.getSearchList(searchResult, isShowNoDataInfo)}
             {this.getSearchList(searchResult, isShowNoDataInfo)}
         </SearchOption>
         </SearchOption>
       </div>
       </div>

+ 3 - 3
src/components/Diagnosis/index.jsx

@@ -97,7 +97,7 @@ class Diagnosis extends Component {
 
 
     render() {
     render() {
         const {isTcm,tcmList} = this.props;
         const {isTcm,tcmList} = this.props;
-        if (isTcm) {
+        if (isTcm) {    //添加中医诊断后才显示中医症候添加按钮
             const len = tcmList.length>0?tcmList.length-1:0;
             const len = tcmList.length>0?tcmList.length-1:0;
             const showNext = tcmList.length===0||(tcmList.length>0&&tcmList[len].tcmDiag&&tcmList[len].tcmSyndrome);
             const showNext = tcmList.length===0||(tcmList.length>0&&tcmList[len].tcmDiag&&tcmList[len].tcmSyndrome);
             return (<div id="diagnosisTcmResult">
             return (<div id="diagnosisTcmResult">
@@ -110,8 +110,8 @@ class Diagnosis extends Component {
                     {showNext?<div style={{marginLeft: '10px', position: 'relative', color: '#000'}}>
                     {showNext?<div style={{marginLeft: '10px', position: 'relative', color: '#000'}}>
                         <Add showText="添加中医诊断结果" handleClick={this.handleTcmShowSearch} id="addTcmDiag"
                         <Add showText="添加中医诊断结果" handleClick={this.handleTcmShowSearch} id="addTcmDiag"
                              height="50px"/>
                              height="50px"/>
-                        <Add showText="添加中医症候" handleClick={this.handleSymShowSearch} id="addSymDiag"
-                             height="50px"/>
+                            {tcmList.length&&tcmList[len].tcmDiag?<Add showText="添加中医症候" handleClick={this.handleSymShowSearch} id="addSymDiag"
+                             height="50px"/>:''}
                         <DiagResultSearch
                         <DiagResultSearch
                             refreshScroller={this.refreshScroller}
                             refreshScroller={this.refreshScroller}
                             setHighter={this.props.setHighter}
                             setHighter={this.props.setHighter}

+ 15 - 7
src/components/DiagnosticItem/index.jsx

@@ -46,13 +46,21 @@ class DiagnosticItem extends Component{
         })
         })
     }
     }
     chooseDiagodal(item) {
     chooseDiagodal(item) {
-        const { diagnosticList,isTcm,tcmList,symList,showSym} = this.props;
-        const list = isTcm?(showSym?symList:tcmList):diagnosticList;
-        const tipName = isTcm?(showSym?'中医症候':'中医诊断'):'诊断';
-        for (let i = 0; i < list.length; i++) {
-            if(list[i].name === item.name) {
-                Notify.info('该'+tipName+'已存在');
-                return
+        const { diagnosticList,isTcm,tcmList,showSym} = this.props;
+        if(isTcm&&showSym){ //添加的是中医症候,判断是否重复,添加中医诊断不需要判断
+            const lastTcmDiag = tcmList[tcmList.length-1].tcmDiag;
+            for (let i = 0; i < tcmList.length-1; i++) {
+                if(tcmList[i].tcmDiag+tcmList[i].tcmSyndrome=== lastTcmDiag+item.name) {
+                    Notify.info('该中医诊断+中医症候已存在');
+                    return
+                }
+            }
+        }else{
+            for (let i = 0; i < diagnosticList.length; i++) {
+                if(diagnosticList[i].name === item.name) {
+                    Notify.info('该诊断已存在');
+                    return
+                }
             }
             }
         }
         }
         this.props.setHighter&&this.props.setHighter(80)
         this.props.setHighter&&this.props.setHighter(80)

+ 6 - 7
src/components/DiagnosticList/index.jsx

@@ -345,11 +345,10 @@ class DiagnosticList extends Component {
         const {showTipsDetails,tipsDetails,showAllName}=pushMessage;
         const {showTipsDetails,tipsDetails,showAllName}=pushMessage;
         const {visible, treatTitle,  hasOndel, hasOnIndex,delItem} = this.state;
         const {visible, treatTitle,  hasOndel, hasOnIndex,delItem} = this.state;
         const diagList = isTcm?tcmList:list;
         const diagList = isTcm?tcmList:list;
-        if(isTcm){      //中医
-
+        if(isTcm){      //中医,添加中医诊断后才显示中医症候添加按钮
             return(
             return(
                 <div className={style['diaglist-wrap']}>
                 <div className={style['diaglist-wrap']}>
-                    {diagList && (diagList.length > 0) && diagList.map((item, index) => {console.log(diagList,item)
+                    {diagList && (diagList.length > 0) && diagList.map((item, index) => {
                         const {tcmDiag,tcmSyndrome} = item;
                         const {tcmDiag,tcmSyndrome} = item;
                         return (<div draggable={false} className={`${style['diag-box']} ${setFontColorSize(2,3)} clearfix`} id="diagListBox" key={index} >
                         return (<div draggable={false} className={`${style['diag-box']} ${setFontColorSize(2,3)} clearfix`} id="diagListBox" key={index} >
                             {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
                             {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
@@ -369,15 +368,15 @@ class DiagnosticList extends Component {
                                         <input type="text" value={tcmSyndrome} onFocus={(e)=>{this.handleFocus()}} onBlur={(e)=>{this.handleBlur(e,item,index)}} onInput={(e)=>this.handleInput(e,index)}/>
                                         <input type="text" value={tcmSyndrome} onFocus={(e)=>{this.handleFocus()}} onBlur={(e)=>{this.handleBlur(e,item,index)}} onInput={(e)=>this.handleInput(e,index)}/>
                                       </span>
                                       </span>
 
 
-                                    </span>:<Add showText="添加中医症候" isTcm={isTcm} handleClick={this.handleSymShowSearch} id="addSymDiag" height="50px" />}
-                                    <DiagResultSearch
+                                    </span>:(tcmDiag?<Add showText="添加中医症候" isTcm={isTcm} handleClick={this.handleSymShowSearch} id="addSymDiag" height="50px" />:'')}
+                                {tcmDiag&&tcmSyndrome?'':<DiagResultSearch
                                         refreshScroller={refreshScroller}
                                         refreshScroller={refreshScroller}
                                         setHighter={setHighter}
                                         setHighter={setHighter}
                                         windowHeight={windowHeight}
                                         windowHeight={windowHeight}
                                         pageTop={this.state.pageTop}
                                         pageTop={this.state.pageTop}
                                         isTcm={isTcm}
                                         isTcm={isTcm}
                                         height={150}>
                                         height={150}>
-                                    </DiagResultSearch>
+                                    </DiagResultSearch>}
                                 {tcmDiag&&tcmSyndrome?<span className={style['treat']}
                                 {tcmDiag&&tcmSyndrome?<span className={style['treat']}
                                   onClick={() =>{this.showTreat(item, index)}}>
                                   onClick={() =>{this.showTreat(item, index)}}>
                                           <img src={item.hasTreat?singleB:singleL} alt=""/>
                                           <img src={item.hasTreat?singleB:singleL} alt=""/>
@@ -399,7 +398,7 @@ class DiagnosticList extends Component {
                                   cancel={this.cancel}
                                   cancel={this.cancel}
                                   close={this.close}
                                   close={this.close}
                     >
                     >
-                        <div className={style['del-msg']}>是否删除诊断{delItem.name}?</div>
+                        <div className={style['del-msg']}>是否删除中医诊断{delItem.tcmDiag}?</div>
                     </ConfirmModal>
                     </ConfirmModal>
                     <Loading show={loading}/>
                     <Loading show={loading}/>
                 </div>
                 </div>

+ 1 - 3
src/containers/DiagnosticItem.js

@@ -27,15 +27,13 @@ function mapDispatchToProps(dispatch) {
                 type: ADD_DIAGNOSTIC,
                 type: ADD_DIAGNOSTIC,
                 item: item,
                 item: item,
                 isTcm,
                 isTcm,
-                isSym:showSym,      //中医症候
+                isSym:showSym,      //是否是中医症候
             });
             });
             dispatch({
             dispatch({
                 type: GET_DIAGNOSTIC_STR,
                 type: GET_DIAGNOSTIC_STR,
                 isTcm
                 isTcm
             });
             });
             dispatch(isAddMainSuit())
             dispatch(isAddMainSuit())
-            // dispatch(addDiagnostic(item))
-            //dispatch(getConceptDetail({type:7,name: item.name, position: 1},false,true,true))
         },
         },
         showSearch:()=>{
         showSearch:()=>{
             dispatch({
             dispatch({

+ 27 - 13
src/store/actions/diagnosticList.js

@@ -53,22 +53,36 @@ export const addDiagMsg = (state, action) => {  //选中诊断依据
 export const addTcmDiagnostic = (state, action) => {
 export const addTcmDiagnostic = (state, action) => {
     const res = JSON.parse(JSON.stringify(state));
     const res = JSON.parse(JSON.stringify(state));
     console.log('addTcmDiagnostic',action)
     console.log('addTcmDiagnostic',action)
-    const { isSym } = action
+    const { isSym } = action;
+    let obj=null;
     //如果上一个诊断和症候不全,则不添加新行
     //如果上一个诊断和症候不全,则不添加新行
     const len = res.tcmList.length;
     const len = res.tcmList.length;
-    const it= len>0?res.tcmList[len-1]:null;
-    if(len>0&&!(it.tcmDiag&&it.tcmSyndrome)){
-        it[isSym?'tcmSyndrome':'tcmDiag']=action.item.name;
-        res.otherIndex=it; //新增的自动选为诊断依据,作为推送入参
-        return res;
+    if(len===0){    //len==0,只可能是添加中医诊断
+        obj = {
+            "tcmDiag":action.item.name, //中医诊断
+            "tcmSyndrome":"",      //中医症候
+            "hasTreat":1,       //默认第一个为治疗方案,作为推送入参
+        };
+        res.tcmList.push(obj);
+    }else{
+        if(isSym){      //上一个症候没填,不用新增
+            res.tcmList[len-1].tcmSyndrome=action.item.name;
+            if(len===1){
+                res.otherIndex = {
+                    "tcmDiag":res.tcmList[0].tcmDiag, //中医诊断
+                    "tcmSyndrome":action.item.name,      //中医症候
+                }
+            }
+        }else{
+            obj = {
+                "tcmDiag":action.item.name, //中医诊断
+                "tcmSyndrome":"",      //中医症候
+                "hasTreat":0,
+            };
+            res.tcmList.push(obj);
+        }
     }
     }
-    //第一个或上一个诊断和症候填全
-    const obj ={
-        "tcmDiag":isSym?"":action.item.name, //中医诊断
-        "tcmSyndrome":isSym?action.item.name:"",      //中医症候
-    };
-    res.tcmList.push(obj);
-    res.otherIndex=obj; //新增的自动选为诊断依据,作为推送入参
+    //console.log(res)
     return res;
     return res;
 }
 }
 
 

+ 0 - 1
src/store/reducers/diagnosticList.js

@@ -51,7 +51,6 @@ const initState = {
     
     
     ],
     ],
     tcmList:[],
     tcmList:[],
-    symList:[],
     mainSuitStr:'',
     mainSuitStr:'',
     diagnosticStrNoType:'',
     diagnosticStrNoType:'',
     diagnosticStr:'',
     diagnosticStr:'',