Browse Source

Merge branch 'dev/new1' into dev/zhangxc1

zhangxc 6 năm trước cách đây
mục cha
commit
974500d599

+ 1 - 0
src/components/AddInspect/SlideSelect/index.jsx

@@ -117,6 +117,7 @@ class SlideSelect extends Component {
                             handlePush&&handlePush();     //右侧推送
                         }}
                     >
+                    
                         <div className={styles.searchResultT}>
                             <img style={{"position":"absolute","top":"8px","right":"8px"}} src={date1} alt="" onClick={handleShowDate}/>
                             <p style={{position:"absolute",right:"38px",top:"4px",lineHeight:"28px"}}>

+ 28 - 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}
@@ -90,6 +107,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;

+ 16 - 9
src/components/NumberDrop/index.jsx

@@ -42,9 +42,16 @@ class NumberDrop extends Component{
   }
   select(text){        //选中键盘上数字事件
     const {handleSelect,ikey,suffix,prefix,mainSaveText} = this.props;
-    this.setState({
-      hasSelect:true
-    });
+    if(!text){
+      this.setState({
+        placeholder:this.props.placeholder
+      });
+    }else{
+      this.setState({
+        hasSelect:true
+      });
+    }
+
     handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
   }
   handleNumFocus(e){       //数字框可编辑状态下聚集事件,处理是否显示下拉等
@@ -93,18 +100,18 @@ class NumberDrop extends Component{
   }
   numInpBlur(e){        //数字框失焦,保存值到store中
     e.stopPropagation();
+    if(this.props.show){      //修改清空后第一次点击键盘不触发click事件bug
+      return;
+    }
     const that = this;
-    setTimeout(function(){      //第一次选中数字时placeholder闪一下优化
-      if(!that.state.hasSelect&&!e.target.innerText.trim()){
+    //setTimeout(function(){      //第一次选中数字时placeholder闪一下优化
+      if(!e.target.innerText.trim()){
         that.setState({
           placeholder:that.props.placeholder
         });
       }
-    },100);
+    //},100);
 
-    if(this.props.show){      //修改清空后第一次点击键盘不触发click事件bug
-      return;
-    }
     this.setState({
       hasSelect:false
     });

+ 2 - 2
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();

+ 57 - 4
src/components/Treat/index.jsx

@@ -17,11 +17,66 @@ class Treat extends Component {
         this.handlePrescription = this.handlePrescription.bind(this);
         this.handleDetermine = this.handleDetermine.bind(this);
     }
+    componentDidMount(){
+        let wrap = document.getElementById('treatWrapper')
+        let drag = document.getElementById('dragTreatTitle')
+        let width = $(window).width();
+        let height = $(window).height();
+        let mouseX = 0,mouseY = 0,dragX = 0,dragY = 0,isDrag = false,isMove = false;
+        
+        let maxDragX = width - wrap.offsetWidth
+        let maxDragY = height - wrap.offsetHeight
+        drag.onmousedown = (event)=>{    //鼠标位置获取,计算点击位置到拖拽元素左边的距离
+          let e = event || window.event;
+          mouseX = e.pageX - wrap.offsetLeft
+          mouseY = e.pageY - wrap.offsetTop
+          isDrag = true
+        }
+        document.onmousemove = (event)=>{      //移动的
+          let e = event || window.event;
+          if(isDrag){
+            dragX = e.pageX - mouseX
+            dragY = e.pageY - mouseY
+            if(dragX < 0){      //不能超出左边界
+              dragX = 0
+            }
+            if(dragY < 0){      //不能超出上边界
+              dragY = 0
+            }
+            // if(wrap.offsetLeft >= maxDragX){
+            //   dragX = maxDragX
+            // }else{
+            //   dragX = e.pageX - mouseX
+            // }
 
+            // if(height-drag.offsetHeight > wrap.offsetTop){
+            //   dragY = height-drag.offsetHeight
+            // }
+            isMove = true
+            wrap.style.left = dragX + 'px'
+            wrap.style.marginLeft = 0 + 'px'
+            wrap.style.top = dragY + 'px'
+          }
+        }
+        document.onmouseup = ()=>{
+          if(isMove){
+            wrap.style.left = dragX + 'px'
+            wrap.style.top = dragY + 'px'
+          }else{
+            wrap.style.left = '50%'
+            wrap.style.top = '10%'
+            wrap.style.marginLeft = '-340px'
+          }
+          isDrag = false
+          return false
+        }
+    }
     hideTreat() {
         const { hideTreat,clearTreat } = this.props;
         clearTreat && clearTreat();
         hideTreat && hideTreat();
+        // document.onmousemove = null
+        // document.onmouseup = null
     }
     handlePrescription() {
         Notify.info('该功能即将上线,敬请期待。', 2000)
@@ -38,16 +93,14 @@ class Treat extends Component {
     }
 
     render(){
-    
-    
         const { generalTreat, treatment, treatItem, surgeryTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title, drugInfoList, hideDrugInfoMore} = this.props;
         const { setDrugInfoMore } = this.props
         return(
             <div   className={style['treat-wrapper']}>
                 <div className={style['treat-mask']} onClick={this.hideTreat}>
                 </div>
-                <div id='treatWrapper' className={style['treat-box']}>
-                    <div className={style['treat-title']}>治疗方案 ({treatItem.name})<img onClick={this.hideTreat} src={close}/></div>
+                <div id="treatWrapper" className={style['treat-box']}  onselectstart="return false">
+                    <div id="dragTreatTitle" className={style['treat-title']}>治疗方案 ({treatItem.name})<img onClick={this.hideTreat} src={close}/></div>
 
                     <div className={style['treat-inner-box']}>
                         <GeneralTreat icon={generalIcon} title='一般治疗'   generalTreat={generalTreat}></GeneralTreat>

+ 8 - 0
src/components/Treat/index.less

@@ -47,6 +47,14 @@
     line-height: 40px;
     border-bottom: 1px solid #e0e2e4;
     padding-left: 20px;
+    cursor: move;
+    moz-user-select: -moz-none;
+    -moz-user-select: none;
+    -o-user-select:none;
+    -khtml-user-select:none;
+    -webkit-user-select:none;
+    -ms-user-select:none;
+    user-select:none;
     img{
         float: right;
         cursor: pointer;

+ 1 - 1
src/config/index.js

@@ -43,6 +43,6 @@ export default {
       age:"岁",
     },
     showCheckNum:16,        //查体默认展开非自由文本标签的个数
-    radioOptionPer:'( )',     //单选项输入占位符
+    radioOptionPer:'()',     //单选项输入占位符
     Params
 };

+ 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}
   })
 }
 

+ 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 - 6
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
     }
@@ -143,9 +142,7 @@ function mapDispatchToProps(dispatch,store){
       });
     },
     handleSaveInp(params){
-      const {boxMark} = params;
-      const index = params.ikey;
-      let ikey = getLabelIndex(index);
+      const {boxMark,ikey} = params;
       dispatch({
         type:InputActions[+boxMark],
         data:{values:params.values,ikey:ikey}

+ 3 - 1
src/containers/eleType.js

@@ -98,14 +98,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}

+ 46 - 7
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;
 }
@@ -232,7 +256,7 @@ export function insertLabelData(state,action){
   let res = Object.assign({},state);
   const text = Object.assign({},JSON.parse(config.textLabel));
   const searchStr = res.searchStr;
-  const {index,data,isReplace,span,searchInEnd}=action;console.log("查体",data);
+  const {index,data,isReplace,span,searchInEnd}=action;
   const showText = res.saveText[index];
   const spreadLabels = data.tagType==4?fullfillText(data.questionMapping).newArr:[data];
   let reg = searchInEnd?new RegExp(searchStr+"$"):new RegExp("^"+searchStr);
@@ -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;

+ 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
             });

+ 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;

+ 1 - 0
src/utils/tools.js

@@ -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||"无");