浏览代码

Merge branch 'dev/new1' into dev/byll

Luolei 6 年之前
父节点
当前提交
aa6d15a7c1
共有 57 个文件被更改,包括 437 次插入245 次删除
  1. 4 1
      src/common/components/ConfirmModal/index.jsx
  2. 0 1
      src/common/components/ConfirmModal/index.less
  3. 2 2
      src/common/components/EditableSpan/index.jsx
  4. 1 1
      src/common/components/EditableSpan/index.less
  5. 9 0
      src/common/components/NumberUnitPan/index.jsx
  6. 1 1
      src/common/components/NumberUnitPan/index.less
  7. 1 1
      src/common/components/Textarea/index.jsx
  8. 7 2
      src/common/js/func.js
  9. 3 1
      src/common/less/variables.less
  10. 2 1
      src/components/AddInspect/index.jsx
  11. 1 1
      src/components/CheckBody/index.jsx
  12. 4 4
      src/components/CopyRight/index.jsx
  13. 10 3
      src/components/CopyRight/index.less
  14. 1 1
      src/components/DiagnosticList/index.jsx
  15. 5 5
      src/components/Inspect/index.jsx
  16. 2 1
      src/components/MultSpread/index.jsx
  17. 5 5
      src/components/NumberDrop/index.jsx
  18. 3 2
      src/components/NumberUnitDrop/index.jsx
  19. 0 12
      src/components/Operation/index.jsx
  20. 1 1
      src/components/OtherHistory/index.jsx
  21. 0 1
      src/components/PushItems/index.jsx
  22. 11 11
      src/components/PushItems/index.less
  23. 16 5
      src/components/SpreadDrop/index.jsx
  24. 22 17
      src/components/Treat/DrugTreat/index.jsx
  25. 10 2
      src/components/Treat/DrugTreat/index.less
  26. 3 2
      src/components/Treat/GeneralTreat/index.jsx
  27. 13 0
      src/components/Treat/GeneralTreat/index.less
  28. 18 15
      src/components/Treat/index.jsx
  29. 37 18
      src/components/Treat/index.less
  30. 6 0
      src/components/TreatDesc/DrugInfo/index.jsx
  31. 9 7
      src/components/TreatDesc/DrugInfo/index.less
  32. 7 6
      src/components/TreatDesc/index.jsx
  33. 19 5
      src/components/TreatDesc/index.less
  34. 2 0
      src/config/index.js
  35. 5 2
      src/containers/CheckBody.js
  36. 1 1
      src/containers/CurrentIll.js
  37. 2 2
      src/containers/EditableSpan.js
  38. 3 0
      src/containers/NumberUnitDrop.js
  39. 6 4
      src/containers/OtherHistory.js
  40. 5 3
      src/containers/SpreadDrop.js
  41. 6 2
      src/containers/Treat.js
  42. 0 1
      src/containers/TreatDrug.js
  43. 4 2
      src/containers/eleType.js
  44. 1 1
      src/main.js
  45. 20 7
      src/store/actions/checkBody.js
  46. 27 18
      src/store/actions/currentIll.js
  47. 18 6
      src/store/actions/homePage.js
  48. 27 13
      src/store/actions/mainSuit.js
  49. 16 13
      src/store/actions/otherHistory.js
  50. 1 1
      src/store/actions/pushMessage.js
  51. 12 0
      src/store/actions/treat.js
  52. 11 5
      src/store/async-actions/diagnosticList.js
  53. 2 2
      src/store/async-actions/fetchModules.js
  54. 7 4
      src/store/async-actions/treat.js
  55. 6 2
      src/store/reducers/treat.js
  56. 2 0
      src/store/types/treat.js
  57. 20 21
      src/utils/tools.js

+ 4 - 1
src/common/components/ConfirmModal/index.jsx

@@ -68,6 +68,7 @@ const defaultProps = {
     cancelBorderColor: '#414141',
     cancelBg: '#fff',
     width: '300px',
+    height: '200px',
 };
 
 class ConfirmModal extends Component {
@@ -123,10 +124,12 @@ class ConfirmModal extends Component {
             closable, 
             noFooter
         } = this.props;
+        const marginLeft = -parseInt(width)/2
+        const marginTop = -parseInt(height)/2
         return (
             <NewPortal visible={visible}>
                 <div className={styles['modal-wrapper']} id='confirm'>
-                    <div className={styles[['modal']]} style = {{width: width, height:height}}>
+                    <div className={styles[['modal']]} style = {{width: width, marginLeft:marginLeft, height:height, marginTop:marginTop}}>
                         <div className={styles['modal-title']} style={{background: titleBg}}>{title ? title : ''} {closable ? <img onClick={this.closeModal} className={styles['modal-close']} src = {close}/> : false}</div>
                         <div className={styles['modal-content']}>{children}</div>
                         {noFooter ? '' : <div className={styles['modal-operator']+' clearfix'}>

+ 0 - 1
src/common/components/ConfirmModal/index.less

@@ -2,7 +2,6 @@
     position: fixed;
     top: 50%;
     left: 50%;
-    transform: translate(-50%,-50%);
     margin: auto;
     border-radius: 5px;
     background: #fff;

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

@@ -132,13 +132,13 @@ class EditableSpan extends Component{
     const target = ev.target||ev.srcElement;
     let innerVal = target.innerText;
     if(ev.keyCode==8){
-      if(innerVal !==preVal){return}
+      if(innerVal !==preVal){return false}
       let data = innerVal.trim();
       //判断是否为空、中英文:, 。、;,且不是第一位
       let pattern = new RegExp(/^\,?$|^\,?$|^\.?$|^\。?$|^\、?$|^\;?$|^\;?$|^\:?$|^\:?$\s/);
       // if(i!==0 &&data==""||data==","||data==","||data==":"||data==":"||data=="."||data=="。"||data=="、"||data==";"||data==";"){
       if(index!==0 && pattern.test(data)){
-        handleKeydown&&handleKeydown({boxMark,i:index});
+        handleKeydown&&handleKeydown({boxMark,i:index,text:data});
         this.setState({
           // index:index-1 //连续往前删除,体验不佳
           index: null

+ 1 - 1
src/common/components/EditableSpan/index.less

@@ -7,7 +7,7 @@
   /*height: 20px;*/
   line-height: 16px;
   /*vertical-align: middle;*/
-  text-align: center;
+  text-align: left;
 }
 .full{
   width: 100%;

+ 9 - 0
src/common/components/NumberUnitPan/index.jsx

@@ -55,6 +55,14 @@ class NumberUnitPan extends Component{
     });
     onSelect&&onSelect(text);
   }
+  componentWillReceiveProps(nextProps){
+    //重新选择的值替换 不追加
+     if(!nextProps.show){
+      this.setState({
+        value:''
+      });
+     }
+  }
   render(){
     // const select = this.handleSelect.bind(this);
     const {show} = this.props;      //table onBlur阻止冒泡是为了修复multSpread中数字键盘点击触发最外层数字组件onBlur事件
@@ -88,6 +96,7 @@ class NumberUnitPan extends Component{
         <td><span onClick={this.handleSelect}>{config.timeUnit.minute}</span></td>
         <td><span onClick={this.handleSelect}>{config.timeUnit.hour}</span></td>
         <td><span onClick={this.handleSelect}>{config.timeUnit.day}</span></td>
+        <td><span onClick={this.handleSelect}>{config.timeUnit.age}</span></td>
       </tr>
       <tr>
         <td><span onClick={this.handleSelect}>{config.timeUnit.week}</span></td>

+ 1 - 1
src/common/components/NumberUnitPan/index.less

@@ -18,7 +18,7 @@
     height: 100%;
     text-align: center;
     line-height: 44px;
-    color: #666;
+    color: #333;
     cursor: pointer;
   }
   span:hover{

+ 1 - 1
src/common/components/Textarea/index.jsx

@@ -77,7 +77,7 @@ class Textarea extends Component {
   }
   componentWillReceiveProps(next){
     const isRead = this.props.isRead;
-    if(next.isRead != isRead){
+    if(next.isRead != isRead||next.value!=this.props.value){      //value对比解决复诊不显示bug
       this.$dom.current.innerText = next.value||'';
     }
   }

+ 7 - 2
src/common/js/func.js

@@ -79,11 +79,13 @@ function notTextLabel(label){
 * 入参:arr源数组,
 *       noPre是否不添加前置文本标签,默认false即添加
 *       noEnd是否不添加后置文本标签,默认false即添加
+*       ifEmpty是否添加空标签,默认true即添加,传false添加逗号,如查体
 * */
-export const fullfillText = (arr,noPre=false,noEnd=false)=>{
+export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
   let newArr =[],
       pre={},
       textLabel={},
+      _textLabel={},
       notText = true,
       saveText=[],
       tempText = '',
@@ -92,6 +94,7 @@ export const fullfillText = (arr,noPre=false,noEnd=false)=>{
     notText = notTextLabel(it);
     value = it.value||'';
     textLabel = JSON.parse(config.textLabel);
+    _textLabel = JSON.parse(config._textLabel);
     if(i===0){
       //第一个标签不是文本标签时在前面添加文本标签
       if(!noPre&&notText){
@@ -106,7 +109,8 @@ export const fullfillText = (arr,noPre=false,noEnd=false)=>{
       pre = arr[i-1];
       //如果本身不是文本标签且前面一个也不是文本标签,该标签前面添加文本标签
       if(notTextLabel(pre)&&notText){
-          newArr.push(textLabel,it);
+          // newArr.push(textLabel,it);
+          ifEmpty?newArr.push(textLabel,it):newArr.push(_textLabel,it);
           tempText = value?it.labelPrefix+value+it.labelSuffix:'';
           saveText.push("",tempText); 
         //最后一个非文本标签,后面添加一个文本标签
@@ -130,6 +134,7 @@ export const fullfillText = (arr,noPre=false,noEnd=false)=>{
   return {newArr,saveText};
 };
 
+
 //获取标签index,入参:病例项index+标签index+标签内index
 export const getLabelIndex = (index)=>{
   let ikey = '';

+ 3 - 1
src/common/less/variables.less

@@ -53,9 +53,11 @@
 /*******下拉框公用样式**********/
 .pop{
   position: absolute;
-  top:40px;
+  // top:40px;
+  top:30px;
   background: #fff;
   box-shadow: 0 10px 20px 0 #989DA3;
+  filter:progid:DXImageTransform.Microsoft.Shadow(color='#CCCCCC',Direction=125,Strength=4);
   z-index: 203;
   padding: 20px;
   white-space: nowrap;

+ 2 - 1
src/components/AddInspect/index.jsx

@@ -3,6 +3,7 @@ import { SearchOption, InspectCommon, Calendar ,Notify,ConfirmModal,Add} from '@
 import { deepClone } from '@utils/tools';
 import styles from './index.less';
 import date1 from './img/date1.png';
+import date2 from './img/date2.png';
 import close from './img/close.png';
 import store from '@store';
 import $ from 'jquery';
@@ -339,7 +340,7 @@ class Inspect extends React.Component {
                                                     handleClear={(e)=>{
                                                         handleClear(e,idx)
                                                         this.setState({
-                                                            currentData:fillActive
+                                                            showFill:false
                                                         })
                                                     }}
                                                     handleConfirm={(e)=>{

+ 1 - 1
src/components/CheckBody/index.jsx

@@ -76,7 +76,7 @@ class CheckBody extends Component{
     return  <div className={style['container']}>
       <ItemBox title='查体' editable={!data.length}  handleClick={this.handleClick} onchange={this.handleInput}>
         {this.getLabels()}
-        <SearchDrop data={searchData} show={!totalHide} left={boxLeft} top={boxTop} onSelect={this.handleSearchSelect}></SearchDrop>
+        {searchData && searchData.length>0?<SearchDrop data={searchData} show={!totalHide} left={boxLeft} top={boxTop} onSelect={this.handleSearchSelect}></SearchDrop>:''}
       </ItemBox>
     </div>
   }

+ 4 - 4
src/components/CopyRight/index.jsx

@@ -87,7 +87,7 @@ class CopyRight extends Component {
           {hasNewVersion && <span>new</span>} &copy;<b>朗通医疗</b>
           <div className={style['disclaimer']} onClick={showDisclatmerModal}>免责声明</div>
         </div>
-        <div
+        {copyVisible && <div
           className={style["copyModal"]}
           style={copyVisible ? { display: "block" } : { display: "none" }}
         >
@@ -100,8 +100,8 @@ class CopyRight extends Component {
             </div>
             <div className={style["content"]}>{copyContent}</div>
           </div>
-        </div>
-        <div
+        </div>}
+       {disVisible && <div
           className={style["disModal"]}
           style={disVisible ? { display: "block" } : { display: "none" }}
         >
@@ -111,7 +111,7 @@ class CopyRight extends Component {
             <div className={style["content"]}>{this.disclatmerContent()}</div>
             <div className={style["btnBox"]}><span  className={style["btn"]} onClick={closeDisclatmerModal}>确定</span></div>
           </div>
-        </div>
+        </div>}
       </div>
     );
   }

+ 10 - 3
src/components/CopyRight/index.less

@@ -50,21 +50,28 @@
         position: fixed;
         width: 820px;
         left: 50%;
+        top: 20%;
         margin-left: -410px;
         background: #fff;
-        top: 65px;
-       
+        height: 60%;
+        padding: 80px 0 40px;
         img{
           float: right;
           margin: -5px 5px 0px 0px;
           cursor: pointer;
         }
         .header {
+          position: absolute;
+          width: 100%;
+          top: 0;
           font-size: 14px;
           padding: 10px 0px 10px 10px;
           border-bottom: 1px solid #EAEDF1;
         }
         .now{
+          position: absolute;
+          width: 100%;
+          top: 35px;
           font-size: 18px;
           padding: 15px 10px;
           border-bottom:1px solid #EAEDF1;
@@ -75,8 +82,8 @@
           }
         }
         .content {
+          height: 100%;
           padding: 10px;
-          max-height: 400px;
           overflow-y: auto;
         }
       }

+ 1 - 1
src/components/DiagnosticList/index.jsx

@@ -88,7 +88,7 @@ class DiagnosticList extends Component {
                                     <span className={style['diag-name']} onClick={()=>{this.handleClickDiag(item)}}>{item.name}<span></span></span> 
                                     {item.type === 1 ? <span className={style['diag-first']}>初诊</span> :<span className={style['diag-second']}> 复诊</span>}
                                     <span className={style['treat']}
-                                          style ={{ color: hasTreat ?'' : 'gray', border: hasTreat ?'' : '1px solid gray'}}
+                                          style ={{ color: hasTreat ?'' : 'gray', border: hasTreat ?'1px solid #3B9ED0' : '1px solid gray'}}
                                           onClick={() =>{hasTreat && this.showTreat(item)}}>
                                           治疗方案
                                     </span>

+ 5 - 5
src/components/Inspect/index.jsx

@@ -46,15 +46,15 @@ class Inspect extends React.Component {
         this.cancel = this.cancel.bind(this)
         this.getWarings = this.getWarings.bind(this)
     }
-    componentDidMount(){ 
-        var ua = navigator.userAgent;  
+    componentDidMount(){
+        var ua = navigator.userAgent;
         var _isIE = ua.indexOf("MSIE")>-1;
-        if(_isIE){  
+        if(_isIE){
             let version =  ua.match(/MSIE ([\d.]+)/)[1];
             this.setState({
                 ieVersion:version
             })
-        }      
+        }
         $('iframe').bind( 'load', function(){} )
       const {fetchPushInfos} = this.props;
         // FileAPI.debug = true
@@ -77,7 +77,7 @@ class Inspect extends React.Component {
             },
             function (files, rejected){
                 if( files.length ){
-                    // console.log(files[0])
+                    console.log(files[0])
                     FileAPI.upload({
                         // url: '/api/icss/lisExcelRes/lisExcelAnalysis',
                         url: api.upload,

+ 2 - 1
src/components/MultSpread/index.jsx

@@ -127,7 +127,8 @@ class MultSpread extends Component{
     return (<div style={{display:'inline-block'}}
                  onDoubleClick={this.changeToEdit}
                  contentEditable={this.state.editable}
-                 onBlur={this.handleEdit}>
+                 onBlur={this.handleEdit}
+                 onkeydown={tools.handleEnter}>
       {textPrefix?<span>{textPrefix}</span>:''}
       <div className={this.getClass()}>
       {this.getLabels()}

+ 5 - 5
src/components/NumberDrop/index.jsx

@@ -38,7 +38,7 @@ class NumberDrop extends Component{
     });
     handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
   }
-  handleNumFocus(e){console.log(1);        //数字框可编辑状态下聚集事件,处理是否显示下拉等
+  handleNumFocus(e){       //数字框可编辑状态下聚集事件,处理是否显示下拉等
     e.stopPropagation();
     const {show,handleShow,ikey,id,patId,handleHide,value} = this.props;
     const that = this;
@@ -58,7 +58,7 @@ class NumberDrop extends Component{
       timer
     });
   }
-  handleNumClick(e){console.log(2);      //数字框不可编辑的状态时点击事件,点击将数字框变为可输入且下拉不再显示直到失焦后再次聚集
+  handleNumClick(e){      //数字框不可编辑的状态时点击事件,点击将数字框变为可输入且下拉不再显示直到失焦后再次聚集
     e.stopPropagation();
     const {show,handleShow,ikey,id,patId,handleHide,value} = this.props;
     const {hasSelect} = this.state;
@@ -74,7 +74,7 @@ class NumberDrop extends Component{
       });
     }
   }
-  numInpBlur(e){console.log(3);        //数字框失焦,保存值到store中
+  numInpBlur(e){        //数字框失焦,保存值到store中
     e.stopPropagation();
     this.setState({
       isClosed:false,
@@ -85,7 +85,7 @@ class NumberDrop extends Component{
     const text = e.target.innerText===placeholder?'':e.target.innerText;
     handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
   }
-  handleSpanInp(e){ console.log(4);     //数字框输入事件
+  handleSpanInp(e){    //数字框输入事件
     e.stopPropagation();
     //const {value} = this.props;
   }
@@ -108,7 +108,7 @@ class NumberDrop extends Component{
       handleDbclick && handleDbclick({id:patId||id});
     }
   }
-  handleBlur(e){console.log(5);     //双击编辑blur
+  handleBlur(e){     //双击编辑blur
     const {handleLabelChange,ikey,boxMark} = this.props;
     //if(!this.state.editable) return;
     this.setState({

+ 3 - 2
src/components/NumberUnitDrop/index.jsx

@@ -70,12 +70,13 @@ class NumberUnitDrop extends Component{
   //数字框失焦,保存值到store中
   numInpBlur(e){
     e.stopPropagation();
-    const {handleSelect,ikey,suffix,prefix,mainSaveText} = this.props;
+    const {handleSelect,ikey,suffix,prefix,mainSaveText,handleLabelChange,boxMark} = this.props;
     const {editable} = this.state;
     if(editable){
       const text = e.target.innerText;
       // this.$span.current.innerText='';      //修改生成文字变成输入的2倍bug 
-      handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
+      // handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
+      handleLabelChange&&handleLabelChange({ikey,changeVal:text,suffix,prefix,mainSaveText,type:boxMark});
       
     }
     this.setState({

+ 0 - 12
src/components/Operation/index.jsx

@@ -287,18 +287,6 @@ class Operation extends Component {
       >
         {this.state.msg}
       </ConfirmModal>
-      <ConfirmModal
-        visible={diagShow}
-        confirm={() => { this.makeSure() }}
-        close={() => { diagShowTmp(false); this.setState({ title: '' }) }}
-        cancel={() => { diagShowTmp(false); this.setState({ title: '' }) }}
-        okText={this.state.okText}
-        okBorderColor={this.state.borderColor}
-        okColor={this.state.okColor}
-        oKBg={this.state.oKBg}
-      >
-        {this.state.msg}
-      </ConfirmModal>
     </div>;
   }
 }

+ 1 - 1
src/components/OtherHistory/index.jsx

@@ -104,7 +104,7 @@ class OtherHistory extends Component{
     return  <div>
       <ItemBox title='其他史' editable={hasData?false:true} isRead={isRead} handleClick={this.handleClick} handleFocus={this.getData} onchange={this.handleInput}>
         {this.getLabels()}
-        <SearchDrop data={searchData} show={!totalHide} left={boxLeft} top={boxTop} onSelect={this.handleSearchSelect}></SearchDrop>
+        {searchData && searchData.length>0?<SearchDrop data={searchData} show={!totalHide} left={boxLeft} top={boxTop} onSelect={this.handleSearchSelect}></SearchDrop>:''}
       </ItemBox>
     </div>
   }

+ 0 - 1
src/components/PushItems/index.jsx

@@ -95,7 +95,6 @@ class PushItems extends Component {
       showAdd,
       showTips
     } = this;
-    // console.log('tipsDiscalimer', tipsDiscalimer)
     let assayNum = 0;
     let assayHide = assay.map((item, index) => {
       assayNum = assayNum + item.name.length + 2;

+ 11 - 11
src/components/PushItems/index.less

@@ -55,7 +55,7 @@
         }
       }
       div{
-        font-size: 12px;
+        font-size: 14px;
         padding:6px 15px;
         span{
           cursor: pointer;
@@ -66,7 +66,7 @@
   .show {
     float: right;
     color:  #58ACD7;;
-    font-size: 12px;
+    font-size: 14px;
     cursor: pointer;
     img {
       width: 12px;
@@ -77,7 +77,7 @@
     float: right;
     text-align: right;
     color: #58ACD7;
-    font-size: 12px;
+    font-size: 14px;
     cursor: pointer;
     clear: both;
     img {
@@ -120,7 +120,7 @@
       }
     }
     div{
-      font-size: 12px;
+      font-size: 14px;
       padding:6px 15px;
       ul{
         .firstLi{
@@ -142,14 +142,14 @@
             padding: 0px 0px 0px 0px;
             margin-top: -2px;
             span{
-              font-size: 12px;
-              line-height: 12px;
+              font-size: 14px;
+              line-height: 14px;
               display: inline-block;
               margin: 6px;
               input[type='checkbox']{
                 float: left;
-                width: 12px;
-                height: 12px;
+                width: 14px;
+                height: 14px;
                 margin-right: 2px;
                 background-color: #fff;
                 -webkit-appearance:none;
@@ -183,7 +183,7 @@
       }
     }
     .content{
-      font-size: 12px;
+      font-size: 14px;
       padding:6px 15px;
       .title {
         font-size: 14px;
@@ -191,7 +191,7 @@
         margin-bottom:10px;
         a{
           display: inline-block;
-          font-size: 12px;
+          font-size: 14px;
           color: #3B9ED0;
           width: 42px;
           /*height: 20px;
@@ -210,7 +210,7 @@
           border: 1px solid #3B9ED0;
           border-radius: 4px;
           text-align: center;
-          font-size: 12px;
+          font-size: 14px;
           color: #3B9ED0;
           line-height: 18px;
           margin: 0 10px -2px;

+ 16 - 5
src/components/SpreadDrop/index.jsx

@@ -35,6 +35,8 @@ class SpreadDrop extends Component{
       ban:{},  //放'伴'字段
       editable:false,      //双击编辑
       labelVal:'',  //存放标签原有的值--主诉字数限制用
+      boxLeft:null,
+      boxTop:null
     };
     this.$div = React.createRef();
     this.handleSelect = this.handleSelect.bind(this);
@@ -51,6 +53,13 @@ class SpreadDrop extends Component{
   }
   handleShow(e){//单击
     e&&e.stopPropagation();
+    let boxLeft = e.pageX -175 + 'px';
+    let offsetTop = e.target.offsetTop;
+    let boxTop = offsetTop + 29 + 'px';
+    this.setState({
+      boxLeft:boxLeft,
+      boxTop:boxTop
+    })
     // window.event? window.event.cancelBubble = true : e.stopPropagation();
     // this.setStateInit();      //恢复初始选中状态
     const {ikey,handleShow,placeholder,flag,id,value,tagType,type} = this.props;
@@ -68,10 +77,12 @@ class SpreadDrop extends Component{
   }
 
   changeToEdit(e){//双击
-    const {value,id,placeholder,handleDbclick} = this.props;
+    const {value,id,placeholder,handleDbclick,handleHide} = this.props;
     let text = e.target.innerText;
+    handleHide&&handleHide();       //展开情况下双击收起
     // clearTimeout(this.state.timer);//取消延时的单击事件
     e.stopPropagation();
+    // e.preventDefault();
     if(value&&value.trim()){//有选中值的标签才能双击编辑
       this.setState({
         labelVal:text,
@@ -82,7 +93,7 @@ class SpreadDrop extends Component{
     }
   }
 
-  onChange(e){  
+  onChange(e){
     const {mainSaveText,ikey,type,handleLabelChange} = this.props;
     const {labelVal,editable} = this.state;
     let mainText = filterArr(mainSaveText);//主诉字数
@@ -118,7 +129,7 @@ class SpreadDrop extends Component{
     this.setState({
       editable:false
     });
-    
+
 
   }
   setStateInit(){
@@ -310,7 +321,7 @@ class SpreadDrop extends Component{
 
   render(){
     const {placeholder,value,show} = this.props;
-    const {editable} = this.state;
+    const {editable,boxLeft,boxTop} = this.state;
     return <div className={style['container']}
             onFocus={(e)=>e.stopPropagation()}
             onBlur={(e)=>e.stopPropagation()}
@@ -325,7 +336,7 @@ class SpreadDrop extends Component{
       onInput={this.onChange}
       onkeydown={handleEnter}
       >{value||placeholder}</div>
-      <div className={style["drop-list"]} style={{display:show?'block':'none'}} contentEditable="false" onClick={(e)=>{e.stopPropagation();}}>
+      <div className={style["drop-list"]} style={{display:show?'block':'none',top:boxTop,left:boxLeft}} contentEditable="false" onClick={(e)=>{e.stopPropagation();}}>
         {this.getLabels()}
         <div className="oper">
           <span className={style['clear']} onClick={this.handleClear}>清空选项</span>

+ 22 - 17
src/components/Treat/DrugTreat/index.jsx

@@ -28,9 +28,10 @@ class DrugTreat extends Component {
         setDrugInfo && setDrugInfo(item);
     }
     showTreatDesc() {
-        $('#treatWrapper').animate({'width': '940px'}, 500);
-        $('#treatDescBox').animate({'width': '260px'}, 500);
+        $('#treatDescBox').css({'display': 'block'});
         $('#treatWrapper').animate({'margin-left': '-470px'}, 300);
+        $('#treatDescBox').animate({'width': '260px'}, 500);
+        
     }
     
 
@@ -42,21 +43,25 @@ class DrugTreat extends Component {
                 <h3 className={style['drug-title']}><img className={style['drug-icon']} src={drugIcon}/> 常用药物治疗</h3>
                 {treatment.map((item, index) => {
                     return(<div className={style['drug-content']}>
-                        {index + 1 + '. ' }{item.drugsName}:&nbsp;
-                        {item.medicitionsList.map((it, ii) => {
-                            return ((it.isShow == 1 || it.selected) && <span style={it.forbidden === '2' ? {opacity: '0.3', filter:'alpha(opacity=30)'} : ''}>
-                                    {ii === 0 ? '' : ', '}
-                                    <span className={style['drug-name']}  
-                                          onDoubleClick={() =>{this.setDrugInfo(it);showDrugInfo();}} 
-                                          onClick={()=>{it.forbidden === '2' ? '' : this.handleSelect(index,ii)}} style={it.selected ? {color: '#3B9ED0', borderBottom: '1px solid #3B9ED0'}:''}>
-                                        {it.medicitionName}
-                                    </span>
-                                    {/* {it.showInfo && it.showInfo==='1'&& <img className={style['info-img']} src={info} onClick={() =>{this.setDrugInfo(it);showDrugInfo();}}/>} */}
-                                    {it.forbidden === '1' ? <span className={style['info-flag']} style={{border: '1px solid #F4C051', background: '#F4C051',marginLeft: '5px'}}>慎用</span>: it.forbidden === '2' ? <span className={style['info-flag']} style={{border: '1px solid #000',marginLeft: '5px'}}>禁用</span> : ''}, 使用率{it.rate}
-                                    
-                                </span>)
-                        })}
-                        {<span className={style['drug-more']} onClick={() =>this.setOtherRecommend(item, index)} ><img className={style['info-img']} src={more} />更多同类药</span> }
+                        <div  className={style['drug-name-box']}>
+                            {index + 1 + '. ' }{item.drugsName}:&nbsp;
+                            {item.medicitionsList.map((it, ii) => {
+                                return ((it.isShow == 1 || it.selected) && <span style={it.forbidden === '2' ? {opacity: '0.3', filter:'alpha(opacity=30)'} : ''}>
+                                        {ii === 0 ? '' : ', '}
+                                        <span className={style['drug-name']}  
+                                            onDoubleClick={() =>{this.setDrugInfo(it);showDrugInfo();}} 
+                                            onClick={()=>{it.forbidden === '2' ? '' : this.handleSelect(index,ii)}} style={it.selected ? {color: '#3B9ED0', borderBottom: '1px solid #3B9ED0'}:''}>
+                                            {it.medicitionName}
+                                        </span>
+                                        {/* {it.showInfo && it.showInfo==='1'&& <img className={style['info-img']} src={info} onClick={() =>{this.setDrugInfo(it);showDrugInfo();}}/>} */}
+                                        {it.forbidden === '1' ? <span className={style['info-flag']} style={{border: '1px solid #F4C051', background: '#F4C051',marginLeft: '5px'}}>慎用</span>: it.forbidden === '2' ? <span className={style['info-flag']} style={{border: '1px solid #000',marginLeft: '5px'}}>禁用</span> : ''}, 使用率{it.rate}
+                                        
+                                    </span>)
+                            })}
+
+                        </div>
+                        {<div className={style['drug-more']} onClick={() =>this.setOtherRecommend(item, index)} ><img className={style['info-img']} src={more} />更多同类药</div> }
+                        
                     </div>)
                 })}
             </div>

+ 10 - 2
src/components/Treat/DrugTreat/index.less

@@ -2,6 +2,7 @@
     background: #EAF7FA;
     height: 36px;
     line-height: 36px;
+    font-weight: bold;
 }
 .drug-icon {
     width: 16px;
@@ -9,6 +10,7 @@
     margin: 10px;
 }
 .drug-content {
+    position: relative;
     line-height: 36px;
     border-bottom: 1px dashed #D2D2D2;
 }
@@ -31,10 +33,16 @@
     text-align: center;
 }
 .drug-more {
-    display: inline-block;
     cursor: pointer;
-    float: right;
     color: #3B9ED0;
+    position: absolute;
+    right: 0;
+    top: 50%;
+    margin-top: -18px;
+}
+.drug-name-box {
+    float: left;
+    width: 530px;
 }
 .drug-content:after{display:block;clear:both;content:"";visibility:hidden;height:0}
 .drug-content{zoom:1}

+ 3 - 2
src/components/Treat/GeneralTreat/index.jsx

@@ -7,10 +7,11 @@ class GeneralTreat extends Component {
     }
 
     render() {
-        const { icon, titleBg, filter, title, generalTreat } = this.props
+        const { icon, titleStyle,titleBg, filter, title, generalTreat } = this.props
         return(
             generalTreat && generalTreat.length > 0 && <div className={style['general-wrapper']}>
-                <div className={style['general-title']} style={{background: titleBg,filter:filter}}><img className={style['general-icon']} src={icon}/>{title}</div>
+                <div className={style['general-title-box']} style={titleStyle}></div>
+                <div className={style['general-title']} ><img className={style['general-icon']} src={icon}/>{title}</div>
                 <div className={style['general-item']} dangerouslySetInnerHTML={{__html: generalTreat}}>
                 </div>
 

+ 13 - 0
src/components/Treat/GeneralTreat/index.less

@@ -1,9 +1,22 @@
 .general-wrapper {
+    position: relative;
     padding: 10px 0 0 0;
 }
+.general-title-box {
+    height: 36px;
+    line-height: 36px;
+    background: rgb(47,199,156);
+    opacity: 0.1;
+    filter:alpha(opacity=10);
+    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=10);";
+}
 .general-title {
+    position: absolute;
+    width: 100%;
+    top: 10px;
     height: 36px;
     line-height: 36px;
+    font-weight: bold;
 }
 .general-icon {
     width: 16px;

+ 18 - 15
src/components/Treat/index.jsx

@@ -7,8 +7,8 @@ import DrugInfo from '@components/TreatDesc/DrugInfo';
 import Notify from '@commonComp/Notify'
 import close from './img/close.png';
 import generalIcon from './img/general.png';
-
 import surgicalIcon from './img/surgical.png';
+import $ from "jquery";
 
 class Treat extends Component {
     constructor(props){
@@ -38,29 +38,28 @@ class Treat extends Component {
     }
 
     render(){
-        const { generalTreat, treatment, surgeryTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title} = this.props;
+        const { generalTreat, treatment, treatItem, surgeryTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title} = this.props;
         return(
-        <div className={style['treat-mask']}>
-            <div  id='treatWrapper' className={style['treat-wrapper']}>
-                
-                <div className={style['treat-box']}>
-                    <p className={style['treat-title']}>治疗方案 <img onClick={this.hideTreat} src={close}/></p>
+            <div   className={style['treat-wrapper']}>
+                <div className={style['treat-mask']}>
+                </div>
+                <div id='treatWrapper' className={style['treat-box']}>
+                    <div className={style['treat-title']}>治疗方案 ({treatItem.name})<img onClick={this.hideTreat} src={close}/></div>
+
                     <div className={style['treat-inner-box']}>
-                        <GeneralTreat icon={generalIcon} title='一般治疗' titleBg='rgba(47,199,156,0.1)' filter='progid:DXImageTransform.Microsoft.gradient(startColorstr=#192FC79C,endColorstr=#192FC79C)' generalTreat={generalTreat}></GeneralTreat>
+                        <GeneralTreat icon={generalIcon} title='一般治疗'   generalTreat={generalTreat}></GeneralTreat>
                         <DrugTreat treatment={ treatment } 
                                 selectDrug={selectDrug} 
                                 setOtherRecommend={ setOtherRecommend } 
                                 showDrugInfo = {showDrugInfo}
                                 setDrugInfo={ setDrugInfo }>
-                        </DrugTreat>
-                        <GeneralTreat icon={surgicalIcon} title='手术治疗' titleBg='#FAEAEA' generalTreat={surgeryTreat}></GeneralTreat>
+                        </DrugTreat> 
+                        <GeneralTreat icon={surgicalIcon} title='手术治疗' titleStyle={{background:'#FAEAEA',opacity:'1', filter:'alpha(opacity=100);',filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=100);'}} titleBg='#FAEAEA' generalTreat={surgeryTreat}></GeneralTreat>
                     </div>
                     <div className={style['bottom']}>
                         <span className={style['prescription-btn']} onClick={this.handlePrescription}>开处方</span> <span className={style['determine-btn']} onClick={this.handleDetermine}>确定</span>
                     </div>
-                    
-                </div>
-                {treatDesc && <TreatDesc 
+                    {treatDesc && <TreatDesc 
                     treatment={treatment} 
                     treatDesc={treatDesc} 
                     selectDrug={selectDrug} 
@@ -68,11 +67,15 @@ class Treat extends Component {
                     showDrugInfo = {showDrugInfo}
                     showDrug = {showDrug}
                     >
-                </TreatDesc>}
+                    </TreatDesc>}
+                </div>
+                
+                
                 {showDrug && drugInfo && <DrugInfo drugInfo = {drugInfo} hideDrugInfo = {hideDrugInfo}></DrugInfo>}
             </div>
+                
             
-        </div>
+        
         )
     }
 }

+ 37 - 18
src/components/Treat/index.less

@@ -1,31 +1,48 @@
 @import "~@less/mixin.less";
 .treat-wrapper{
     position: fixed;
-    background: #fff;
-    z-index: 102;
-    left: 50%;
-    top: 50%;
-    width: 680px;
-    height: 680px;
-    margin-left: -340px;
-    margin-top: -340px;
+    width: 100%;
+    height: 100%;
+    left: 0;
+    top: 0;
+    // background: #fff;
+    // left: 50%;
+    // top: 25%;
+    // width: 680px;
+    // margin-left: -340px;
+    // margin-top: -340px;
+    // z-index: 301;
+    z-index: 300;
 }
 .treat-mask {
     position: fixed;
-    background: rgba(0, 0, 0, 0.5);
     width: 100%;
     height: 100%;
     top: 0;
     left: 0;
-    z-index: 9999;
+    z-index: 300;
+    background: #000;
+    opacity: 0.6;
+    filter:alpha(opacity=60);
+    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=60);";
 }
 .treat-box {
+    position: fixed;
+    background: #fff;
     width: 680px;
-    float: left;
-    border-right: 1px solid #e0e2e4;
-    padding-bottom: 100px;
+    left: 50%;
+    top: 20%;
+    height: 60%;
+    margin-left: -340px;
+    z-index: 301;
+    padding-top: 40px;
+    padding-bottom: 80px;
 }
 .treat-title {
+    width: 100%;
+    position: absolute;
+    top: 0px;
+    background: #fff;
     height: 40px;
     line-height: 40px;
     border-bottom: 1px solid #e0e2e4;
@@ -39,18 +56,19 @@
     }
 }
 .treat-inner-box {
-    width: 680px;
-    height: 540px;
+    width: 100%;
+    height: 100%;
     padding: 10px 20px 0 20px;
-    overflow: hidden;
+
     overflow-y: auto;
 }
 
 .bottom {
     position: absolute;
-    bottom: 20px;
-    height: 40px;
+    width: 100%;
+    height: 80px;
     line-height: 40px;
+    background: #fff;
 }
 .prescription-btn,.determine-btn {
     position: absolute;
@@ -61,6 +79,7 @@
     border-radius: 4px;
     text-align: center;
     cursor: pointer;
+    top: 20px;
 }
 
 .prescription-btn {

+ 6 - 0
src/components/TreatDesc/DrugInfo/index.jsx

@@ -17,6 +17,12 @@ class DrugInfo extends Component {
                         return <div className={style['drug-desc-item']}><span className={style['drug-desc-title']}>{item.title}</span> <span className={style['drug-desc-content']} dangerouslySetInnerHTML ={{__html: item.content}}></span> </div>
                     })}
                 </div> }
+                { !drugInfo || (drugInfo && drugInfo.drugDesc.length === 0) && <div className={style['drug-desc-wrapper']}>
+                    <div>
+                        该药品暂无说明
+                    </div>
+                    
+                </div> }
 
         </div>)
     }

+ 9 - 7
src/components/TreatDesc/DrugInfo/index.less

@@ -1,21 +1,23 @@
 .drug-info-wrapper {
     position: fixed;
-    width: 850px;
-    height: 680px;
+    width: 950px;
+    height: 70%;
     left: 50%;
-    top: 50%;
-    margin-left: -425px;
-    margin-top: -340px;
+    top: 15%;
+    margin-left: -475px;
     background: #fff;
-    z-index: 103;
+    z-index: 303;
+    padding: 40px 0 60px;
     
 }
 .drug-desc-wrapper {
-    height: 640px;
+    height: 100%;
     overflow-y: auto;
     padding: 0 40px;
 }
 .drug-title {
+    position: absolute;
+    top: 0;
     width: 100%;
     height: 40px;
     line-height: 40px;

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

@@ -17,17 +17,17 @@ class TreatDesc extends Component {
         selectDrug && selectDrug(index,ii);
     }
     hideTreatDesc() {
-        $('#treatWrapper').animate({'width': '680px'}, 500);
-        $('#treatDescBox').animate({'width': '0px'}, 500);
+        $('#treatDescBox').css({'display': 'none'});
+        $('#treatDescBox').animate({'display': 'none'}, 500);
         $('#treatWrapper').animate({'margin-left': '-340px'}, 500);
     }
 
     render(){
         const  { treatment, treatDesc, setDrugInfo, showDrugInfo} = this.props
         const { title, basic, otherDrugIndex, drugDesc} = treatDesc
-        return (treatment && treatment.length >0 && <div id='treatDescBox' className={style['treat-desc-box']}>
-            <h3 className={style['drug-desc-title']}>同类药物  <img src={close} onClick={this.hideTreatDesc} className={style['close-drug-desc']} /></h3>
-            {title && title === '药品推荐' ? <div>
+        return (treatment && treatment.length >0 && <div  className={style['treat-desc-box']}>
+            
+            {title && title === '药品推荐' ? <div className={style['similar-drug-box']} id='treatDescBox'>
                 {/* { basic && basic.length > 0 && <div> //推荐依据不需要展示
                     <h3 className={style['recommend-title']}>推荐依据</h3>
                     {basic.map((item, index) =>{
@@ -36,7 +36,8 @@ class TreatDesc extends Component {
                     })}
                     
                 </div> } */}
-                { otherDrugIndex > -1 && <div className={style['similar-drug']}>
+                { otherDrugIndex > -1 && <div  className={style['similar-drug']}>
+                    <h3 className={style['drug-desc-title']}>同类药物  <img src={close} onClick={this.hideTreatDesc} className={style['close-drug-desc']} /></h3>
                     {treatment[otherDrugIndex].medicitionsList.map((item, index) =>{
                         return (<span style={item.forbidden === '2' ? {opacity: '0.3', filter:'alpha(opacity=30)'} : ''}>
                         {index === 0 ? '' : ', '}                   

+ 19 - 5
src/components/TreatDesc/index.less

@@ -4,8 +4,8 @@
     overflow: hidden;
 }
 .drug-desc-wrapper {
-    max-height: 650px;
-    overflow-y: scroll;
+  height: 100%;
+  overflow-y: auto
 }
 .drug-desc-title {
     height: 40px;
@@ -13,7 +13,10 @@
     border-bottom: 1px solid #e0e2e4;
     padding-left: 20px;
     width: 260px;
-    position: relative;
+    position: absolute;
+    background: #fff;
+    top: 0px;
+    margin-left: -20px;
 }
 .recommend-title, .drug-title {
     padding: 30px 0 15px 20px;
@@ -29,8 +32,19 @@
     position: absolute;
     right: 0px;
 }
+.similar-drug-box {
+    display: none;
+}
 .similar-drug {
-    padding: 20px;
+    position: absolute;
+    padding-top: 40px;
+    overflow-y: auto;
+    width: 260px;
+    left: 680px;
+    height: 100%;
+    top: 0;
+    background: #fff;
+    padding: 60px 20px 80px;
 }
 
 .drug-name {
@@ -48,4 +62,4 @@
     line-height: 16px;
     border-radius: 4px;
     text-align: center;
-}
+}

+ 2 - 0
src/config/index.js

@@ -19,6 +19,7 @@ export default {
     },
     textId:'text',        //自由文本标签的id,
     textLabel:'{"tagType":"8","id":"","name":""}',
+    _textLabel:'{"tagType":"8","id":"","name":","}',//查体每个标签后面加逗号(1-29)
     tagType:"8",
     tongYId:7,      //主诉通用特征描述id
     addSId:8,      //主诉添加症状id
@@ -37,6 +38,7 @@ export default {
       week:"周",
       month:"月",
       year:"年",
+      age:"岁",
     },
     Params
 };

+ 5 - 2
src/containers/CheckBody.js

@@ -1,13 +1,13 @@
 import {connect} from 'react-redux';
 import CheckBody from '@components/CheckBody';
 import {getModule,getInitData} from '@store/async-actions/fetchModules.js';
-import {HIDE,RESET,SETDROPSHOW} from '@store/types/homePage.js';
+import {HIDE,RESET,SETDROPSHOW,ISREAD} from '@store/types/homePage.js';
 import {SELECTSEARCHDATA} from "@store/types/checkBody";
 import {billing} from '@store/async-actions/pushMessage';
 
 function mapStateToProps(state){ 
   const {homePage,mainSuit,checkBody} = state;
-  const hasMain = mainSuit.saveText.join('')||mainSuit.data.length;
+  const hasMain = mainSuit.saveText.join('');//||mainSuit.data.length;
   return {
     data:checkBody.data,
     update:checkBody.update,   //用于触发更新
@@ -39,6 +39,9 @@ function mapDispatchToProps(dispatch,state){
             span,
             isReplace:false
           })
+          dispatch({
+            type:ISREAD
+          })
         }
       });
     },

+ 1 - 1
src/containers/CurrentIll.js

@@ -12,7 +12,7 @@ import {getModule} from '@store/async-actions/fetchModules.js';
 import {didPushParamChange} from '@utils/tools.js';
 
 
-function mapStateToProps(state) {//console.log(11,state);
+function mapStateToProps(state) {
   const {homePage} = state;
     return {
         data:state.currentIll.data,//主诉模板

+ 2 - 2
src/containers/EditableSpan.js

@@ -213,10 +213,10 @@ function mapDispatchToProps(dispatch,state) {
       if(obj.i==null){return}
       switch (+obj.boxMark){
         case 1:
-          dispatch({type:DEL_MAIN,delIndex:obj.i});
+          dispatch({type:DEL_MAIN,delIndex:obj.i,text:obj.text});
           break;
         case 2:
-          dispatch({type:DEL_CURRENT,delIndex:obj.i});
+          dispatch({type:DEL_CURRENT,delIndex:obj.i,text:obj.text});
           break;
         case 3:
           dispatch({type:DEL_OTHERHIS,delIndex:obj.i});

+ 3 - 0
src/containers/NumberUnitDrop.js

@@ -176,6 +176,9 @@ function mapDispatchToProps(dispatch,store){
           break;
         default:
       }
+      dispatch({
+        type: ISREAD
+      });
     }
   }
 }

+ 6 - 4
src/containers/OtherHistory.js

@@ -2,16 +2,15 @@ import React from 'react';
 import {connect} from 'react-redux';
 import OtherHistory from "../components/OtherHistory";
 import {SETSELECTED,CLEARSELECTED,CONFIRMSELECTED,SELECTOTHERSEARCHDATA,SETDATA,SETTEXTMODEVALUE,OTHEREDICLEAR} from '@types/otherHistory';
-import {HIDE,RESET} from '@store/types/homePage.js';
+import {HIDE,RESET,ISREAD} from '@store/types/homePage.js';
 import {getModule} from '@store/async-actions/fetchModules.js';
 import {billing} from '@store/async-actions/pushMessage';
 import {fullfillText} from '@common/js/func';
 import {didPushParamChange} from '@utils/tools.js';
-import {ISREAD} from "../store/types/homePage";
 
 function mapStateToProps(state){ 
   const {otherHistory,homePage,typeConfig,mainSuit} = state;
-  const hasMain = mainSuit.saveText.join('')||mainSuit.data.length;
+  const hasMain = mainSuit.saveText.join('');//||mainSuit.data.length;
   return {
     data: otherHistory.data,
     //initData:state.homePage.initData.otherHis,
@@ -67,7 +66,10 @@ function mapDispatchToProps(dispatch,store){
             data: res.data.data,
             span,
             isReplace:false
-          })
+          });
+          dispatch({
+            type:ISREAD
+          });
         }
       });
     },

+ 5 - 3
src/containers/SpreadDrop.js

@@ -77,10 +77,12 @@ function currentIll(dispatch,store,params){
   // const ikey = params.ikey.substr(1,1);
   const index = params.ikey;
   let ikey = getLabelIndex(index);
-  let existsId = getIds(exists);
-  let withsId = getIds(withs);
+  // let existsId = getIds(exists);
+  // let withsId = getIds(withs);
+  let existsId = exists && exists.length>0?getIds(exists):[];
+  let withsId = withs && withs.length>0?getIds(withs):[];
   // const ids = existsId.join(",")+withsId.join(",");
-  const ids = (existsId.concat(withsId)).join(",");
+  const ids = (existsId.concat(withsId)).join(",");console.log("点击的下标是:",index,"选中的id是:",ids)
   let has = [],wes=[];
   //获取选中项目模板
   fetchModules(ids).then((res)=>{

+ 6 - 2
src/containers/Treat.js

@@ -1,7 +1,7 @@
 import React from 'react';
 import { connect } from 'react-redux';
 import Treat from '@components/Treat';
-import { SELECT_DRUG, SET_OTHER_DRUG, SET_DRUG_INFO, HIDE_TREAT, CLEAR_TREAT, SHOW_DRUG_INFO, HIDE_DRUG_INFO } from '@store/types/treat.js';
+import { SELECT_DRUG, SET_OTHER_DRUG, SET_DRUG_INFO, CLEAR_DRUG_INFO,HIDE_TREAT, CLEAR_TREAT, SHOW_DRUG_INFO, HIDE_DRUG_INFO } from '@store/types/treat.js';
 import { getInstroduce, getRecommendBasic } from '@store/async-actions/treat';
 import { ADD_SCHEME } from '@store/types/pushMessage.js'
 import { showDrugInfo } from '../store/actions/treat';
@@ -15,7 +15,8 @@ function mapStateToProps(state){
         surgeryTreat: treat.surgeryTreat,
         treatDesc: treat.treatDesc,
         drugInfo: treat.drugInfo,
-        showDrug: treat.showDrugInfo
+        showDrug: treat.showDrugInfo,
+        treatItem: treat.treatItem,
     }
 }
  
@@ -56,6 +57,9 @@ function mapDispatchToProps(dispatch) {
             })
         },
         hideDrugInfo: () =>{
+            dispatch({
+                type: CLEAR_DRUG_INFO
+            })
             dispatch({
                 type: HIDE_DRUG_INFO
             })

+ 0 - 1
src/containers/TreatDrug.js

@@ -4,7 +4,6 @@ import TreatDrug from '@components/TreatDrug';
 // import { ADD_DRUG } from '@stroe/types/treatDrug.js';
 
 function mapStateToProps(state){
-    console.log('state1111',state.treatDrug)
     return {
         treatDrugList: state.treatDrug
     }

+ 4 - 2
src/containers/eleType.js

@@ -35,7 +35,7 @@ export function singleRadio(params){
                         ikey={showInx}
                         hideTag={hideTag}></RadioDrop>;
     case 3:
-      return <EditableSpan {...params} value={data.value||data.name} update={Math.random()}/>;
+      return <EditableSpan {...params} value={data.value||data.value==''?data.value:data.name} update={Math.random()}/>;
     case 5://带单位数字键盘
       return <NumberUnitDrop prefix={data.labelPrefix}
                          suffix={data.labelSuffix}
@@ -122,7 +122,9 @@ export default function(params){
     case 6:
       return multCheckLabels(params,data.tagType);
     case 8:
-      return <EditableSpan {...params} value={data.value||data.name} update={Math.random()}/>;
+      // return <EditableSpan {...params} value={data.value||data.name} update={Math.random()}/>;
+      // 删除后value为空,应展示空而不是name
+      return <EditableSpan {...params} value={data.value||data.value==''?data.value:data.name} update={Math.random()}/>;
     case 11://推送类型
       return multCheckLabels(params,data.tagType);
     default:

+ 1 - 1
src/main.js

@@ -27,7 +27,7 @@ const render = (Component) => {
         }
       })
     })
-  };
+  };          
     ReactDOM.render(
         <AppContainer>
             <Provider store={store}>

+ 20 - 7
src/store/actions/checkBody.js

@@ -5,6 +5,7 @@ export function set(state,action){
   let res = Object.assign({},state);
   const {data} = action;
   res.data = [...data];
+  res.saveText = fullfillText(res.data).saveText;//存逗号
   res.update = Math.random();
   return res;
 }
@@ -30,6 +31,7 @@ export function setNumberValue(state,action){
     });
     res.saveText[labelInx] = hasValue?sub.join(''):'';
   }
+  // res.saveText = fullfillText(res.data).saveText;
   res.update = Math.random();
   return res;
 }
@@ -75,6 +77,7 @@ export function setRadioValue(state,action){console.log(221)
     });
     res.saveText[labelInx] = hasValue?sub.join(''):'';
   }
+  // res.saveText = fullfillText(res.data).saveText;
   res.update = Math.random();
   return res;
 }
@@ -117,6 +120,7 @@ export function setCheckBoxValue(state,action) {
   res.data[labelInx].value = showText;
   res.saveText[labelInx] = showText;
   res.selecteds[labelInx] = action.data;
+  res.saveText = fullfillText(res.data).saveText;
   res.update = Math.random();
   return res;
 }
@@ -139,7 +143,7 @@ export function insertLabelData(state,action){
   const spreadLabels = data;
   const toEnd = showText.indexOf(searchStr)>0;    //替换前或后的搜索词(中间不可搜)
   let reg = toEnd?new RegExp(searchStr+"$"):new RegExp("^"+searchStr);
-  const newText=showText.replace(reg,'')||' ';
+  const newText=showText.replace(reg,'')||'';
   if(!isReplace){
     span.current.innerText = newText;
     const pText = Object.assign({},text,{value:newText});
@@ -162,11 +166,14 @@ export const changeLabelVal = (state,action)=>{//双击标签输入改变值
   const index = action.data.ikey;
   const newVal = action.data.changeVal;     //下拉修改的内容
   const totalVal = action.data.totalVal;    //包含前后缀修改的内容
+  let labText = totalVal?totalVal:newVal;
   let item = res.data[index];
-  if(newVal.trim()){
+  // if(newVal && newVal.trim()){
+  if(labText && labText.trim()){
     if(item){
       item.value = newVal;
-      res.saveText[index] = totalVal;
+      // res.saveText[index] = totalVal;
+      res.saveText[index] = labText;
     }
   }else{//删除完标签内容则删除该标签
     res.data.splice(index,1);
@@ -183,10 +190,16 @@ export const changeNumLabelVal = (state,action)=>{
   const index = action.data.ikey;
   const newVal = action.data.changeVal;
   let item = res.data[index];
-  if(item){
-    item.value = newVal;
-  }
-  res.saveText[index] = newVal;
+  if(newVal.trim()){
+    if(item){
+      item.value = newVal;
+      res.saveText[index] = totalVal;
+    }
+  }else{//删除完标签内容则删除该标签
+    res.data.splice(index,1);
+    res.saveText = fullfillText(res.data).saveText;
+  } 
+  
   res.update = Math.random();
   return res;
 }

+ 27 - 18
src/store/actions/currentIll.js

@@ -38,7 +38,7 @@ export const setModule = (state,action)=>{
 //插入病程变化
 export const insertProcess = (state,action)=>{
   const res = Object.assign({},state);
-  const processModule = res.processModule;
+  const processModule = JSON.parse(JSON.stringify(res.processModule));
   let data = res.data;
   res.data = insertPro(data,processModule);
   res.saveText = fullfillText(res.data).saveText;
@@ -69,9 +69,13 @@ export const setData = (state,action) =>{
   let newMain = [];
   let mainLabelModule = res.mainLabelModule;//主诉选中的症状id获取到的模板
   let objToArr = [];
-  for(let m in mainLabelModule){
-    objToArr.push(mainLabelModule[m]);
+  let keyArr = Object.keys(mainLabelModule); 
+  for(let i=0; i<keyArr.length; i++){
+    objToArr.push(mainLabelModule[JSON.parse(keyArr[i])]);
   }
+  /*for(let m in mainLabelModule){
+    objToArr.push(mainLabelModule[m]);
+  }*/
   // 过滤掉没有mapping的数据
   let mainLabelModuleArr = objToArr;
   /*let mainLabelModuleArr = objToArr.filter((item)=>{
@@ -85,6 +89,7 @@ export const setData = (state,action) =>{
     let tongYong = "";
     let main = [];//主症状
     let withs = [];//伴随
+    let firstT = 0;
     for(let i=0; i<mainData.length; i++){
         if(mainData[i].id==config.tongYId && !mainData[i].pos){//第一个通用特征描述
           if(mainData[i].value){
@@ -98,7 +103,8 @@ export const setData = (state,action) =>{
         // 处理时间和主诉通用症状--现病史模板无“主诉通用症状” 1-7
         for(let j=0; j<current.length; j++){
           if(mainData[i].id==current[j].id && mainData[i].controlType==5){//处理时间,避免手动输入的值
-            if(mainData[i].value){
+            firstT++
+            if(mainData[i].value && firstT==1){
               current[j] = {id:mainData[i].id,name:mainData[i].value,value:mainData[i].value,tagType:config.tagType}
             }
           }  
@@ -205,32 +211,34 @@ function getLabel(lid,lname){
 // 多选展开确定事件--主、伴、无
 export const confirm = (state,action) =>{
   let res = Object.assign({},state);
-  let length1 = res.data.length;
+  let length1 = res.data.length;console.log(123,action);
   let arr = JSON.parse(JSON.stringify(res.data));
   const {nones,exists,withs,ikey,exclusion,excluName,ban,noneIds} = action.data;
-  let existsId = getIds(exists);
-  let withsId = getIds(withs);
+  let existsId = exists && exists.length>0?getIds(exists):[];
+  let withsId = withs && withs.length>0?getIds(withs):[];
   res.symptomIds = res.symptomIds.concat(existsId,withsId,noneIds);//搜索去重
   // 伴 标签
   const banText = JSON.stringify(ban)=='{}'?'':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
-  
+
   // 处理主症状标签及尾巴展开symptomType=1
-  if(exists.length>0){
-    for(let i in exists){
-      arr.splice(ikey,0,getLabel(exists[i].id,exists[i].questionMapping.length==0?exists[i].name+',':exists[i].name),...(exists[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==1;})));
+  if(exists && exists.length>0){
+    // for(let i in exists){//ie8不支持for in循环
+     for(let i=0;i<exists.length; i++){
+      arr.splice(ikey,0,getLabel(exists[i].id,exists[i].questionMapping && exists[i].questionMapping.length==0?exists[i].name+',':exists[i].name),...(exists[i].questionMapping && exists[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==1;})));
     }
   }
 
   let length = arr.length - length1;
   let withsArr = JSON.parse(JSON.stringify(arr));
   // 伴 伴随症状标签及尾巴展开symptomType=2
-  if(withs.length>0){
-    for(let i in withs){
+  if(withs && withs.length>0){
+    // for(let i in withs){
+    for(let i=0;i<withs.length; i++){
       // withsArr.splice(parseInt(ikey)+length,0,banText,getLabel(withs[i].id,withs[i].name),...(withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;})));
-      withsArr.splice(parseInt(ikey)+length,0,getLabel(withs[i].id,withs[i].questionMapping.length==0?(ban.name+withs[i].name+','):(ban.name+withs[i].name)),...(withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;})));
+      withsArr.splice(parseInt(ikey)+length,0,getLabel(withs[i].id,withs[i].questionMapping && withs[i].questionMapping.length==0?(ban.name+withs[i].name+','):(ban.name+withs[i].name)),...(withs[i].questionMapping && withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;})));
     }
   }
-  
+
   // 无 不用展开
   let lengthN = withsArr.length - length1;
   let noneArr = JSON.parse(JSON.stringify(withsArr));  
@@ -245,7 +253,7 @@ export const confirm = (state,action) =>{
   // res.data = resData;
   res.data = fullfillText(resData).newArr;
   res.saveText = fullfillText(resData).saveText;
-  res.update=Math.random(); 
+  res.update=Math.random();
   return res;
 };
 
@@ -535,10 +543,11 @@ export function setInputLabel(state,action){
 // backspace删除
 export function backspaceText(state,action){
   let res = Object.assign({},state);
-  const {delIndex} = action;
+  const {delIndex,text} = action;
   const data = res.data;
   if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
-    // 前一个是文本标签或者子模板 不做处理
+    // 前一个是文本标签或者子模板,只改变值
+    // data[delIndex].value = text;
   }else{
     data.splice(delIndex-1,2);
   }

+ 18 - 6
src/store/actions/homePage.js

@@ -14,9 +14,13 @@ export const showDrop=(state,action)=>{
   const {ikey} = action.data;
   let obj = res.showDrop||{};
   let temp = Object.assign({},obj);
-  for(let i in obj){
+  let keyArr = Object.keys(obj); 
+  for(let i=0; i<keyArr.length; i++){
+    temp[JSON.parse(keyArr[i])] = false;
+  }
+  /*for(let i in obj){
     temp[i] = false;
-  };
+  };*/
   res.showDrop = Object.assign(temp,{[ikey]:action.show!==undefined?action.show:true});
   res.update=Math.random();
 
@@ -28,9 +32,13 @@ export const confirmHide=(state,action)=>{
   let res = Object.assign({},state);
   let obj = res.showDrop||{};
   let temp = Object.assign({},obj);
-  for(let i in obj){
+  let keyArr = Object.keys(obj); 
+  for(let i=0; i<keyArr.length; i++){
+    temp[JSON.parse(keyArr[i])] = false;
+  }
+  /*for(let i in obj){
     temp[i] = false;
-  };
+  };*/
   res.showDrop = temp;
   res.commSymHide = true;
   res.update=Math.random();
@@ -73,9 +81,13 @@ export const setLabelToEdit = (state,action)=>{
   const {ikey} = action.data;
   let obj = res.editState||{};
   let temp = Object.assign({},obj);
-  for(let i in obj){
+  let keyArr = Object.keys(obj); 
+  for(let i=0; i<keyArr.length; i++){
+    temp[JSON.parse(keyArr[i])] = false;
+  }
+  /*for(let i in obj){
     temp[i] = false;
-  };
+  };*/
   res.editState = Object.assign(temp,{[ikey]:action.edit!==undefined?action.edit:true});
   res.update=Math.random();
   return res;

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

@@ -127,12 +127,18 @@ export const confirm = (state,action) =>{
   let arr = res.data;
   let saveText = JSON.parse(JSON.stringify(res.saveText));
   const {exists,withs,ikey,withsName,existsName,ban} = action.data;
-  let existsId = getIds(exists);
-  let withsId = getIds(withs);
+  // let existsId = getIds(exists);
+  // let withsId = getIds(withs);
   let banText = JSON.stringify(ban) == "{}" ? '':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
-  res.mainIds = res.mainIds?res.mainIds.concat(existsId,withsId):[];
+  // res.mainIds = res.mainIds?res.mainIds.concat(existsId,withsId):[];
   let length = exists.length;
   let labelIndx = parseInt(ikey);//当前点击标签的index
+  // 取第一个添加症状的主症状和伴随
+  if(!arr[labelIndx].pos){
+    let existsId = getIds(exists);
+    let withsId = getIds(withs);
+    res.mainIds = res.mainIds?res.mainIds.concat(existsId,withsId):[];
+  }
 
   let text = saveText.slice(0,labelIndx);
   let index = text.indexOf('伴');
@@ -358,16 +364,20 @@ export const changeLabelVal = (state,action)=>{
   const res = Object.assign({},state);
   const index = action.data.ikey;
   const newVal = action.data.changeVal;
-  let item = res.data[index];
+  let data = res.data;
+  let item = data[index];
   if(newVal.trim()){
     if(item){
       item.value = newVal;
       res.saveText[index] = newVal;
     }
   }else{//删除完标签内容则删除该标签
-    res.data.splice(index,1);
-    res.saveText = fullfillText(res.data).saveText;
-  }  
+    
+    data.splice(index,1);
+    // res.data.splice(index,1);
+    // res.saveText = fullfillText(res.data).saveText;
+    res.saveText.splice(index,1);
+  } 
   res.update = Math.random();
   return res;
 }
@@ -378,15 +388,19 @@ export const changeNumLabelVal = (state,action)=>{
   const index = action.data.ikey;
   const newVal = action.data.changeVal;
   let item = res.data[index];
-  if(item){
-    item.value = newVal;
-  }
-  res.saveText[index] = newVal;
-  res.update = Math.random();
+  if(newVal.trim()){
+    if(item){
+      item.value = newVal;
+      res.saveText[index] = newVal;
+    }
+  }else{//删除完标签内容则删除该标签
+    res.data.splice(index,1);
+    res.saveText = fullfillText(res.data).saveText;
+  }  
+  res.update = Math.random();//console.log(44,action,res);
   return res;
 }
 
-
 // 保存自由输入文本--无模板
 export const saveFreeVal = (state,action)=>{
   const res = Object.assign({},state);

+ 16 - 13
src/store/actions/otherHistory.js

@@ -6,7 +6,8 @@ export const confirm = (state,action) =>{
   let res = Object.assign({},state);
   let arr = res.data;
   const {nones,exists,withs,ikey,exclusion,excluName,copyType} = action.data;
-  if((!exists||!withs||[...exists,...withs].length==0)&&!nones&&!exclusion){       //取消无殊的选中,空白提交
+  const items = [...exists||[],...withs||[]];
+  if((!exists||!withs||items.length==0)&&!nones&&!exclusion){       //取消无殊的选中,空白提交
     arr[ikey].value = '';
     res.saveText[ikey] = '';
     res.selecteds.splice(ikey,1);
@@ -26,25 +27,27 @@ export const confirm = (state,action) =>{
     arr.splice(ikey,1);
   }
   if(arr[ikey].value)  arr[ikey].value= '';
-  let newPreText = (arr[ikey-1].value||arr[ikey-1].name||'')+nones;//console.log(arr[ikey-1],newPreText)
-  if([...exists,...withs].length==0&&nones){
+  let preText = arr[ikey-1].value!==undefined?arr[ikey-1].value:arr[ikey-1].name||'';
+  let newPreText =preText +nones;//console.log(arr[ikey-1],newPreText)
+  if(items.length==0&&nones){
     arr[ikey-1].value = newPreText;
     res.saveText[ikey-1] = newPreText;
     res.update=Math.random();
     return res;
   }
-  //有,无,伴随配
-    arr.splice(ikey-1,1);
-    let flabel = [...exists,...withs][0];         //要插入的第一个标签
-    let text = newPreText;
-    //要插入的第一个标签为自由文本,则和前一个文本标签文字合并
+  //有,伴,无随配
+    //arr.splice(ikey-1,1);
+    let flabel = items[items.length-1];         //要插入的最后一个标签
+    let labelText = flabel.value!==undefined?flabel.value:flabel.name;
+    let text = labelText;
+    //要插入的最后一个标签为自由文本,则和后面的文本标签文字合并
     if(flabel.tagType==8){
-      flabel.value = newPreText+(flabel.value||flabel.name);
+      flabel.value = labelText+nones;
       text = flabel.value;
     }
-    arr.splice(ikey-1,0,...exists,...withs);
-    arr[ikey-1].value = text;
-    // res.saveText[ikey-1] = text;
+    arr.splice(ikey,0,...exists,...withs);
+    //arr[ikey-1].value = text;
+    //res.saveText[ikey+items.length] = text;
     res.saveText = fullfillText(arr).saveText;
     res.update=Math.random();         //用于触发组件更新(data变化了因在对象中无法被组件检测到)
     return res;
@@ -210,7 +213,7 @@ export function changeTextLabel(state,action) {
   }else{//删除完标签内容则删除该标签
     res.data.splice(index,1);
     res.saveText = fullfillText(res.data).saveText;
-  } 
+  }
   res.update = Math.random();
   return res;
 }

+ 1 - 1
src/store/actions/pushMessage.js

@@ -190,7 +190,7 @@ export const addBilling = (state, action) => {
 		}
 	}
 	if(res.advice.assay  && res.advice.check !== '') {
-			if(res.advice.assay.substring(res.advice.assay.length-2,res.advice.assay.length-1) !== ', ') {
+			if(res.advice.assay.substring(res.advice.assay.length-2,res.advice.assay.length-1) !== ',') {
 				res.advice.assay = res.advice.assay + ', '
 			} 
 	}

+ 12 - 0
src/store/actions/treat.js

@@ -59,6 +59,12 @@ export const setDrugInfo = (state, action) => {
     return res
 }
 
+export const clearDrugInfo = (state, action) => {
+    const res = JSON.parse(JSON.stringify(state));
+    res.drugInfo.drugDesc = [];
+    return res
+}
+
 export const setRecommendBasic = (state, action) => {
     // const res = Object.assign({}, state)
     const res = JSON.parse(JSON.stringify(state));
@@ -79,3 +85,9 @@ export const hideDrugInfo = (state, action) => {
     return res;
 }
 
+export const setTreatInfo = (state, action) => {
+    const res = Object.assign({}, state);
+    res.treatItem = action.treatItem;
+    return res;
+}
+

+ 11 - 5
src/store/async-actions/diagnosticList.js

@@ -5,11 +5,17 @@ export const isAddMainSuit = () =>{
     return (dispatch, getState) => {
         const state = getState();
         if(state.diagnosticList.diagnosticList.length === 1 && state.diagnosticList.diagnosticList[0].type === 2) {
-            
-            if(state.mainSuit.data && state.mainSuit.data.length === 0 && state.mainSuit.saveText && (state.mainSuit.saveText.length === 0 || state.mainSuit.saveText.length === 1 &&  state.mainSuit.saveText[0] === '')) {
-              dispatch({
-                type:ISREAD
-              });
+            const isAddMainSuitFlag = state.mainSuit.data && state.mainSuit.data.length === 0 && state.mainSuit.saveText    //判断主诉和化验查体是否为空
+                                      && (state.mainSuit.saveText.length === 0 || state.mainSuit.saveText.length === 1 
+                                      &&  state.mainSuit.saveText[0] === '') && state.assistCheck && state.assistCheck.dataString.length === 0
+                                      && state.inspect.labelList && state.inspect.labelList.length === 0 && state.inspect.inspectStrPlus.length === 0
+            console.log('isAddMainSuitFlag', state.mainSuit.data && state.mainSuit.data.length === 0 && state.mainSuit.saveText    //判断主诉和化验查体是否为空
+            && (state.mainSuit.saveText.length === 0 || state.mainSuit.saveText.length === 1 
+            &&  state.mainSuit.saveText[0] === '')&& state.assistCheck && state.assistCheck.dataString.length === 0 && state.inspect.labelList && state.inspect.labelList.length === 0  && state.inspect.inspectStrPlus.length === 0  )                     
+            if(isAddMainSuitFlag) {
+                dispatch({
+                    type:ISREAD
+                });
                 dispatch({
                     type: SET_DIAG_TO_MAINSUIT,
                     data: state.diagnosticList.diagnosticStr

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

@@ -1,6 +1,6 @@
 import {json} from '@utils/ajax.js';
 import {SET} from '@types/checkBody.js';
-import {fullfillText} from '@common/js/func';
+import {fullfillText,_fullfillText} from '@common/js/func';
 import {SETDATA} from '@store/types/otherHistory';
 import store from '@store';
 import {getEMRParams} from '@utils/tools.js';
@@ -103,7 +103,7 @@ export function getInitData(){
       if(+res.data.code === 0){
         const data = res.data.data&&res.data.data.vital;
         const str = JSON.stringify(data);
-        const arr = fullfillText(JSON.parse(str)).newArr;
+        const arr = fullfillText(JSON.parse(str),false,false,false).newArr;
         dispatch({
           type:SET,
           data:[...arr]

+ 7 - 4
src/store/async-actions/treat.js

@@ -1,7 +1,7 @@
 import { json } from "@utils/ajax";
 import { SET_TREAT } from '@store/types/diagnosticList';
 import { ADD_DIAGNOSTIC, GET_DIAGNOSTIC_STR} from '@store/types/diagnosticList';
-import { SET_DRUG_INFO, SET_TREATMENT, SET_RECOMMEND_BASIC } from '@store/types/treat';
+import { SET_DRUG_INFO, SET_TREATMENT, SET_TREAT_INFO, SET_RECOMMEND_BASIC } from '@store/types/treat';
 import {storageLocal,getEMRParams} from '@utils/tools';
 import { isAddMainSuit } from '@store/async-actions/diagnosticList';
 
@@ -76,6 +76,10 @@ export const addDiagnostic = (item) => {
 
 export const getTreatResult = (item) =>{
     return (dispatch, getState) => {
+        dispatch({
+            type: SET_TREAT_INFO,
+            treatItem: item
+        })
         const state = getState();
         let url = api.push;
         if(+state.typeConfig.confirmType===1){
@@ -126,15 +130,14 @@ export const getTreatResult = (item) =>{
                      treat = data.data.data.treat || {}
                 }
                 if(treat) {
-                    return dispatch({
+                   dispatch({
                         type: SET_TREATMENT,
                         treatment: treat.treatment,
                         generalTreat: treat.commonTreatment,
                         surgeryTreat: treat.surgeryTreatment,
                     })
                 }
-                
-            return
+
         }).catch((e) =>{
             console.log(e)
         })

+ 6 - 2
src/store/reducers/treat.js

@@ -1,5 +1,5 @@
-import { SELECT_DRUG, SET_OTHER_DRUG, SET_DRUG_INFO, SHOW_TREAT, HIDE_TREAT, CLEAR_TREAT, SHOW_DRUG_INFO, HIDE_DRUG_INFO, SET_GENERAL_TREAT, SET_TREATMENT, SET_SURGERY_TREAT, SET_RECOMMEND_BASIC } from '../types/treat'
-import { selectDrug, setOtherDrug, setDrugInfo, showTreat, hideTreat, clearTreat, showDrugInfo, hideDrugInfo, setTreatment, setGeneralTreat, setSurgeryTreat, setRecommendBasic } from '../actions/treat'
+import { SELECT_DRUG, SET_TREAT_INFO, SET_OTHER_DRUG, SET_DRUG_INFO, CLEAR_DRUG_INFO,SHOW_TREAT, HIDE_TREAT, CLEAR_TREAT, SHOW_DRUG_INFO, HIDE_DRUG_INFO, SET_GENERAL_TREAT, SET_TREATMENT, SET_SURGERY_TREAT, SET_RECOMMEND_BASIC } from '../types/treat'
+import { selectDrug, setTreatInfo, setOtherDrug, setDrugInfo, clearDrugInfo, showTreat, hideTreat, clearTreat, showDrugInfo, hideDrugInfo, setTreatment, setGeneralTreat, setSurgeryTreat, setRecommendBasic } from '../actions/treat'
 const initState = {
     show: false, //治疗方案显示隐藏
     showDrugInfo: false, //药品信息显示隐藏
@@ -191,6 +191,10 @@ export default function(state=initState, action){
             return showDrugInfo(state, action);
         case HIDE_DRUG_INFO:
             return hideDrugInfo(state, action);
+        case SET_TREAT_INFO:
+            return setTreatInfo(state, action);
+        case CLEAR_DRUG_INFO:
+            return clearDrugInfo(state, action);
         default:
             return state
     }

+ 2 - 0
src/store/types/treat.js

@@ -1,6 +1,7 @@
 export const SELECT_DRUG = 'SELECT_DRUG';   //选则药品
 export const SET_OTHER_DRUG = 'SET_OTHER_DRUG'; //设置其他推荐
 export const SET_DRUG_INFO = 'SET_DRUG_INFO'; //设置药品说明
+export const CLEAR_DRUG_INFO = 'CLEAR_DRUG_INFO'; //清除药品说明
 export const SHOW_TREAT = 'SHOW_TREAT';
 export const HIDE_TREAT = 'HIDE_TREAT';
 export const CLEAR_TREAT = 'CLEAR_TREAT'; //清除治疗方案内容
@@ -10,3 +11,4 @@ export const SET_GENERAL_TREAT = 'SET_GENERAL_TREAT'; //设置一般治疗
 export const SET_SURGERY_TREAT = 'SET_SURGERY_TREAT'; //设置手术治疗
 export const SET_TREATMENT = 'SET_TREATMENT' //设置治疗方案
 export const SET_RECOMMEND_BASIC = 'SET_RECOMMEND_BASIC'//设置其他推荐推荐依据
+export const SET_TREAT_INFO = 'SET_TREAT_INFO' //设置治疗方案信息(name,id等)

+ 20 - 21
src/utils/tools.js

@@ -479,32 +479,31 @@ function filterDataArr(arrTmp){   //数据处理
     let arr = arrTmp.join('').split('');
     for(let i = 0;i < arr.length;i++){
         if(arr[i] && arr[i].indexOf('undefined') == -1){
-            if(tmpArr[tmpArr.length-1] != ',' && tmpArr[tmpArr.length-1] != ',' && tmpArr[tmpArr.length-1] != '、' && tmpArr[tmpArr.length-1] != '。'){
+            if(tmpArr[tmpArr.length-1] != ',' && tmpArr[tmpArr.length-1] != ',' ){
                 tmpArr.push(arr[i])
-            }else {
-              if(tmpArr[tmpArr.length-1] == '。' && arr[i] != ',' && arr[i] != ',' && arr[i] != '、' && arr[i] != '。'){
-                  tmpArr.push(arr[i]);
-              }else if(tmpArr[tmpArr.length-1] != '。'){
-                if(arr[i] == '。'){
-                  tmpArr.pop();
-                  tmpArr.push(arr[i]);
-                }else if(arr[i] != '。' && tmpArr[tmpArr.length-1] == '、'){    //前面逗号后面顿号 [',','、']
-                  if(arr[i] != ',' && arr[i] != ',' && arr[i] != '、'){
-                    tmpArr.push(arr[i]);
-                  }else{
-                    tmpArr.pop();
-                    tmpArr.push(arr[i]);
-                  }
-                }else if(arr[i] != '。' && tmpArr[tmpArr.length-1] != '、'){
-                  if(arr[i] != ',' && arr[i] != ',' && arr[i] != '、'){
-                    tmpArr.push(arr[i]);
-                  }
-                }
+            }else if((tmpArr[tmpArr.length-1] == ',' && (arr[i] != ',' || arr[i] != ',')) || (tmpArr[tmpArr.length-1] == ',' && (arr[i] != ',' || arr[i] != ','))) {
+              if(arr[i] == '。'){     //前面逗号后面句号 [',','。']
+                tmpArr.pop();
+                tmpArr.push(arr[i]);
+              }else if(tmpArr[tmpArr.length-2] == '。' && (tmpArr[tmpArr.length-1] == ',' || tmpArr[tmpArr.length-1] == ',')){//前面句号后面逗号 ['。',',']
+                tmpArr.pop();
+                tmpArr.push(arr[i]);
+              }else if(arr[i] == ',' || arr[i] == ','){    //  中英文逗号交替[',',',']
+                tmpArr.pop();
+                tmpArr.push(arr[i]);
+              }else if(arr[i] == '、'){    //前面逗号后面句号 [',','、']
+                tmpArr.pop();
+                tmpArr.push(arr[i]);
+              }else if(tmpArr[tmpArr.length-2] == '、' && (tmpArr[tmpArr.length-1] == ',' || tmpArr[tmpArr.length-1] == ',')){    //前面逗号后面句号 ['、',',']
+                tmpArr.splice(tmpArr.length-2,1);
+                tmpArr.push(arr[i]);
+              }else{
+                tmpArr.push(arr[i]);
               }
             }
         }
     }
-    return (tmpArr.join('')).replace(/^,+/,"").replace(/,+$/,"").replace(/,+$/,"").replace(/,+$/,"").replace(/、+$/,"");
+    return (tmpArr.join('')).replace(/^,+/,"").replace(/,+$/,"").replace(/,+$/,"").replace(/,+$/,"");
 }
 // 取消默认行为
 function preventDefault(event) {