Przeglądaj źródła

Merge branch 'dev/new1' into dev/byll

Luolei 6 lat temu
rodzic
commit
b0fe21c2b2
40 zmienionych plików z 423 dodań i 163 usunięć
  1. 1 0
      src/common/components/EditableSpan/index.jsx
  2. 2 6
      src/common/components/ItemBox/index.jsx
  3. 1 1
      src/common/components/NumberPan/index.jsx
  4. 11 4
      src/common/components/Textarea/index.jsx
  5. 7 2
      src/components/Advice/Textarea/index.jsx
  6. 3 3
      src/components/Advice/index.jsx
  7. 6 6
      src/components/DiagnosticItem/index.jsx
  8. 1 1
      src/components/DiagnosticList/index.jsx
  9. 9 10
      src/components/MainSuit/index.jsx
  10. 30 1
      src/components/MultSpread/index.jsx
  11. 5 4
      src/components/Multiple/index.jsx
  12. 5 0
      src/components/Multiple/index.less
  13. 68 20
      src/components/NumberDrop/index.jsx
  14. 35 18
      src/components/NumberUnitDrop/index.jsx
  15. 4 4
      src/components/RadioInpDrop/index.jsx
  16. 28 11
      src/components/SearchDrop/index.jsx
  17. BIN
      src/components/TreatDesc/img/info2.png
  18. BIN
      src/components/TreatDesc/img/info3.png
  19. 42 8
      src/components/TreatDesc/index.jsx
  20. 4 1
      src/components/TreatDesc/index.less
  21. 2 2
      src/config/index.js
  22. 1 0
      src/containers/AdviceContainer.js
  23. 1 0
      src/containers/MainSuit.js
  24. 1 1
      src/containers/Multiple.js
  25. 24 8
      src/containers/NumberUnitDrop.js
  26. 1 0
      src/containers/OtherHistory.js
  27. 3 4
      src/containers/RadioInpDrop.js
  28. 5 1
      src/containers/eleType.js
  29. 45 6
      src/store/actions/checkBody.js
  30. 6 4
      src/store/actions/currentIll.js
  31. 19 21
      src/store/actions/mainSuit.js
  32. 13 1
      src/store/actions/otherHistory.js
  33. 3 3
      src/store/actions/patInfo.js
  34. 7 1
      src/store/async-actions/fetchModules.js
  35. 8 1
      src/store/async-actions/homePage.js
  36. 2 1
      src/store/async-actions/mainSuit.js
  37. 1 0
      src/store/reducers/homePage.js
  38. 7 0
      src/store/reducers/otherHistory.js
  39. 2 1
      src/utils/tools.js
  40. 10 8
      static/pages/hisLib/diag_push.js

+ 1 - 0
src/common/components/EditableSpan/index.jsx

@@ -185,6 +185,7 @@ class EditableSpan extends Component{
         obj.focus();
       }
     }
+    // 注释掉,放开会影响删除
     // ele = document.activeElement;
     // boxTop = target.innerText?getPageCoordinate(e).boxTop:$(ele).offset().top+30;
     // setSearchLocation(boxTop,ele.offsetLeft)     //搜索框的位置动态获取

+ 2 - 6
src/common/components/ItemBox/index.jsx

@@ -38,13 +38,9 @@ class ItemBox extends Component {
     }
   }
 
-  /*componentWillReceiveProps(next){
-    if(this.props.value && next.value!=this.props.value){
-      this.$div.current.innerText?(this.$div.current.innerText = next.value||''):(this.$div.current.innerHTML = next.value||'');
-    }
-  }*/
-
   componentDidMount(){
+    const {setRef} = this.props;
+    setRef&&setRef(this.$div);
     if(isIE()){
       $(this.$div.current).onIe8Input(function(e){
         this.handleInput(e)

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

@@ -55,7 +55,7 @@ class NumberPan extends Component{
       display:show?'table':'none'        //table onBlur阻止冒泡是为了修复multSpread中数字键盘点击触发最外层数字组件onBlur事件
     }
   }
-  render(){  
+  render(){
     const select = this.handleSelect.bind(this); 
     const domNode = document.getElementById('root');
     return ReactDom.createPortal(

+ 11 - 4
src/common/components/Textarea/index.jsx

@@ -17,7 +17,7 @@ class Textarea extends Component {
     this.$dom = React.createRef();
     this.handleInput = this.handleInput.bind(this);
     this.handleFocus = this.handleFocus.bind(this);
-    //this.handleBlur = this.handleBlur.bind(this);
+    this.handleBlur = this.handleBlur.bind(this);
   }
   handleFocus(){            //初始显示props中的值,focus已经显示输入的值,避免值更新闪烁
     const {handleFocus,fuzhen,handleInput} = this.props;
@@ -58,7 +58,7 @@ class Textarea extends Component {
     })
 
     //存值到store
-    handleInput&&handleInput({text});
+    // handleInput&&handleInput({text});
     //右侧推送--延时推送
     clearTimeout(stimer);
     let timer = setTimeout(function(){
@@ -84,7 +84,7 @@ class Textarea extends Component {
   componentDidMount(){
     const {value} = this.props;
     if(value){
-      this.$dom.current.innerText?(this.$dom.current.innerText = value||''):(this.$dom.current.innerText=value||'');
+      this.$dom.current.innerText?(this.$dom.current.innerText = value||''):(this.$dom.current.innerHTML=value||'');
     }
     if(isIE()){
       $(this.$dom.current).onIe8Input(function(e){
@@ -92,6 +92,12 @@ class Textarea extends Component {
       },this);
     }
   }
+  handleBlur(){
+    const {handleInput} = this.props;
+    const text = this.$dom.current.innerText||this.$dom.current.innerHTML;
+    //存值到store
+    handleInput&&handleInput({text});
+  }
   render() {
     const { title } = this.props;
     return (
@@ -102,7 +108,8 @@ class Textarea extends Component {
              onFocus={this.handleFocus}
              ref={this.$dom}
              contentEditable={true}
-             onInput={this.handleInput}>
+             onInput={this.handleInput}
+             onBlur={this.handleBlur}>
         </div>
       </div>
     );

+ 7 - 2
src/components/Advice/Textarea/index.jsx

@@ -31,8 +31,12 @@ class Textarea extends Component {
   }
   componentWillReceiveProps(next){
     const isRead = this.props.isRead;
-    if(next.isRead != isRead && next.value!=this.props.value){      //value对比解决复诊不显示bug
-      next.value ? this.$dom.current.innerText = next.value :  ''
+    // if(next.isRead != isRead && next.value!=this.props.value){      //value对比解决复诊不显示bug
+    //   next.value ? this.$dom.current.innerText = next.value :  this.$dom.current.innerText = next.value 
+    //   // this.$dom.current.innerText?(this.$dom.current.innerText = next.value||''):(this.$dom.current.innerHTML = next.value||'');
+    // }
+    if(next.isRead != isRead && next.value || next.isRead != isRead && next.value!=this.props.value){      //value对比解决复诊不显示bug
+      next.value ? this.$dom.current.innerText = next.value :  this.$dom.current.innerText = '' 
       // this.$dom.current.innerText?(this.$dom.current.innerText = next.value||''):(this.$dom.current.innerHTML = next.value||'');
     }
   }
@@ -40,6 +44,7 @@ class Textarea extends Component {
     const {value} = this.props;
     if(value && value.trim()){
       this.$dom.current.innerText = value
+      // this.$dom.current.focus()
       // this.$dom.current.innerText ? (this.$dom.current.innerText = value) : (this.$dom.current.innerHTML = value)
     //   this.$dom.current.nextSibling.innerText?(this.$dom.current.nextSibling.innerText = ''):(this.$dom.current.nextSibling.innerHTML = '')
     }

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

@@ -60,7 +60,6 @@ class Advice extends Component{
   componentDidMount(){
   //   this.$dom.current.nextSibling.innerText?(this.$dom.current.nextSibling.innerText = ''):(this.$dom.current.nextSibling.innerHTML = '')
   // const {advice} = this.props.pushMessage.advice
-  // console.log('adviceInput', this.props.pushMessage)
   
 }
 
@@ -101,8 +100,9 @@ class Advice extends Component{
           {scheme}
         </div>}
         <div className={style['billing']} > 
-            {!advice.adviceInput && <Textarea value='' isRead={isRead} handleChangeAssistValue={this.handleAdviceInput} ></Textarea>}
-            {advice.adviceInput && <Textarea value={advice.adviceInput} isRead={isRead} handleChangeAssistValue={this.handleAdviceInput} ></Textarea>}
+            {/* {!advice.adviceInput && <Textarea value='' isRead={isRead} handleChangeAssistValue={this.handleAdviceInput} ></Textarea>}
+            {advice.adviceInput && <Textarea value={advice.adviceInput} isRead={isRead} handleChangeAssistValue={this.handleAdviceInput} ></Textarea>} */}
+            <Textarea value={advice.adviceInput} isRead={isRead} handleChangeAssistValue={this.handleAdviceInput} ></Textarea>
         </div>
       </ItemBox>
     </div>

+ 6 - 6
src/components/DiagnosticItem/index.jsx

@@ -54,12 +54,12 @@ class DiagnosticItem extends Component{
         //         visible: false,
         //     },()=>{
                 const { diagnosticList, addDiagnostic, clearInput, hideSearch } = this.props;
-                for (let i = 0; i < diagnosticList.length; i++) {
-                    if(diagnosticList[i].id === item.id && diagnosticList[i].name === item.name) {
-                        Notify.info('该诊断已存在');
-                        return
-                    }
-                }
+                // for (let i = 0; i < diagnosticList.length; i++) {
+                //     if(diagnosticList[i].id === item.id && diagnosticList[i].name === item.name) {
+                //         Notify.info('该诊断已存在');
+                //         return
+                //     }
+                // }
                 addDiagnostic&&addDiagnostic(item);
                 clearInput&&clearInput();
                 hideSearch&&hideSearch()

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

@@ -84,7 +84,7 @@ class DiagnosticList extends Component {
         return(
                 <div className={style['diaglist-wrap']}>
                     {list && (list.length > 0) && list.map((item, index) => {
-                        const hasTreat = item.treat && (item.treat.commonTreatment || item.treat.surgeryTreatment || item.treat.treatment.length>0)
+                        const hasTreat = item.treat && (item.treat.commonTreatment.content || item.treat.surgeryTreatment.content || item.treat.treatment.length>0)
                         return (<div draggable={true} className={style['diag-box'] + ' clearfix'}  key={item.id} >
                                     {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
                                     {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}

+ 9 - 10
src/components/MainSuit/index.jsx

@@ -233,32 +233,29 @@ class MainSuit extends Component{
   handleBlur(e){//隐藏常见症状下拉、存自由输入的值
     const {freeText,saveText,datas,clearSearch,getSymptomFeature,currentData} = this.props;
     const that = this;
-    const ev = e || window.event;
     let data = this.state.inpText;
     if(!isIE()){
       if(currentData&&currentData.length==0){//现病史没有模板的时候才去获取
-        getSymptomFeature && getSymptomFeature(ev.target.innerText);
+        getSymptomFeature && getSymptomFeature(e.target.innerText);
       } 
-      ev.target.innerText?(ev.target.innerText=""):(ev.target.innerHTML="")
+      e.target.innerText?(e.target.innerText=""):(e.target.innerHTML="")
       freeText && freeText(data.trim());
     }else{
       if(datas.length==0){
+        const ev = e || window.event;
         const data = ev.target.innerText;
         // freeText && freeText(data.trim());
         freeText && freeText(data);
       }
     }
     // 延时关闭常见症状下拉、清空搜索结果,不延时会影响选中
-      // clearTimeout(this.state.clearTimer);
       const clearTimer = setTimeout(function(){
         clearSearch && clearSearch();
+        clearTimeout(clearTimer);
         // that.setState({
         //   symptom:false
         // })
-      },config.delayTime-200);
-      // this.setState({
-      //   clearTimer
-      // });  
+      },config.delayTime-200); 
   }
 
 
@@ -267,11 +264,13 @@ class MainSuit extends Component{
     const {showModule,show,symptom,search} = this.state;
     const symptomFlag = CommonSymptoms.length>0 ? true : false;
     const searchFlag = searchData.length>0 ? true : false;
+    const boxTop1 = datas.length>0?boxTop:45;
+    const boxLeft1 = datas.length>0?boxLeft:85;
     if(+type===1){      //文本模式
       return <Textarea title='主诉' boxMark='1' isRead={isRead} value={saveText[0]} handlePush={fetchPushInfos} handleInput={handleInput} />;
     }
     return  <div className={`${'mainsuit-box'} ${style['main-suit']}`} id="mainsuitBox">
-      <ItemBox 
+      <ItemBox
       fuzhen={fuzhen} 
       title='主诉' 
       editable={editClear||datas.length==0?true:false} 
@@ -285,7 +284,7 @@ class MainSuit extends Component{
         {datas.length>0?<div style={{display:'inline-block'}}>{this.getInlineTag()}</div>:(saveText[0]?saveText[0]:'')}
       </ItemBox>
       {/*没有推送结果就不显示*/}
-      {symptomFlag && !searchFlag ? <CommonSymptom data={CommonSymptoms} show={!totalHide&&symptom} onSelect={this.handleSelect} /> : ( searchFlag ? <SearchDrop data={searchData} show={!commSymHide} onSelect={this.handleSearchSelect} left={boxLeft} top={boxTop} />:"")}
+      {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}/>:"")}
     </div>
   }
 }

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

@@ -2,7 +2,9 @@ import React,{Component} from 'react';
 import classNames from 'classnames';
 import RadioDrop from "@containers/RadioDrop";
 import NumberDrop from "@containers/NumberDrop";
+import RadioInpDrop from "@containers/RadioInpDrop";
 import InlineTag from '@containers/InlineTag';
+import Multiple from '@containers/Multiple';
 import addIcon from '@images/addItem.png';
 import style from "./index.less";
 import tools from '@utils/tools';
@@ -39,7 +41,7 @@ class MultSpread extends Component{
     return classNames(isSelected,hasAdd);
   }
   getLabels(){
-    const {data,ikey,showArr,copyId} = this.props;
+    const {data,ikey,showArr,copyId,selecteds,boxMark} = this.props;
     const {editable}= this.state;
     let show = false;
     let inx = '';
@@ -61,6 +63,21 @@ class MultSpread extends Component{
                             id={it.id}
                             patId = {copyId}
                             hideTag={true}></RadioDrop>;
+        case +it.controlType===2:
+          const dataList = it.questionDetailList&&it.questionDetailList.length>0?it.questionDetailList:it.questionMapping;
+          return <Multiple data={dataList}
+                           ikey={inx}
+                           placeholder={it.name}
+                           value={it.value}
+                           copyType={it.copyType}
+                           selecteds={selecteds ?selecteds[i]:[]}
+                           show={showArr&&showArr[inx]}
+                           order={it.textGenerate}
+                           type={boxMark}
+                           textPrefix={it.labelPrefix}
+                           textSuffix={it.labelSuffix}
+                           id={it.id}
+                           hideTag={true}></Multiple>;
         case +it.controlType===5://带单位数字键盘
         return <NumberUnitDrop prefix={it.labelPrefix}
                                suffix={it.labelSuffix}
@@ -83,6 +100,8 @@ class MultSpread extends Component{
           return <NumberDrop prefix={it.labelPrefix}
                              suffix={it.labelSuffix}
                              placeholder={it.name}
+                             min={it.minValue}
+                             max={it.maxValue}
                              show={show}
                              allClick={false}
                              ikey={inx}
@@ -90,6 +109,16 @@ class MultSpread extends Component{
                              patId = {copyId}
                              value={it.value}
                              hideTag={true}></NumberDrop>;
+        case +it.controlType===11:
+          return <RadioInpDrop data={it.questionDetailList}
+                             vals={it.vals}
+                             placeholder={it.name}
+                             show={showArr&&showArr[inx]}
+                             value = {it.value}
+                             boxMark={boxMark}
+                             id={it.id}
+                             ikey={inx}
+                             hideTag={true}></RadioInpDrop>;
         default:
           return it.name;
       }

+ 5 - 4
src/components/Multiple/index.jsx

@@ -40,15 +40,16 @@ class Multiple extends react.Component{
   }
 
   getClass(){
-    if(this.props.show){
+    const {show,value,hideTag} = this.props;
+    if(show){
       $(this.$div.current).addClass(style['borderd']);
     }else{
       $(this.$div.current).removeClass(style['borderd']);
     }
-    if(this.props.value){
-      return style['selected-tag'];
+    if(value){
+      return hideTag?style['hide-tag']:style['selected-tag'];
     }
-    return style['tag'];
+    return hideTag?'':style['tag'];
   }
 
   getListClass(){

+ 5 - 0
src/components/Multiple/index.less

@@ -16,6 +16,11 @@
   border-bottom: 1px @border-color solid;
   line-height: 22px;
 }
+.hide-tag{
+  padding: 0;
+  color: @text-color;
+  line-height: 22px;
+}
 .list{
   .pop;
   padding: 0 0 10px;

+ 68 - 20
src/components/NumberDrop/index.jsx

@@ -1,6 +1,6 @@
 import React,{Component} from 'react';
 import className from 'classnames';
-import {NumberPan} from '@commonComp';
+import {NumberPan,Notify} from '@commonComp';
 import style from './index.less';
 import $ from "jquery";
 import {handleEnter,getPageCoordinate} from '@utils/tools.js';
@@ -20,6 +20,7 @@ class NumberDrop extends Component{
     this.state={
       editable:false,      //标签是否可输入
       timer:null,
+      sltTimer:null,
       hasSelect:false,       //是否点过下拉键盘
       boxLeft:0,
       boxTop:0,
@@ -39,13 +40,49 @@ class NumberDrop extends Component{
     this.handleBlur = this.handleBlur.bind(this);
     this.changeToEdit = this.changeToEdit.bind(this);
     this.handleKeyDowm = this.handleKeyDowm.bind(this);
+    this.beyondArea = this.beyondArea.bind(this);
   }
   select(text){        //选中键盘上数字事件
+    let timer = null;
+    clearTimeout(this.state.sltTimer);
+    const {handleSelect,ikey,suffix,prefix,mainSaveText,min,max} = this.props;
+    const needCompare=min!=undefined&&max!=undefined;
+    if(!text){
+      this.setState({
+        placeholder:this.props.placeholder
+      });
+    }else{
+      //console.log(text,isNaN(+text),max<+text)
+      if(needCompare){
+        if(!isNaN(+text)&&max<+text){     //数值过大
+          this.beyondArea();
+          return;
+        }
+        const that = this;
+        timer = setTimeout(function(){
+          clearTimeout(that.state.sltTimer);
+          if(!that.props.show&&!isNaN(+text)&&min>+text){
+            that.beyondArea();
+            return;
+          }
+        },1500);
+      }
+      this.setState({
+        hasSelect:true,
+        sltTimer:timer
+      });
+    }
+
+    handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
+  }
+  beyondArea(){
     const {handleSelect,ikey,suffix,prefix,mainSaveText} = this.props;
+    Notify.info("数值在正常值范围内,请重新输入");
+    handleSelect&&handleSelect({ikey,text:'',suffix,prefix,mainSaveText});
     this.setState({
-      hasSelect:true
+      placeholder:this.props.placeholder,
+      hasSelect:false
     });
-    handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
   }
   handleNumFocus(e){       //数字框可编辑状态下聚集事件,处理是否显示下拉等
     const {placeholder} = this.state;
@@ -73,6 +110,10 @@ class NumberDrop extends Component{
       //双击时不显示下拉
       clearTimeout(that.state.timer);
       const timer = setTimeout(function(){
+        //只有弹窗关闭则点击数字键盘会清空当前数据
+        that.setState({
+          hasSelect:false
+        });
         handleShow&&handleShow({ikey,id:patId||id});
       },300);
       this.setState({
@@ -93,31 +134,37 @@ class NumberDrop extends Component{
   }
   numInpBlur(e){        //数字框失焦,保存值到store中
     e.stopPropagation();
-    const that = this;
-    setTimeout(function(){      //第一次选中数字时placeholder闪一下优化
-      if(!that.state.hasSelect&&!e.target.innerText.trim()){
-        that.setState({
-          placeholder:that.props.placeholder
-        });
-      }
-    },100);
-
-    if(this.props.show){      //修改清空后第一次点击键盘不触发click事件bug
+    const {handleSelect,ikey,suffix,prefix,mainSaveText,min,max,show} = this.props;
+    if(show){      //修改清空后第一次点击键盘不触发click事件bug
       return;
     }
-    this.setState({
+    const txt = e.target.innerText.replace(/^\s*/,'');
+    if(max!=undefined&&!isNaN(+txt)&&(min>+txt||max<+txt)){
+      this.beyondArea();
+      return;
+    }
+    //输入为空时显示placeholder
+    if(!e.target.innerText.trim()){
+      this.setState({
+        placeholder:this.props.placeholder
+      });
+    }
+
+    /*this.setState({
       hasSelect:false
-    });
+    });*/
     const val = e.target.innerText.replace(/^\s*/,'');
-    const {handleSelect,ikey,suffix,prefix,mainSaveText} = this.props;
     const {placeholder} = this.state;
-    const text = val===placeholder?'':val;
+    let text = val===placeholder?'':val.replace(/[\u4e00-\u9fa5]/g,'');
     e.target.innerText = '';      //避免出现重复输入值
     handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
   }
   handleSpanInp(e){   //数字框输入事件
     e.stopPropagation();
     const {handleHide} = this.props;
+    /*this.setState({     //再键盘点击数字要清空
+      hasSelect:false
+    });*/
     handleHide&&handleHide();
   }
   handleKeyDowm(e){
@@ -126,14 +173,15 @@ class NumberDrop extends Component{
     const key = e.key;
     const ctrlOn = e.ctrlKey;
     const isCopyPaste = ctrlOn&&(key=='v'||key=='c');
-    if(!/[0-9|.|~|\/]/.test(key)&&key.length==1&&!isCopyPaste){
+    if((!/[0-9|.|~|\/]/.test(key)&&key.length==1&&!isCopyPaste)){
       e.preventDefault();
       return false;
     }
   }
   getClasses(){         //整个标签是否有值的状态
     const {hideTag,placeholder,value} = this.props;
-    const val = this.$span.current&&this.$span.current.innerText.trim()||value;
+    const $span = this.$span.current;
+    const val = value;//$span&&$span.innerText.trim()||value;
     const blueBorder = this.state.editable?style['blue-border']:'';
     const isSelected = val&&val!=placeholder?style['selected']:style['container'];
     const noTag = hideTag?style['no-tag']:'';
@@ -194,7 +242,7 @@ class NumberDrop extends Component{
       <span onFocus={this.handleNumFocus}
             onClick={allClick?null:this.handleNumClick}
             contentEditable={true}
-            style={{minWidth:'10px',display:'inline-block'}}
+            style={{minWidth:'10px',display:'inline-block',textAlign:'center'}}
             ref = {this.$span}
             onBlur={this.numInpBlur}
             onInput={this.handleSpanInp}

+ 35 - 18
src/components/NumberUnitDrop/index.jsx

@@ -33,6 +33,8 @@ class NumberUnitDrop extends Component{
       tmpScroll:0
     };
     this.$span = React.createRef();
+    this.$pre = React.createRef();
+    this.$suf = React.createRef();
     this.$cont = React.createRef();
     this.select = this.select.bind(this);
     this.numInpBlur = this.numInpBlur.bind(this);
@@ -41,7 +43,7 @@ class NumberUnitDrop extends Component{
     this.changeToEdit = this.changeToEdit.bind(this);
   }
   select(obj){         //选中键盘上数字事件
-    const {handleSelect,ikey,suffix,prefix,mainSaveText} = this.props;
+    const {handleSelect,ikey,suffix,prefix,mainSaveText,formulaCode,mainData} = this.props;
     this.setState({
       hasSelect:true
     });
@@ -50,7 +52,7 @@ class NumberUnitDrop extends Component{
         value:''
       });
     }
-    handleSelect&&handleSelect({ikey,text:obj.text,suffix,prefix,mainSaveText,mark:obj.mark});
+    handleSelect&&handleSelect({ikey,text:obj.text,suffix,prefix,mainSaveText,mark:obj.mark,formulaCode,mainData});
   }
   
   handleNumClick(e){ 
@@ -85,13 +87,20 @@ class NumberUnitDrop extends Component{
   //数字框失焦,保存值到store中
   numInpBlur(e){
     e.stopPropagation();
-    const {handleSelect,ikey,suffix,prefix,mainSaveText,handleLabelChange,boxMark} = this.props;
+    // const {handleSelect,ikey,suffix,prefix,mainSaveText,handleLabelChange,boxMark,formulaCode} = this.props;
+    const {handleSelect,ikey,mainSaveText,handleLabelChange,boxMark,formulaCode} = this.props;
     const {editable} = this.state;
     if(editable){
-      const text = e.target.innerText || e.target.innerHTML;
+      // const text = e.target.innerText || e.target.innerHTML;
       // this.$span.current.innerText='';      //修改生成文字变成输入的2倍bug 
+      let totalVal = e.target.innerText|| e.target.innerHTML;
+      let changeVal = this.$span.current.innerText.replace(/^\s*/,'');//数字框值-修改后;去掉前空格避免多空格叠加
+      let prefix = this.$pre.current.innerText.replace(/^\s*/,''); //前缀值-修改后
+      let suffix = this.$suf.current.innerText.replace(/^\s*/,''); //后缀值-修改后
+      // console.log('数字框:'+changeVal,";全部:"+totalVal,";前缀:"+prefix+";后缀:"+suffix);
+      handleLabelChange && handleLabelChange({ikey,changeVal,type:boxMark,totalVal,prefix,suffix,formulaCode});
       // handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
-      handleLabelChange&&handleLabelChange({ikey,changeVal:text,suffix,prefix,mainSaveText,type:boxMark});
+      // handleLabelChange&&handleLabelChange({ikey,changeVal:text,suffix,prefix,mainSaveText,type:boxMark,formulaCode});
       
     }
     this.setState({
@@ -143,9 +152,13 @@ class NumberUnitDrop extends Component{
   }
   changeToEdit(e){        //整个标签双击编辑状态
     e.stopPropagation();
-    const {value,id,handleDbclick,patId} = this.props;
+    const {value,id,handleDbclick,patId,handleHide,show} = this.props;
     const text = e.target.innerText || e.target.innerHTML;
-    // clearTimeout(this.state.timer);//取消延时的单击事件
+    clearTimeout(this.state.timer);//取消延时的单击事件
+    e.preventDefault();
+    if(show){
+      handleHide&&handleHide();
+    }
     if(value&&value.trim()) {//有选中值的标签才能双击编辑
       this.setState({
         editable: true,
@@ -153,7 +166,8 @@ class NumberUnitDrop extends Component{
       });
       //失焦关闭编辑状态
       setTimeout(()=>{
-        e.target.focus();
+        // e.target.focus();
+        this.$cont.current.focus();
       })
       //双击埋点记录
       handleDbclick && handleDbclick({id:patId||id});
@@ -161,7 +175,8 @@ class NumberUnitDrop extends Component{
   }
   componentDidMount(){
     if(isIE()){
-      $(this.$span.current).onIe8Input(function(e){
+      // $(this.$span.current).onIe8Input(function(e){
+      $(this.$cont.current).onIe8Input(function(e){
         this.handleSpanInp(e)
       },this);
     }
@@ -170,17 +185,19 @@ class NumberUnitDrop extends Component{
   render(){
     const {placeholder,prefix,suffix,show,value,handleHide} = this.props;
     const {numEditable,editable,hasSelect,placeholderFlag,boxLeft,boxTop} = this.state;
-    return <div className={this.getClasses()} ref={this.$cont}>
-      <span>{prefix}</span>
-      <span onClick={this.handleNumClick}
-            contentEditable={editable}
-            ref = {this.$span}
-            onBlur={this.numInpBlur}
-            onInput={this.handleSpanInp}
-            onDoubleClick={this.changeToEdit}
+    return <div className={this.getClasses()}
+                ref={this.$cont}
+                onClick={this.handleNumClick}
+                contentEditable={editable}
+                onBlur={this.numInpBlur}
+                onDoubleClick={this.changeToEdit}
+                onkeydown={handleEnter}
+                onInput={this.handleSpanInp}>
+      <span ref = {this.$pre}>{prefix?prefix+' ':prefix}</span>
+      <span ref = {this.$span}
             onkeydown={handleEnter}
             style={{cursor:editable?'text':'pointer'}}>{value||placeholder}</span>
-      <span>{suffix}</span>
+      <span ref = {this.$suf}>{suffix?' '+suffix:suffix}</span>
       <NumberUnitPan handleSelect={(obj)=>this.select(obj)}
                  onClose={handleHide}
                  top={boxTop}

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

@@ -55,7 +55,7 @@ class RadioInpDrop extends Component{
     return style['tag'];
   }
   handleSelect(item){
-    const {handleSelect,ikey,mainSaveText,value,placeholder} = this.props;
+    const {handleSelect,ikey,value,placeholder} = this.props;
     let vals = {}, inx = 0;
     if(!item){
       handleSelect&&handleSelect({ikey});  //清空
@@ -75,7 +75,7 @@ class RadioInpDrop extends Component{
     this.setState({
       texts:vals
     });
-    handleSelect&&handleSelect({ikey,id:item.id,values:vals,mainSaveText});
+    handleSelect&&handleSelect({ikey,id:item.id,values:vals});
   }
   handleShow(e){
     //e.stopPropagation();
@@ -182,7 +182,7 @@ class RadioInpDrop extends Component{
     return list;
   }
   render(){
-    const {data,show} = this.props;
+    const {data,show,vals,placeholder} = this.props;
     const {boxLeft,boxTop} = this.state;
     return <div className={style['container']} ref = {this.$cont}>
       <div className={this.getClass()}
@@ -191,7 +191,7 @@ class RadioInpDrop extends Component{
            onDoubleClick={this.handledbClick}
            onClick={(e)=>this.handleShow(e,true)}
            onkeydown={handleEnter}>
-        {this.parseInputDom()}
+        {vals?this.parseInputDom():<span>{placeholder}</span>}
       </div>
       <DropList onSelect={this.handleSelect} data={data} left={boxLeft} top={boxTop} show={show}/>
     </div>

+ 28 - 11
src/components/SearchDrop/index.jsx

@@ -21,6 +21,9 @@ class SearchDrop extends Component{
   constructor(props){
     super(props);
     this.handleSelect = this.handleSelect.bind(this);
+    this.state={
+      data:props.data||[]
+    }
   }
   getClass(){
     let name = style['text-list'];
@@ -54,18 +57,32 @@ class SearchDrop extends Component{
     // onShow&&onShow(e,false);
   }
   render(){
+    const {mainEmpty} = this.props;
     let litext = '';
-    const domNode = document.getElementById('root');
-    return ReactDom.createPortal(
-      <div className={this.getClass()} contenteditable="false" id="searchBox" style={this.getStyle()}>
-        <ul>
-          {this.props.data&&this.props.data.map((it)=>{
-            litext = it.showType==1?it.name:it.name+'('+it.retrievalName+')';
-            return <li onClick={(e)=>this.handleSelect(e,it)} title={litext}>{litext}</li>
-          })}
-        </ul>
-      </div>
-    ,domNode)
+    if(mainEmpty){
+      return <div className={this.getClass()} contenteditable="false" id="searchBox" style={this.getStyle()}>
+          <ul>
+            {this.props.data&&this.props.data.map((it)=>{
+              litext = it.showType==1?it.name:it.name+'('+it.retrievalName+')';
+              return <li onClick={(e)=>this.handleSelect(e,it)} title={litext}>{litext}</li>
+            })}
+          </ul>
+        </div>
+    }else{
+      
+      const domNode = document.getElementById('root');
+      return ReactDom.createPortal(
+        <div className={this.getClass()} contenteditable="false" id="searchBox" style={this.getStyle()}>
+          <ul>
+            {this.props.data&&this.props.data.map((it)=>{
+              litext = it.showType==1?it.name:it.name+'('+it.retrievalName+')';
+              return <li onClick={(e)=>this.handleSelect(e,it)} title={litext}>{litext}</li>
+            })}
+          </ul>
+        </div>
+      ,domNode)
+    }
+    
   }
 }
 

BIN
src/components/TreatDesc/img/info2.png


BIN
src/components/TreatDesc/img/info3.png


+ 42 - 8
src/components/TreatDesc/index.jsx

@@ -4,29 +4,53 @@ import $ from "jquery";
 import close from './img/close.png';
 import info from './img/info.png';
 import info1 from './img/info1.png';
+import info2 from './img/info2.png';
+import info3 from './img/info3.png';
 
 
 class TreatDesc extends Component {
     constructor(props){
         super(props);
         this.state = {
-            currentIndex: -1
+            currentIndex: -1,
+            hasEnterImg: false
         }
         this.hideTreatDesc = this.hideTreatDesc.bind(this);
         this.handleSelect= this.handleSelect.bind(this);
+        this.handleMouseEnterDrug = this.handleMouseEnterDrug.bind(this)
+        this.handleMouseLeaveDrug = this.handleMouseLeaveDrug.bind(this)
+        this.handleMouseEnterImg = this.handleMouseEnterImg.bind(this)
         this.handleMouseLeaveImg = this.handleMouseLeaveImg.bind(this)
+
     }
 
-    handleMouseEnterImg(index) {
+    handleMouseEnterDrug( index, item) {
+        console.log('item', item)
+        const drugNameWidth = parseInt($('#'+item.medicitionName)[0].offsetWidth)
+        
+        const imgLeft = drugNameWidth/2-10
+        console.log('imgLeft', imgLeft)
+        $('#'+item.medicitionName).find('img').css('left', imgLeft)
+       
         this.setState({
             currentIndex: index,
         })
     }
-    handleMouseLeaveImg() {
+    handleMouseLeaveDrug() {
         this.setState({
             currentIndex: -1,
         })
     }
+    handleMouseEnterImg() {
+        this.setState({
+            hasEnterImg: true
+        })
+    }
+    handleMouseLeaveImg() {
+        this.setState({
+            hasEnterImg: false
+        })
+    }
     handleSelect(index,ii) {
         const { selectDrug } = this.props;
         selectDrug && selectDrug(index,ii);
@@ -40,7 +64,7 @@ class TreatDesc extends Component {
     render(){
         const  { treatment, treatDesc, setDrugInfo, showDrugInfo} = this.props
         const { title, basic, otherDrugIndex, drugDesc} = treatDesc
-        const { currentIndex } = this.state
+        const { currentIndex, hasEnterImg } = this.state
         return (treatment && treatment.length >0 && <div  className={style['treat-desc-box']}>
             
             {title && title === '药品推荐' ? <div className={style['similar-drug-box']} id='treatDescBox'>
@@ -57,22 +81,32 @@ class TreatDesc extends Component {
                     {treatment[otherDrugIndex].medicitionsList.map((item, index) =>{
                         return (<span >
                         {index === 0 ? '' : ', '}     
-                        <span className={style['drug-name-box']}>
+                        <span className={style['drug-name-box']}
+                            onMouseEnter={this.handleMouseEnterDrug.bind(this, index, item )}
+                            onMouseLeave = {this.handleMouseLeaveDrug}
+                            id={item.medicitionName}
+                        >
                             <span className={style['drug-name']} 
                                 // onDoubleClick={() =>{setDrugInfo(item);showDrugInfo();}} 
                                 onClick={()=>{item.forbidden === '2' ? '' : this.handleSelect(otherDrugIndex,index)}} 
                                 style={item.forbidden === '2' ? {opacity: '0.3', filter:'alpha(opacity=30)',filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=30)'} : item.selected ? {color: '#3B9ED0'}:''}
-                              
                                 >
                                 {item.medicitionName}
                             </span>
+                            {<img className={style['info-img']}  
+                                style ={currentIndex === index ? {display: "inline-block"} : {display: "none"}}
+                                src={currentIndex === index ?  (hasEnterImg ? info3 : info2) : info2} 
+                                onMouseEnter={this.handleMouseEnterImg.bind(this, index)}
+                                onMouseLeave = {this.handleMouseLeaveImg}
+                                onClick={() =>{setDrugInfo(item);showDrugInfo();}}
+                                />}
                         </span>              
                         
-                        {<img className={style['info-img']}    
+                        {/* {<img className={style['info-img']}    
                             src={currentIndex === index ? info1 : info} 
                             onMouseEnter={this.handleMouseEnterImg.bind(this, index)}
                             onMouseLeave = {this.handleMouseLeaveImg}
-                            onClick={() =>{setDrugInfo(item);showDrugInfo();}}/>}
+                            onClick={() =>{setDrugInfo(item);showDrugInfo();}}/>} */}
                         {item.forbidden === '1' ? <span className={style['info-flag']} style={{border: '1px solid #F4C051', background: '#F4C051',marginLeft: '5px'}}>慎用</span>: item.forbidden === '2' ? <span className={style['info-flag']} style={{opacity: '0.3', filter:'alpha(opacity=30)',filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=30)',border: '1px solid #000',marginLeft: '5px'}}>禁用</span> : ''},
                         <span  style={item.forbidden === '2' ? {opacity: '0.3', filter:'alpha(opacity=30)',filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=30)'} : ''}> 使用率{item.rate}</span>
                         

+ 4 - 1
src/components/TreatDesc/index.less

@@ -49,6 +49,7 @@
 .drug-name-box {
     display: inline-block;
     height: 30px;
+    position: relative;
 }
 .drug-name {
     border-bottom: 1px solid #666;
@@ -57,9 +58,11 @@
     
 }
 .info-img {
-    width: 12px;
+    width: 15px;
     margin: 0 3px -1px;
     cursor: pointer;
+    position: absolute;
+    top: -10px;
 }
 .info-flag {
     display: inline-block;

+ 2 - 2
src/config/index.js

@@ -26,7 +26,7 @@ export default {
     addOthSId:21,      //现病史 添加其他症状id
     banId:10,       //伴 id
     limited:30,    //主诉限制字数
-    limitText:"已超过30字符,请修改主诉",    //主诉限制提示
+    limitText:"已超过30字符(含标点),请修改主诉",    //主诉限制提示
     delayTime:500,      //延迟搜索的时间
     delayPushTime:1000,    //延迟推送时间
     pushDelay:1000,
@@ -43,6 +43,6 @@ export default {
       age:"岁",
     },
     showCheckNum:16,        //查体默认展开非自由文本标签的个数
-    radioOptionPer:'( )',     //单选项输入占位符
+    radioOptionPer:'()',     //单选项输入占位符
     Params
 };

+ 1 - 0
src/containers/AdviceContainer.js

@@ -7,6 +7,7 @@ function mapStateToProps(state) {
     return ({
         pushMessage: state.pushMessage,
         isRead:state.homePage.isRead,
+        adviceInput: state.pushMessage.advice.adviceInput
     })
 }
 

+ 1 - 0
src/containers/MainSuit.js

@@ -30,6 +30,7 @@ function mapStateToProps(state) {//console.log(11,state);
     span:state.mainSuit.span,
     addModuleName:state.mainSuit.addModuleName,//添加病情变化模板名称
     editClear:state.mainSuit.editClear,
+    clearAction:state.mainSuit.clearAction,//清除
     mainIds:state.mainSuit.mainIds,//选中症状的id,搜索去重用
     isRead:state.homePage.isRead,
     commSymHide:state.homePage.commSymHide,

+ 1 - 1
src/containers/Multiple.js

@@ -50,7 +50,7 @@ function handleCheckBody(dispatch,params){
   const index = getLabelIndex(ikey);
   dispatch({
     type:CHECKBODY_MUL,
-    data:{seleData,seleId,ikey:index}
+    data:{seleData,seleId,ikey:index,fullIkey:ikey}
   })
 }
 

+ 24 - 8
src/containers/NumberUnitDrop.js

@@ -15,6 +15,7 @@ import config from '@config/index.js';
 function mapStateToProps(state){
   return {
     mainSaveText:state.mainSuit.saveText,
+    mainData:state.mainSuit.data,
   }
 }
 //查体数字键盘选中
@@ -47,13 +48,22 @@ function currentSelect(dispatch,params){
 }
 
 function handleModuleDiff(dispatch,params){
-  const {mainSaveText,mark} = params;
+  const {mainSaveText,mark,mainData} = params;
   const type = params.ikey.substr(0,1);    //当前所在的项目
+  let ikey = getLabelIndex(params.ikey);
   switch (+type){
     case 1:
       if(mark){//选中才限制,清空和回退无需验证
-        let text = filterDataArr(mainSaveText);
-        if(text.length >= config.limited){
+        // let text = filterDataArr(mainSaveText);
+        let text = filterArr(mainSaveText);
+        const item = mainData[+ikey];
+        const nextItem = mainData[+ikey+1];
+        let lengths = text.length;
+        if(nextItem&&nextItem.tagType==8 && nextItem.tagName==',' && item.value){
+          lengths = text.length + 1;
+        }
+        // console.log(999,mainSaveText,lengths);
+        if(lengths >= config.limited){
           Notify.info(config.limitText);
           return
         }
@@ -80,7 +90,8 @@ function mainSuitLabel(dispatch,params){
   const {changeVal,totalVal} = params;
   dispatch({
     type:CHANGE_LABELVAL,
-    data:{changeVal:changeVal,ikey:ikey,totalVal}
+    // data:{changeVal:changeVal,ikey:ikey,totalVal}
+    data:Object.assign({},params,{ikey})
   })
 }
 // 现病史
@@ -89,7 +100,8 @@ function currentLabel(dispatch,params){
   let ikey = getLabelIndex(index);
   dispatch({
     type:CURRENT_TEXT_LABEL,
-    data:{changeVal:params.changeVal,ikey:ikey}
+    // data:{changeVal:params.changeVal,ikey:ikey}
+    data:Object.assign({},params,{ikey})
   })
 }
 
@@ -100,7 +112,8 @@ function otherHisLabelEdit(dispatch,params){
   let ikey = getLabelIndex(index);
   dispatch({
     type:CHANGEOTHERTEXTLABEL,
-    data:{changeVal:changeVal,ikey:ikey,totalVal}
+    // data:{changeVal:changeVal,ikey:ikey,totalVal}
+    data:Object.assign({},params,{ikey})
   })
 }
 
@@ -111,7 +124,8 @@ function checkBodyLabelEdit(dispatch,params){
   const {changeVal,totalVal} = params;
   dispatch({
     type:CHANGECHECKTEXTLABEL,
-    data:{changeVal:changeVal,ikey:ikey,totalVal}
+    // data:{changeVal:changeVal,ikey:ikey,totalVal}
+    data:Object.assign({},params,{ikey})
   })
 }
 function mapDispatchToProps(dispatch,store){
@@ -131,7 +145,9 @@ function mapDispatchToProps(dispatch,store){
           type:ISREAD
         })
       }
-      
+      dispatch({
+        type: ISREAD
+      });
     },
     handleDbclick(obj){
       dispatch({

+ 1 - 0
src/containers/OtherHistory.js

@@ -52,6 +52,7 @@ function mapDispatchToProps(dispatch,store){
           type:SETDATA,
           data:listObj.newArr,
           selecteds:selects,
+          period:initData.period,
           save:listObj.saveText,
           isEmpty:false
         });

+ 3 - 4
src/containers/RadioInpDrop.js

@@ -14,7 +14,7 @@ import config from '@config/index.js';
 
 function mapStateToProps(state){
   return {
-    mainSaveText:state.mainSuit.saveText,
+    //mainSaveText:state.mainSuit.saveText,
   }
 }
 
@@ -64,11 +64,10 @@ function otherSelect(dispatch,params){
 //查体单选下拉选中事件
 function checkSelect(dispatch,params){
   const {ikey,id,values} = params;
-  let index = getLabelIndex(ikey);
   dispatch({
     type:SET_CK_RADIO_INPUT_VAL,
     data:{
-      ikey:index,
+      ikey,
       id,
       values
     }
@@ -148,7 +147,7 @@ function mapDispatchToProps(dispatch,store){
       let ikey = getLabelIndex(index);
       dispatch({
         type:InputActions[+boxMark],
-        data:{values:params.values,ikey:ikey}
+        data:{values:params.values,ikey:boxMark==4?params.ikey:ikey}
       });
       dispatch(billing());
       dispatch({

+ 5 - 1
src/containers/eleType.js

@@ -73,6 +73,8 @@ export function singleRadio(params){
     case 7:
       return <NumberDrop prefix={data.labelPrefix}
                          suffix={data.labelSuffix}
+                         min={data.minValue}
+                         max={data.maxValue}
                          placeholder={data.name}
                          boxMark={boxMark}
                          id={data.id}
@@ -98,14 +100,16 @@ export function singleRadio(params){
 //多标签组合型
 function multLabels(params){
   const data = params.item;
-  const {i,boxMark,showArr,saveText} = params;
+  const {i,boxMark,showArr,saveText,selecteds} = params;
   return <MultSpread data={data.questionMapping}
                      showAdd = {+data.showAdd===1}
                      copyId={data.id}
                      fullData = {data}
                      showArr={showArr||{}}
                      update={Math.random()}
+                     boxMark={boxMark}
                      ikey={boxMark+i}
+                     selecteds={selecteds&&selecteds[i]}
                      saveText={saveText}
                      name={data.name||data.tagName}
                      textPrefix={data.prefix}

+ 45 - 6
src/store/actions/checkBody.js

@@ -138,8 +138,13 @@ export function setRadioValue(state,action){
 export const setRadioInputValue = (state,action)=>{
   const res = Object.assign({},state);
   const {ikey,values,id} = action.data;
-  const item = res.data[ikey];
-  let str='',temp='',obj=res.data[ikey].questionDetailList;
+  let index = getLabelIndex(ikey);
+  let innerInx = ikey.substr(ikey.length-1);
+  let item = res.data[index];
+  if(item.tagType==3){      //在组合项中
+    item = res.data[index].questionMapping[innerInx];
+  }
+  let str='',temp='',obj=item.questionDetailList;
   if(!values){    //清空
     let sld=obj.find((item)=>{
       return item.selected==true;
@@ -147,7 +152,18 @@ export const setRadioInputValue = (state,action)=>{
     sld?sld.selected=false:'';
     item.vals = null;
     item.value = '';
-    res.saveText[ikey] = '';
+    if(res.data[index].tagType==3){
+      let hasValue = false;
+      const sub = res.data[index].questionMapping.map((it)=>{
+        if(it.value){     //至少有一个子值才黑显
+          hasValue = true;
+        }
+        return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
+      });
+      res.saveText[index] = hasValue?sub.join(''):'';
+    }else{
+      res.saveText[index] = '';
+    }
     res.update = Math.random();
     return res;
   }
@@ -171,7 +187,15 @@ export const setRadioInputValue = (state,action)=>{
   }
   item.vals = values;
   item.value = str;
-  res.saveText[ikey] = str;
+  if(res.data[index].tagType==3){
+    let hasValue = false;
+    const sub = res.data[index].questionMapping.map((it)=>{
+      return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
+    });
+    res.saveText[index] = sub.join('');
+  }else {
+    res.saveText[ikey] = str;
+  }
   res.update = Math.random();
   return res;
 }
@@ -384,8 +408,23 @@ export function backspaceText(state,action){
 // 单列多选
 export function multipleComfirn(state,action){
   let res = Object.assign({},state);
-  const {ikey,seleData} = action.data;
-  let data = res.data;
+  const {ikey,seleData,fullIkey} = action.data;
+  let data = res.data;//console.log(action,data[ikey])
+  let index = fullIkey.substr(fullIkey.length-1,1);
+  if(data[ikey].tagType==3){    //在组合项中
+    let item = data[ikey].questionMapping;
+    let arr=[];
+    item[index].value = seleData;
+    item.map((it)=>{
+      if(it.value){
+        arr.push(it.labelPrefix+it.value+it.labelSuffix);
+      }
+    });
+    res.saveText[ikey] = arr.join("");
+    res.update = Math.random();
+    res.selecteds[ikey] = {[index]:action.data};
+    return res;
+  }
   data[ikey].value = seleData;
   res.saveText[ikey] = seleData;
   res.selecteds[ikey] = action.data;

+ 6 - 4
src/store/actions/currentIll.js

@@ -174,7 +174,8 @@ export const setData = (state,action) =>{
               if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
                 for(let j=0; j<newMainCopy.length; j++){
                   if(newMainCopy[j].id==mainCopy[k].id){
-                    newMainCopy[j].value = newMainCopy[j].name = mainCopy[k].value+',';
+                    // newMainCopy[j].value = newMainCopy[j].name = mainCopy[k].value+',';
+                    newMainCopy[j].value = newMainCopy[j].name = mainCopy[k].value||mainCopy[k].name+',';
                   }
                 }
               }       
@@ -221,8 +222,9 @@ export const setData = (state,action) =>{
               withLengArr[d] = items.length;
               if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
                 for(let j=0; j<newWiths.length; j++){
-                  if(newWiths[j].id==mainCopy[d].id){
-                    newWiths[j].value = newWiths[j].name = withs[d].value+',';
+                  if(newWiths[j].id==withs[d].id){
+                    // newWiths[j].value = newWiths[j].name = withs[d].value+',';
+                    newWiths[j].value = newWiths[j].name = withs[d].value||withs[d].name+',';
                   }
                 }
               }
@@ -269,7 +271,7 @@ export const setData = (state,action) =>{
               if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
                 for(let j=0; j<featureData.length; j++){
                   if(featureData[j].id==symptomFeature[k].id){
-                    featureData[j].value = featureData[j].name = symptomFeature[k].value+',';
+                    featureData[j].value = featureData[j].name = symptomFeature[k].value||symptomFeature[k].name+',';
                   }
                 }
               }

+ 19 - 21
src/store/actions/mainSuit.js

@@ -98,7 +98,7 @@ export const insertMain = (state,action) => {
   if(items.length>1){
     for(let i=1; i<items.length; i++){
       items[i].name = '、'+items[i].name;
-      items[i].value = items[i].value?'、'+items[i].value:items[i].name;
+      items[i].value = '、'+items[i].value;
     } 
   }
   let obj = [];
@@ -111,14 +111,13 @@ export const insertMain = (state,action) => {
         inserIndx = i;
       }
     })
-  // data.splice(inserIndx-1,1,...obj);
-  // 防止没有flag的情况下报错,找不到flag就插到最后
-  inserIndx?data.splice(inserIndx-1,1,...obj):data.splice(-1,0,...obj);
+  data.splice(inserIndx-1,1,...obj);
   // data[inserIndx-1] = text;//替换空标签
   res.data = data;
   res.saveText = [];//将手动输入的值清掉
   // res.saveText[inserIndx] = text.name;
   res.saveText = fullfillText(res.data).saveText;
+  // res.mainIds.push(id);
   res.mainIds = res.mainIds.concat(id);
   res.editClear = false;//主诉框编辑状态
   res.update=Math.random();
@@ -310,7 +309,7 @@ export const insertSearch = (state,action)=>{
       }
     })
     // flag=1前是文本标签就替换,否则插入
-    const iftext = inserIndx?moduleData[inserIndx-1].tagType:null;
+    const iftext = moduleData[inserIndx-1].tagType;
     if(iftext==config.tagType){
        moduleData.splice(inserIndx-1,1,{id:id,name:searchData,value:searchData,tagType:config.tagType,exist:1});
      }else{
@@ -522,29 +521,29 @@ export const setRadioInputValue = (state,action)=>{
 //双击标签输入改变值
 export const changeLabelVal = (state,action)=>{
   const res = Object.assign({},state);
-  const index = parseInt(action.data.ikey);
-  const newVal = action.data.changeVal;
-  let data = res.data;
-  let item = data[index];
+  const {changeVal,totalVal,ikey,prefix,suffix} = action.data;
+  const index = ikey;
+  const newVal = changeVal;
+  let item = res.data[index];
   const next = res.data[+index+1];
   const nextVal = next.value||next.name;
   //标签后是不是标点符号标签,是的话删除本标签时一起删除
   let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
-  // if(newVal&&newVal.trim()){//时间单位传空--键盘输入
-  if(newVal){
+  let labText = totalVal?totalVal:newVal;
+  if(labText.trim()){
     if(item){
       item.value = newVal;
-      res.saveText[index] = newVal;
+      item.labelPrefix = prefix||'';
+      item.labelSuffix = suffix||'';
+      res.saveText[index] = labText;
     }
   }else{//删除完标签内容则删除该标签
     const num = nextIsDot?2:1;
-    data.splice(index,num);
-    // data[index].value = "";
-    // res.data.splice(index,1);
-    res.saveText.splice(index,1);
-    // res.saveText[index] = "";
-  } 
-  res.update = Math.random();
+    res.data.splice(index,num);
+    res.selecteds.splice(index,num);//杂音类样式选中状态对应
+    res.saveText = fullfillText(res.data).saveText;
+  }
+  res.update = Math.random();//console.log(222,res);
   return res;
 }
 
@@ -586,8 +585,7 @@ export const saveFreeVal = (state,action)=>{
   }else{
     res.saveText = [];
   }*/
-  // res.update = Math.random();
-  // console.log(666,action,res);
+  res.update = Math.random();
   return res;
 }
 

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

@@ -274,17 +274,25 @@ export function changeTextLabel(state,action) {
   if(labText.trim()){
     if(item){
       item.value = newVal;
+      //月经史特殊处理
+      if(item.formulaCode){
+        res[item.formulaCode] = newVal;
+      }
       item.labelPrefix = prefix||'';
       item.labelSuffix = suffix||'';
       res.saveText[index] = labText;
     }
   }else{//删除完标签内容则删除该标签
     const num = nextIsDot?2:1;
+    //月经史特殊处理
+    if(res.data[index].formulaCode){
+      res[res.data[index].formulaCode]=undefined;
+    }
     res.data.splice(index,num);
     res.selecteds.splice(index,num);//杂音类样式选中状态对应
     res.saveText = fullfillText(res.data).saveText;
   }
-  res.update = Math.random();
+  res.update = Math.random();//console.log(888,res,action);
   return res;
 }
 
@@ -368,6 +376,10 @@ export function backspaceText(state,action){
     res.saveText.splice(delIndex,1);
   }
   else{
+    //月经史删除处理
+    if(data[delIndex-1].formulaCode){
+      res[data[delIndex-1].formulaCode]=undefined;
+    }
     data.splice(delIndex-1,2);
     res.saveText.splice(delIndex-1,2);
   }

+ 3 - 3
src/store/actions/patInfo.js

@@ -26,8 +26,8 @@ export const updatePatientMessage=(state,action)=>{
       // sex: 2
     // };
     res.message = action.data;
-    if(!action.data.selfDeptId){    //selfDeptId这个参数是跟外部对接用的
-        res.message = mock;
-    }
+    /*if(!action.data.selfDeptId){    //selfDeptId这个参数是跟外部对接用的
+        res.message = {};
+    }*/
     return res;
 };

+ 7 - 1
src/store/async-actions/fetchModules.js

@@ -87,7 +87,7 @@ export const getOtherHisRecord = ()=>{
         const data = res.data.data;
         const obj = JSON.parse(data.dataJson||'{}');
         const objStr = JSON.parse(data.otherStr||'[]');
-        let arr = [];
+        let arr = [];//console.log(obj)
         if((!obj||!obj.other||obj.other.length==0)&&!objStr[0]){        //无其他史历史记录用默认模板
           if(mode=='1'){      //文本模式
             dispatch({
@@ -113,6 +113,12 @@ export const getOtherHisRecord = ()=>{
             dispatch({
               type:SETOTHERHISTORY,
               data:arr,
+              period:{
+                yjs_1: obj.yjs_1,
+                yjs_2: obj.yjs_2,
+                yjs_3: obj.yjs_3,
+                yjs_4: obj.yjs_4,
+              },
               selecteds:obj.otherHistorySelecteds,
               save:objStr
             });

+ 8 - 1
src/store/async-actions/homePage.js

@@ -27,7 +27,14 @@ function modulesParseJson(data){
 export const getInitModules= (dispatch,getStore)=>{
   const state = getStore();
   const {message} = state.patInfo;
-  return json(api.getModules,{age:message.patientAge,sexType:message.sex}).then((res) => {
+  const param = {
+    age:message.patientAge,
+    sexType:message.sex,
+    mouduleType:1,//慢病2  科室1 其他0
+    relationId:message.hospitalDeptId, //慢病id  科室id  其他0
+  }
+  // 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') {
         const newObj = modulesParseJson(res.data.data);

+ 2 - 1
src/store/async-actions/mainSuit.js

@@ -18,7 +18,8 @@ export const getCommSymptoms = ()=>{//获取常见症状
     const params = {
       'deptId':deptCode,
       'age':message.patientAge,
-      'sexType':message.sex
+      'sexType':message.sex,
+      'type':1
     };
     json(api.getCommSymptoms,params).then((res)=>{
         let result = res.data;

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

@@ -50,6 +50,7 @@ export default function (state=initState,action) {
       res.initData.otherHisSave = action.save;
       res.initData.otherSelecteds = action.selecteds||[];
       res.initData.otherIsHis = action.otherIsHis!=undefined?action.otherIsHis:true;
+      res.initData.period = action.period;
       return res;
     /*case SETTEXTFOCUS:
       res.focusTextIndex = action.index;

+ 7 - 0
src/store/reducers/otherHistory.js

@@ -21,6 +21,13 @@ export default function(state=initState,action){//console.log(state)
     case SETDATA:
       res.data = action.data;
       res.selecteds = action.selecteds||[];
+      const period = action.period;
+      if(period){
+        res.yjs_1=period.yjs_1;
+        res.yjs_2=period.yjs_2;
+        res.yjs_3=period.yjs_3;
+        res.yjs_4=period.yjs_4;
+      }
       res.saveText = action.save||[];
       res.isEmpty = action.isEmpty;
       return res;

+ 2 - 1
src/utils/tools.js

@@ -239,7 +239,7 @@ const getAllDataStringList =(baseList) =>{           //获取所有模块文本
 const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清空所有的数据
     if(action == 'clear'){     //清空
       const block = Object.assign(JSON.parse(config.textLabel),{full:true});//空白时保留一个自由文本标签
-      store.dispatch({type: CLEAR_MAIN_SUIT,data:[],saveText:[],selecteds:[],editClear:true,mainIds:[]});
+      store.dispatch({type: CLEAR_MAIN_SUIT,data:[],saveText:[],selecteds:[],editClear:true,mainIds:[],clearAction:true});
         store.dispatch({type: CLEAR_CURRENT_ILL,data:[],saveText:[],selecteds:[],editClear:true,symptomIds:[]});
         store.dispatch({type: CLEAROTHERHISTORY,data:[block],isEmpty:true,saveText:[],selecteds:[],editClear:true,yjs_1:'',yjs_2:'',yjs_3:'',yjs_4:''});
         store.dispatch({type: CLEARCHECKBODY,data:[block],isEmpty:true,saveText:[],selecteds:[]});
@@ -513,6 +513,7 @@ function filterArr(arr){
 function filterDataArr(arrTmp){   //数据处理
     let tmpArr = [];
     tmpArr = arrTmp.map((it,i)=>{     //连续的标点符号保留第一个
+      if(!it)return '';
       if(!it.match(config.punctuationReg)&&!arrTmp[i-1]){        //只有标点符号或者前一个标签无值是(说明本标点灰显,不显示在预览中)
           return '';
       }

+ 10 - 8
static/pages/hisLib/diag_push.js

@@ -123,9 +123,9 @@
     var key='',modeClass='.'+config.mode;
     mapItem(modeClass+" .box5", data['lisList'],5);   //化验
     mapItem(modeClass+" .box6", data['pacsList'],6);   //辅捡
-    data['dis']['可能诊断'].length>0&&mapItem(modeClass+" .box7", data['dis']['可能诊断'],7);   //初步诊断
-    data['dis']['确诊'].length>0&&mapItem(modeClass+" .box8", data['dis']['确诊'],7);   //疑似诊断
-    data['dis']['警惕'].length>0&&mapItem(modeClass+" .box9", data['dis']['警惕'],7);   //警惕
+    data['dis']['可能诊断']&&data['dis']['可能诊断'].length>0&&mapItem(modeClass+" .box7", data['dis']['可能诊断'],7);   //初步诊断
+    data['dis']['确诊']&&data['dis']['确诊'].length>0&&mapItem(modeClass+" .box8", data['dis']['确诊'],7);   //疑似诊断
+    data['dis']['警惕']&&data['dis']['警惕'].length>0&&mapItem(modeClass+" .box9", data['dis']['警惕'],7);   //警惕
 
     $("a.info").click(function(e){
       getTreatInfo($(e.target).attr('type'),$(e.target).attr('name'),$(e.target).attr('detailName'))
@@ -136,11 +136,13 @@
   //遍历数据
   function mapItem(dom,item,type){
     var itemDom = '';
-    for(var i=0;i<item.length;i++){
-      if(i>config.num-1){
-        itemDom += '<p class="inner-item"><a href="##" class="hide">'+(item[i].name||item[i].uniqueName)+'</a><a class="info hide" target="_blank name="'+item[i].name+'" type='+type+' detail="'+item[i].detailName+'>i</a></p>';
-      }else{
-        itemDom += '<p class="inner-item"><a href="##">'+(item[i].name||item[i].uniqueName)+'</a><a class="info" target="_blank" name='+item[i].name+' type="'+type+'" detail="'+item[i].detailName+'">i</a></p>';
+    if(item){
+      for(var i=0;i<item.length;i++){
+        if(i>config.num-1){
+          itemDom += '<p class="inner-item"><a href="##" class="hide">'+(item[i].name||item[i].uniqueName)+'</a><a class="info hide" target="_blank name="'+item[i].name+'" type='+type+' detail="'+item[i].detailName+'>i</a></p>';
+        }else{
+          itemDom += '<p class="inner-item"><a href="##">'+(item[i].name||item[i].uniqueName)+'</a><a class="info" target="_blank" name='+item[i].name+' type="'+type+'" detail="'+item[i].detailName+'">i</a></p>';
+        }
       }
     }
     $(dom+" .item-content").html(itemDom||"无");