Explorar o código

Merge remote-tracking branch 'origin/dev/byll' into dev/new1

# Conflicts:
#	src/common/less/variables.less
#	src/components/PushContainer/index.jsx
#	src/utils/tools.js
zhouna %!s(int64=6) %!d(string=hai) anos
pai
achega
96cc574ab2

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

@@ -57,7 +57,7 @@ class SearchOption extends React.Component {
               show:true
           })
       }else{
-          // this.handleClearVal()
+          this.handleClearVal('')            //这个要放开,输入为空清除列表
           this.setState({
               show:false
           })

+ 4 - 4
src/common/less/variables.less

@@ -57,8 +57,8 @@
   top:30px;
   background: #fff;
   box-shadow: 0 10px 20px 0 #989DA3;
-  filter:progid:DXImageTransform.Microsoft.Shadow(color='#989DA3',Direction=125,Strength=6);
-  border: 1px solid #f3f0f0;
+  // filter:progid:DXImageTransform.Microsoft.Shadow(color='#989DA3',Direction=125,Strength=6);
+  border: 1px solid #dedede;
   z-index: 203;
   padding: 20px;
   white-space: nowrap;
@@ -159,8 +159,8 @@
 
 .llStyle{
   box-shadow: 0 10px 20px 0 #989DA3;
-  filter:progid:DXImageTransform.Microsoft.Shadow(color='#989DA3',Direction=125,Strength=6);
-  border: 1px solid #f3f0f0;
+  // filter:progid:DXImageTransform.Microsoft.Shadow(color='#989DA3',Direction=125,Strength=6);
+  border: 1px solid #dedede;
 }
 
 .borderd{

+ 4 - 20
src/components/AddInspect/index.jsx

@@ -1,6 +1,6 @@
 import React from 'react';
 import { SearchOption, InspectCommon, Calendar ,Notify,ConfirmModal,Add} from '@commonComp';
-import { deepClone } from '@utils/tools';
+import { deepClone,normalVal } from '@utils/tools';
 import styles from './index.less';
 import date1 from './img/date1.png';
 import date2 from './img/date2.png';
@@ -30,7 +30,6 @@ class Inspect extends React.Component {
         this.getItemList = this.getItemList.bind(this)
         this.getSearchList = this.getSearchList.bind(this)
         this.changeActivePart = this.changeActivePart.bind(this)
-        this.normalVal = this.normalVal.bind(this)
         this.showDetails = this.showDetails.bind(this)
         this.delConfirm = this.delConfirm.bind(this)
         this.handleCancel = this.handleCancel.bind(this)
@@ -232,21 +231,6 @@ class Inspect extends React.Component {
         }
     </ul>
     }
-    normalVal(min,max){
-        if((min-0) && (max-0)){
-            return `正常值: (${min}~${max})`
-        }else if((min-0) && !(max-0)){
-            return `正常值: (>=${min})`
-        }else if(!(min-0) && (max-0)){
-            if(min == '' || min == null){
-                return `正常值: (<=${max})`
-            }else{
-                return `正常值: (${min}~${max})`
-            }
-        }else{
-            return null;
-        }
-    }
     showDetails(val){
         if(val.questionDetailList.length > 0){
             return val.questionDetailList.map((item)=>{
@@ -255,7 +239,7 @@ class Inspect extends React.Component {
                 }
             })
         }else{
-            return <td><span className={val.value > val.maxValue || val.value < val.minValue?"red":''}>{val.value}</span> { val.labelSuffix}</td>
+            return <td><span className={(val.maxValue || val.minValue) ? (val.value > val.maxValue || val.value < val.minValue?"red":''):''}>{val.value}</span> { val.labelSuffix}</td>
         }
     }
     render() {
@@ -283,7 +267,7 @@ class Inspect extends React.Component {
                                                                 <td>{value.itemName}</td>
                                                                 <td><span className={value.type == 1?'red':null}>{value.value}</span> {value.unit}</td>
                                                                 <td>
-                                                                    {this.normalVal(value.min,value.max)}
+                                                                    {normalVal(value.min,value.max)}
                                                                 </td>
                                                                 <td>{value.time == ''?('导入时间: '+this.state.dateTime):'化验时间: '+value.time}</td>
                                                             </tr>
@@ -322,7 +306,7 @@ class Inspect extends React.Component {
                                                                 <td>{val.name}</td>
                                                                 {this.showDetails(val)}
                                                                 <td>
-                                                                    {this.normalVal(val.minValue,val.maxValue)}
+                                                                    {normalVal(val.minValue,val.maxValue)}
                                                                 </td>
                                                                 <td>{'化验时间:'+item.time}</td>
                                                             </tr>

+ 3 - 1
src/components/DiagResultSearch/index.less

@@ -4,10 +4,12 @@
     width: 316px;
     margin: 0 10px 10px;
     padding: 0 8px;
-    box-shadow: 0 6px 20px 0 #989DA3;
+    // box-shadow: 0 6px 20px 0 #989DA3;
     background: #fff;
     z-index: 99;
     margin-bottom: 80px;
+    .llStyle;
+    
 }
 .search {
     width: 100%;

+ 37 - 39
src/components/Operation/index.jsx

@@ -6,7 +6,7 @@ import saveHistory from '@common/images/saveHistory.png';
 import PrintPreviewContainer from '@containers/PrintPreviewContainer';
 import PreviewContainer from '@containers/PreviewContainer';
 import { ConfirmModal, Notify } from '@commonComp';
-import {getAllDataList,getAllDataStringList} from '@utils/tools';
+import {getAllDataList,getAllDataStringList,isAllClear} from '@utils/tools';
 import store from '@store';
 
 
@@ -94,7 +94,10 @@ class Operation extends Component {
     }
   }
   clearAll(type) {
-    let flg = this.isClear();
+    let baseList = store.getState();
+    let jsonData = getAllDataList(baseList);
+    let jsonStr = getAllDataStringList(baseList);
+    let flg = isAllClear(jsonData,jsonStr);
     if(flg){
       this.setState({
         type: type,
@@ -106,6 +109,8 @@ class Operation extends Component {
       })
       
       this.props.diagShowTmp(true)
+    }else{
+      Notify.info('当前页面数据已清空');
     }
   }
   isClear(){
@@ -180,51 +185,44 @@ class Operation extends Component {
     let jsonStr = getAllDataStringList(baseList);
     let whichSign = baseList.typeConfig.typeConfig;
     let tmpLis = baseList.tabTemplate.items;
+    // console.log(jsonStr.present,'2222')
     for(let i = 0;i <tmpLis.length;i++){
       let dataStr = tmpLis[i].preview;
       let jsStr = tmpLis[i].dataJson;
-      // console.log(JSON.stringify(JSON.parse(dataStr)))
-      // console.log(JSON.stringify(jsonStr))
-      if(JSON.stringify(JSON.parse(dataStr)) == JSON.stringify(jsonStr) && jsStr == JSON.stringify(jsonData)){
+      // console.log(JSON.stringify(eval('('+JSON.parse(dataStr).chief+')')),111)
+      // if(JSON.stringify(eval('('+JSON.stringify(JSON.parse(dataStr))+')')) == JSON.stringify(jsonStr) && jsStr == JSON.stringify(jsonData)){
+      //   Notify.info('该模板已保存');
+      //   return false;
+      // }
+      if(
+        jsonStr.chief == JSON.stringify(eval('('+JSON.parse(dataStr).chief+')')) && 
+        jsonStr.present == JSON.stringify(eval('('+JSON.parse(dataStr).present+')')) && 
+        jsonStr.other == JSON.stringify(eval('('+JSON.parse(dataStr).other+')')) && 
+        jsonStr.vital == JSON.stringify(eval('('+JSON.parse(dataStr).vital+')'))  &&
+        JSON.stringify(jsonData.chief) == JSON.stringify(JSON.parse(jsStr).chief) &&    
+        JSON.stringify(jsonData.present) == JSON.stringify(JSON.parse(jsStr).present) &&    
+        JSON.stringify(jsonData.other) == JSON.stringify(JSON.parse(jsStr).other) &&      
+        JSON.stringify(jsonData.vital) == JSON.stringify(JSON.parse(jsStr).vital) &&   
+        JSON.stringify(jsonData.lis) == JSON.stringify(JSON.parse(jsStr).lis) &&  
+        JSON.stringify(jsonData.pacs) == JSON.stringify(JSON.parse(jsStr).pacs) &&     
+        JSON.stringify(jsonData.diag) == JSON.stringify(JSON.parse(jsStr).diag) &&    
+        JSON.stringify(jsonData.advice) == JSON.stringify(JSON.parse(jsStr).advice) &&      
+        JSON.stringify(jsonData.mainSuitSelecteds) == JSON.stringify(JSON.parse(jsStr).mainSuitSelecteds) &&      
+        JSON.stringify(jsonData.currentIllSelecteds) == JSON.stringify(JSON.parse(jsStr).currentIllSelecteds) &&     
+        JSON.stringify(jsonData.otherHistorySelecteds) == JSON.stringify(JSON.parse(jsStr).otherHistorySelecteds) && 
+        JSON.stringify(jsonData.checkBodySelecteds) == JSON.stringify(JSON.parse(jsStr).checkBodySelecteds) &&     
+        JSON.stringify(jsonData.addItems) == JSON.stringify(JSON.parse(jsStr).addItems)    
+      ){
         Notify.info('该模板已保存');
         return false;
       }
     }
-    if (whichSign == 0) {
-      if (
-        JSON.stringify(jsonData.advice) == '{}' &&
-        (jsonData.chief.length < 1 && jsonStr.chief == '[]') &&
-        jsonData.diag.length < 1 &&
-        jsonData.vital.length < 1 &&
-        jsonData.other.length < 1 &&
-        jsonData.pacs.length < 1 &&
-        jsonData.present.length < 1 &&
-        jsonData.lis.labelList.length < 1 &&
-        jsonData.lis.getExcelDataList.length < 1
-      ) {
-        Notify.info('模板数据不能为空');
-        return false;
-      }else{
-        return true;
-      }
-    } else if(whichSign == 1) {
-      if (JSON.stringify(jsonData.advice) == '{}' && 
-          jsonStr.chief == '[]' && 
-          jsonStr.present == '[]' && 
-          jsonStr.other == '[]' && 
-          jsonData.vital.length < 1 && 
-          jsonData.diag.length < 1 && 
-          jsonData.pacs.length < 1 && 
-          jsonData.lis.labelList.length < 1 && 
-          jsonData.lis.getExcelDataList.length < 1
-        ) {
-        Notify.info('模板数据不能为空');
-        return false;
-      }else{
-        return true;
-      }
+    let flg = isAllClear(jsonData,jsonStr)
+    if(!flg){
+      Notify.info('模板数据不能为空')
+      return false
     }else{
-      return true;
+      return true
     }
   }
   changeTitle() {

+ 5 - 20
src/components/PreviewBody/index.jsx

@@ -1,5 +1,6 @@
 import React, { Component } from "react";
 import style from "./index.less";
+import { normalVal } from '@utils/tools';
 import $ from "jquery";
 
 (function ($) {
@@ -67,7 +68,6 @@ class PreviewBody extends Component {
             dateTime:"",
         }
         this.$content = React.createRef();
-        this.normalVal = this.normalVal.bind(this);
         this.getCurrentDate = this.getCurrentDate.bind(this);
         this.onPrint = this.onPrint.bind(this);
     }
@@ -94,21 +94,6 @@ class PreviewBody extends Component {
         let date = year+'-'+(mon<10?'0'+mon:mon)+'-'+(day<10?'0'+day:day);
         this.setState({dateTime:date})
     }
-    normalVal(min,max){
-        if((min-0) && (max-0)){
-            return `正常值: (${min}~${max})`
-        }else if((min-0) && !(max-0)){
-            return `正常值: (>=${min})`
-        }else if(!(min-0) && (max-0)){
-            if(min == '' || min == null){
-                return `正常值: (<=${max})`
-            }else{
-                return `正常值: (${min}~${max})`
-            }
-        }else{
-            return null;
-        }
-    }
     showDetails(val){
         if(val.questionDetailList.length > 0){
             return val.questionDetailList.map((item)=>{
@@ -116,8 +101,8 @@ class PreviewBody extends Component {
                     return <td style={{width:'23%'}}><span style={{color:item.abnormal != '0' ?"red":null}}>{val.value}</span> { val.labelSuffix}</td>
                 }
             })
-        }else{
-            return <td style={{width:'23%'}}><span style={{color:val.value > val.maxValue || val.value < val.minValue?"red":null}}>{val.value}</span> { val.labelSuffix}</td>
+        }else{ 
+            return <td style={{width:'23%'}}><span style={{color:(val.maxValue || val.minValue)?(val.value > val.maxValue || val.value < val.minValue?"red":null):null}}>{val.value}</span> { val.labelSuffix}</td>
         }
     }
     render() {
@@ -188,7 +173,7 @@ class PreviewBody extends Component {
                                                             <td style={{width:'25%',fontSize:'12px'}}>{value.itemName}</td>
                                                             <td style={{width:'23%',fontSize:'12px'}}><span style={{fontSize:'12px',color:value.type == 1?"red":null}}>{value.value}</span> {value.unit}</td>
                                                             <td style={{width:'24%',fontSize:'12px'}}>
-                                                                {this.normalVal(value.min,value.max)}
+                                                                {normalVal(value.min,value.max)}
                                                             </td>
                                                             <td style={{width:'28%',fontSize:'12px'}}>{value.time == ''?('导入时间: '+this.state.dateTime):'化验时间: '+value.time}</td>
                                                         </tr>
@@ -211,7 +196,7 @@ class PreviewBody extends Component {
                                                                 {this.showDetails(val)}
                                                                 
                                                                 <td style={{width:'24%'}}>
-                                                                    {this.normalVal(val.minValue,val.maxValue)}
+                                                                    {normalVal(val.minValue,val.maxValue)}
                                                                 </td>
                                                                 <td style={{width:'28%'}}>{'化验时间:'+item.time}</td>
                                                             </tr>

+ 8 - 7
src/components/PushContainer/index.jsx

@@ -46,6 +46,7 @@ class PushContainer extends Component {
         this.handleAllCheckbox=this.handleAllCheckbox.bind(this)
         this.handleMangerTemplate=this.handleMangerTemplate.bind(this)
         this.handleDelList=this.handleDelList.bind(this)
+        this.makeSure=this.makeSure.bind(this)
         this.handleClose = this.handleClose.bind(this);
     }
     componentDidMount(){
@@ -115,7 +116,6 @@ class PushContainer extends Component {
         let e = event?event:window.event;
         if(e.keyCode == 13) {
             this.makeSure()
-            // store.dispatch(changeVisible(false))
         }
     }
     handleInput(e){
@@ -147,14 +147,15 @@ class PushContainer extends Component {
     }
     /**
      * 改变模板标题
-     * @param {模板id和模板title} obj 
+     * @param {模板id和模板title} obj
      */
-    handleTitleChange(obj) {
+    handleTitleChange(id,text) {
         store.dispatch(changeVisible(true))
         this.setState({
             type:3,
-            obj:obj,
-            title:obj.text,
+            currId:id,
+            title:text,
+            text:text,
             okText:'保存',
             okBorderColor:'#3B9ED0',
             okColor:'#fff',
@@ -200,13 +201,13 @@ class PushContainer extends Component {
             store.dispatch(delBatchItem(this.props.checkItems))
             store.dispatch(changeVisible(false))
         }else if(this.state.type == 3){
-            if(this.state.title == this.state.obj.text){
+            if(this.state.title == this.state.text){
                 store.dispatch(changeVisible(false))
                 Notify.success('标题修改成功');
                 return;
             }
             let tempObj = {
-                id:this.state.obj.id,
+                id:this.state.currId,
                 title:this.state.title
             }
             store.dispatch(changeTitleAsync(tempObj))

+ 4 - 7
src/components/TemplateItems/TemplateItem/index.jsx

@@ -74,7 +74,7 @@ class TemplateItem extends React.Component {
                     isOpen: false
                 });
             });
-            console.log($(this.content).parent().siblings().find('.content'))
+            // console.log($(this.content).parent().siblings().find('.content'))
             return;
         }
         $(this.content).slideDown(() => {
@@ -148,12 +148,9 @@ class TemplateItem extends React.Component {
 
     handleEditIconClick(e) {
         e.stopPropagation();
-        const text = $.trim($(`<div>${this.titleDOM.innerHTML}</div>`).text());
-        this.props.handleTitleChange({
-            id: this.props.id,
-            text: text
-        });
-        return true;
+        const text = this.titleDOM.innerHTML;
+        let currId = this.props.id
+        this.props.handleTitleChange(currId,text);
     }
 
     recoverTitle() {

+ 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) { 
+function mapStateToProps(state) {
   const {homePage} = state;
     return {
         data:state.currentIll.data,//主诉模板

+ 0 - 1
src/store/actions/print.js

@@ -30,7 +30,6 @@ export const saveMessage=(state,action)=>{
 
 export const diagShow=(state,action)=>{
   const res=Object.assign({},state);
-  console.log(action)
   res.diagShow = action.data
   return res;
 };

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

@@ -95,8 +95,8 @@ export const getPatientMessage = (dispatch, getState) => {
         confirmType:data1.modeValue
       });
       dispatch(getInitModules);     //确保病人信息获取以后再获取模板等数据,否则参数为空
-      if(state.tabTemplate.items.length == 0){
-        dispatch(initItemList(data1.modeValue));        //模板列表没有就获取模板列表用于保存时做数据对比是否保存过
-      }
+      // if(state.tabTemplate.items.length == 0){
+      //   dispatch(initItemList(data1.modeValue));        //模板列表没有就获取模板列表用于保存时做数据对比是否保存过
+      // }
     })
 };

+ 4 - 4
src/store/reducers/assistCheck.js

@@ -39,7 +39,7 @@ export default (state = initSearchList, action) => {
             }
         }
         for (let j = 0; j < tempArrs.length; j++) {
-            tmpString += (tempArrs[j].name+(tempArrs[j].value?(':'+tempArrs[j].value):'')+(tempArrs[j].time?'报告日期:'+tempArrs[j].time:'')+';')
+            tmpString += (tempArrs[j].name+(tempArrs[j].value?(':'+tempArrs[j].value):'')+(tempArrs[j].time?', 报告日期:'+tempArrs[j].time:'')+';')
         }
         newState.dataString = tmpString
         return newState;
@@ -54,7 +54,7 @@ export default (state = initSearchList, action) => {
             return
         }
         for (let i = 0; i < tempArr.length; i++) {
-            tmpString += (tempArr[i].name+(tempArr[i].value?(':'+tempArr[i].value):'')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
+            tmpString += (tempArr[i].name+(tempArr[i].value?(':'+tempArr[i].value):'')+(tempArr[i].time?', 报告日期:'+tempArr[i].time:'')+';')
         }
         newState.assistLabel = [...tempArr]
         newState.dataString = tmpString
@@ -69,7 +69,7 @@ export default (state = initSearchList, action) => {
                 tempArr[i].value = action.val
                 newState.assistLabel = [...tempArr]
             }
-            tmpString += (tempArr[i].name+(tempArr[i].value?(':'+tempArr[i].value):'')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
+            tmpString += (tempArr[i].name+(tempArr[i].value?(':'+tempArr[i].value):'')+(tempArr[i].time?', 报告日期:'+tempArr[i].time:'')+';')
         }
         newState.dataString = tmpString
         return newState;
@@ -83,7 +83,7 @@ export default (state = initSearchList, action) => {
                 tempArr[i].time = action.date
                 newState.assistLabel = [...tempArr]
             }
-            tmpString += (tempArr[i].name+(tempArr[i].value?(':'+tempArr[i].value):'')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
+            tmpString += (tempArr[i].name+(tempArr[i].value?(':'+tempArr[i].value):'')+(tempArr[i].time?', 报告日期:'+tempArr[i].time:'')+';')
         }
         newState.dataString = tmpString
         return newState;

+ 45 - 2
src/utils/tools.js

@@ -572,7 +572,48 @@ function didPushParamChange(){
   }
   return true;
 }
-
+//判断页面所有数据是否为空
+function isAllClear(jsonData,jsonStr){
+  if (      //结构化和文本数据都为空
+    JSON.stringify(jsonData.advice) == '{}' &&
+    jsonData.chief.length < 1 &&
+    jsonData.present.length < 1 &&
+    jsonData.other.length < 1 &&
+    jsonData.vital.length < 1 &&
+    jsonData.diag.length < 1 &&
+    jsonData.pacs.length < 1 &&
+    jsonData.lis.labelList.length < 1 &&
+    jsonData.lis.getExcelDataList.length < 1 &&
+    JSON.stringify(jsonData.advice) == '{}' &&
+    filterArr(JSON.parse(jsonStr.chief)) == '' &&
+    filterArr(JSON.parse(jsonStr.present)) == '' &&
+    filterArr(JSON.parse(jsonStr.other)) == '' &&
+    filterArr(JSON.parse(jsonStr.vital)) == '' &&
+    jsonData.diag.length < 1 &&
+    jsonData.pacs.length < 1 &&
+    jsonData.lis.labelList.length < 1 &&
+    jsonData.lis.getExcelDataList.length < 1
+  ) {
+    return false;
+  }else{
+    return true;
+  }
+}
+function normalVal(min,max){
+  if((min-0) && (max-0)){
+      return `正常值: (${min}~${max})`
+  }else if((min-0) && !(max-0)){
+      return `正常值: (>=${min})`
+  }else if(!(min-0) && (max-0)){
+      if(min == '' || min == null){
+          return `正常值: (<=${max})`
+      }else{
+          return `正常值: (${min}~${max})`
+      }
+  }else{
+      return null;
+  }
+}
 module.exports = {
     checkType: Type.checkType,
     regexp,
@@ -594,5 +635,7 @@ module.exports = {
     handleEnter,
     didPushParamChange,
     getEMRParams,
-    windowEventHandler
+    windowEventHandler,
+    isAllClear,
+    normalVal
 };