Browse Source

预览打印末尾句号

zhouna 5 years ago
parent
commit
32c66c4a6b

+ 4 - 1
src/components/PreviewBody/ItemPart/index.jsx

@@ -2,7 +2,10 @@ import style from "../index.less";
 import { filterDataArr } from '@utils/tools';
 
 const ItemPart = (props) => {
-  const {dataStr,title,type,dataJson,other_yjs} = props;
+  let {dataStr,title,type,dataJson,other_yjs,lastDot} = props;
+  if(lastDot){
+    dataStr=dataStr.trim().replace(/;$/g,'。');
+  }
   return <tr className={style['patInfoFst']}>
     <td className={style['patInfoSec']}>{title}</td>
     {

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

@@ -103,7 +103,7 @@ class PreviewBody extends Component {
           <ItemPart dataStr={dataStr.vital} title={'查体:'} type={1}></ItemPart>
           <PreviewInspect dataJson={come?dataJson.lis:lis_data} toTime={this.toTime} dateTime={this.state.dateTime} showDetails={this.showDetails}></PreviewInspect>
           <ItemPart dataStr={dataStr.pacs} title={'辅检:'} type={2}></ItemPart>
-          <ItemPart dataStr={dataStr.diag} title={'诊断:'} type={2}></ItemPart>
+          <ItemPart dataStr={dataStr.diag} title={'诊断:'} type={2} lastDot={true}></ItemPart>
           <tr className={style['patInfoFst']}>
             <td className={style['patInfoSec']}>医嘱:</td>
             <td className={`${style['patInfoSec']} ${style['pushMessage']} ${style['font14']}`}>

+ 2 - 1
src/utils/tools.js

@@ -545,9 +545,10 @@ function filterOtherDataArr(arrTmp,jsonArr){
 }
 //去掉开头的标点符号,最后的标点保留第一个,中间连续的保留第一个
 function trimDots(str){
+  if(!str)return'' ;
   return str.replace(config.punReg,function(word){
     return word.substr(0,1);
-  }).replace(/^[,,.。::"“??”;;、!!\s]+/,'');
+  }).replace(/^[,,.。::"“??”;;、!!\s]+/,'').replace(/[,,.。::"“??”;;、!!\s]*$/,'。');
 }
 
 //标签间连续标点只保留一个,保留前面一个