Bladeren bron

merge from 'origin'

zhangxc 6 jaren geleden
bovenliggende
commit
dc8ae8dec8

+ 5 - 2
src/common/components/ComplexModal/index.jsx

@@ -14,10 +14,12 @@ import close from '@common/images/icon_close.png';
  *height:弹窗的高度
  * **/
 
+
 class ComplexModal extends Component {
   constructor(props) {
-    super(props)
+    super(props);
   }
+
   render() {
     const { onclose,title,children,footer,shadeClose,icon,width,top,bottom} = this.props;
     const marginLeft = width? -parseInt(width)/2 : '';
@@ -25,12 +27,13 @@ class ComplexModal extends Component {
     const domNode = document.getElementById('root');
     return ReactDom.createPortal(<div className={style['container']}>
       <div className={style['shade']} onClick={shadeClose===false?'':onclose}></div>
-      <div className={style['modal']} style = {{width: width?width:'auto', marginLeft:marginLeft, top:top?top+'px':'',bottom:bottom?bottom+'px':''}}>
+      <div className={style['modal']} style={{width: width?width:'auto', marginLeft:marginLeft, top:top?top+'px':'',bottom:bottom?bottom+'px':''}}>
         <div className={style['close']}>
           {icon?<img src={icon} />:''}
           {title}
           <img src={close} onClick={onclose} className={style['closeIcon']} />
         </div>
+        <i className={style['flg']}>患者基本信息</i>
         <div className={style["content"]} style = {{width: width?width:'auto'}}>{children}</div>
         <div className={style['footer']} style = {{width: width?width:'auto'}}>{footer}</div>
       </div>

+ 11 - 5
src/common/components/ComplexModal/index.less

@@ -14,11 +14,17 @@
     bottom:30px;
     text-align: right;
   }
-  /*@media print {
-    .shade{
-      display: none;
-    }
-  }*/
+  // @media print {
+  //   .close{
+  //     display: none;
+  //   }
+  //   .flg {
+  //     display: block !important;
+  //   }
+  // }
+  .flg {
+    display: none;
+  }
   .shade {
     position: fixed;
     left: 0;

+ 1 - 1
src/common/js/func.js

@@ -96,7 +96,7 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
       value = '',
       item={},
       checkHiddenDefault=false;
-  arr.map((it,i)=>{
+  arr&&arr.map((it,i)=>{
     notText = notTextLabel(it);
     value = it.value||'';
     textLabel = !ifEmpty&&i==0?Object.assign({},JSON.parse(config.textLabel),{showInCheck:true}):JSON.parse(config.textLabel);

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

@@ -55,7 +55,7 @@ class AddAssistCheck extends React.Component {
     $(document).click((event) => {
       let _con = $('#searchWrapAssist');   // 设置目标区域
       let _cons = $('#datePick');   // 设置目标区域
-      if (searchWrapAssist != event.target && !_con.is(event.target) && _con.has(event.target).length === 0) { // Mark 1
+      if (_con && searchWrapAssist != event.target && !_con.is(event.target) && _con.has(event.target).length === 0) { // Mark 1
         this.setState({ show: false });
       }
       if (!_cons.is(event.target) && _cons.has(event.target).length === 0) { // Mark 1

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

@@ -241,7 +241,7 @@ class Inspect extends React.Component {
         list && list.map((item, idx) => {
           return <li key={idx}
             className={styles.searchLi}
-            title={item.name}
+            title={item.name == item.retrievalName ? item.name : item.name + '(' + item.retrievalName + ')'}
             onClick={() => {
               handleSign(item.questionId, idx,'search');
               this.setState({ show: false })

+ 40 - 35
src/components/AssessResult/index.jsx

@@ -1,80 +1,85 @@
 import React, { Component } from "react";
 import style from "./index.less";
-import { Radio} from '@commonComp';
+import { Radio } from '@commonComp';
 import Notify from '@commonComp/Notify';
 import ChooseItem from "./ChooseItem";
 import ScaleItem from "./ScaleItem";
+import Information from '../Information'
 import ChartItem from "./ChartItem";
+import $ from "jquery";
 
 class AssessResult extends Component {
   constructor(props) {
     super(props);
-    this.state={
-      chooseSelecteds:{},     //大数据选择模块
-      chartTimeTypes:{},      //图表模块
-      wholeAssessItems:props.wholeIndexs,     //整体评估模块
-      wholeAssessText:props.wholeText||''     //整体评估补充说明
+    this.state = {
+      chooseSelecteds: {},     //大数据选择模块
+      chartTimeTypes: {},      //图表模块
+      wholeAssessItems: props.wholeIndexs,     //整体评估模块
+      wholeAssessText: props.wholeText || ''     //整体评估补充说明
     }
     this.handleChooseChange = this.handleChooseChange.bind(this);
     this.handleScaleDel = this.handleScaleDel.bind(this);
     this.handleScaleText = this.handleScaleText.bind(this);
   }
-  componentWillMount(){
+  componentWillMount() {
     //获取评估
     this.props.getAssess();
   }
-  handleScaleText(text){
-      this.setState({
-        wholeAssessText:text
-      })
+  handleScaleText(text) {
+    this.setState({
+      wholeAssessText: text
+    })
   }
-  handleScaleDel(i,j){
-    const items = Object.assign({},this.state.wholeAssessItems);
-    const inx = items[i].findIndex(x=>x==j);
-    items[i].splice(inx,1);
+  handleScaleDel(i, j) {
+    const items = Object.assign({}, this.state.wholeAssessItems);
+    const inx = items[i].findIndex(x => x == j);
+    items[i].splice(inx, 1);
     this.setState({
       wholeAssessItems: items
     });
   }
-  handleChooseChange(i,selects){
-    const {chooseSelecteds} = this.state;
+  handleChooseChange(i, selects) {
+    const { chooseSelecteds } = this.state;
     this.setState({
-      chooseSelecteds: Object.assign(chooseSelecteds,{[i]:selects})
+      chooseSelecteds: Object.assign(chooseSelecteds, { [i]: selects })
     });
   }
-  handleChartChange(i,selects){
-    const {chartTimeTypes} = this.state;
+  handleChartChange(i, selects) {
+    const { chartTimeTypes } = this.state;
     this.setState({
-      chartTimeTypes:Object.assign(chartTimeTypes,{[i]:selects})
+      chartTimeTypes: Object.assign(chartTimeTypes, { [i]: selects })
     });
   }
-  componentWillUnmount(){
+  componentWillUnmount() {
     //点确定关闭弹窗时把参数传到父组件去
-    const {handleSave,isAssessConfirm} = this.props;
-    isAssessConfirm&&handleSave(this.state);
+    const { handleSave, isAssessConfirm } = this.props;
+    isAssessConfirm && handleSave(this.state);
   }
-  handoutTypes(item,i){
-    const {getIndexData,indexData,timeTypes,wholeAssessData,wholeIndexs} =this.props;
+  handoutTypes(item, i) {
+    const { getIndexData, indexData, timeTypes, wholeAssessData, wholeIndexs } = this.props;
     //console.log(indexData)
     const chartData = indexData;
-    const name = item.regionName+":";
-    const list = item.data&&item.data.rows;
-    switch (+item.regionType){
+    const name = item.regionName + ":";
+    const list = item.data && item.data.rows;
+    switch (+item.regionType) {
       case 0:     //数据来源与右侧手动添加
         return <ScaleItem title={name} data={wholeAssessData} handleRemove={this.handleScaleDel} handleInp={this.handleScaleText} indexs={this.state.wholeAssessItems}></ScaleItem>;
       case 1:     //数据来源于大数据
-        return <ChooseItem title={name} data={list} handleChange={this.handleChooseChange.bind(this,i)}></ChooseItem>;
+        return <ChooseItem title={name} data={list} handleChange={this.handleChooseChange.bind(this, i)}></ChooseItem>;
       case 10:    //数据来源于后台
-        return <ChartItem title={name} data={chartData||{}} timeTypes={timeTypes} initFn={getIndexData} handleChange={this.handleChartChange.bind(this,i)}></ChartItem>;
+        return <ChartItem title={name} data={chartData || {}} timeTypes={timeTypes} initFn={getIndexData} handleChange={this.handleChartChange.bind(this, i)}></ChartItem>;
       default:
         return '';
     }
   }
   render() {
-    const { onClose,data } = this.props;
-    return <div className={style['assess-cont']}>
-      {data&&data.map((it,i)=>{
-        return this.handoutTypes(it,i);
+    const { onClose, data } = this.props;
+    return <div className={style['assess-cont']} id="AssistResult">
+      <div className={style['printShow']}>
+        <Information></Information>
+      </div> 
+      {data && data.map((it, i) => {
+        return this.handoutTypes(it, i);
       })}
     </div>;
   }

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

@@ -89,4 +89,12 @@
       }
     }
   }
+}
+.printShow {
+  display: none;
+}
+@media print {
+  .printShow {
+    display: block;
+  }
 }

File diff suppressed because it is too large
+ 23 - 4
src/components/ChronicInfo/index.jsx


+ 41 - 0
src/components/Information/index.jsx

@@ -0,0 +1,41 @@
+import React, { Component } from "react";
+import style from "./index.less";
+import store from "@store";
+import $ from "jquery";
+
+
+class Information extends Component {
+  constructor(props) {
+    super(props)
+    this.$content = React.createRef();
+  }
+
+  componentWillReceiveProps() {
+    $(this.$content.current)[0].scrollIntoView(true);
+  }
+  render() {
+    const { baseObj } = this.props;
+    let baseData = store.getState()
+    let preInfo = baseData.patInfo.message;
+    const noData = JSON.stringify(preInfo) == '{}';
+    return <div className={style['information']}>
+        <div ref={this.$content} className={style['title']}>{preInfo.hospitalName}</div>
+        <table className={style['patInfo']}>
+          <tr>
+            <td>卡号:{baseObj ? baseObj.patientIdNo : noData ? '' : preInfo.patientIdNo}</td>
+            <td>姓名:{baseObj ? baseObj.patientName : noData ? '' : preInfo.patientName}</td>
+            <td>年龄:{baseObj ? baseObj.patientAge : noData ? '' : preInfo.patientAge}</td>
+            <td>性别:{baseObj ? baseObj.patientSex : noData ? '' : preInfo.patientSex}</td>
+          </tr>
+          <tr>
+            <td>就诊时间:{baseObj ? baseObj.inquiryDate : (noData ? '' : preInfo.systemTime.split(' ')[0])}</td>
+            <td>科室:{baseObj ? baseObj.hospitalDeptName : (noData ? '' : preInfo.hospitalDeptName)}</td>
+            <td>医生:{baseObj ? baseObj.doctorName : (noData ? '' : preInfo.doctorName)}</td>
+            <td>门诊号:{baseObj ? baseObj.inquiryCode : (noData ? '' : preInfo.recordId)}</td>
+          </tr>
+        </table>
+      </div>
+  }
+}
+
+export default Information;

+ 17 - 0
src/components/Information/index.less

@@ -0,0 +1,17 @@
+.title {
+  clear: both;
+  font-size: 24px;
+  margin-bottom: 30px;
+  text-align:center;
+}
+.patInfo {
+  margin: 0px 0px 30px 0px;
+  td {
+    border: 1px solid #aaa;
+    padding: 8px 10px;
+    font-size: 14px;
+  }
+  tr td:first-child{
+    width: 31%;
+  }
+}

+ 28 - 109
src/components/PreviewBody/index.jsx

@@ -2,65 +2,11 @@ import React, { Component } from "react";
 import style from "./index.less";
 import { normalVal, filterDataArr, filterOtherDataArr,timestampToTime } from '@utils/tools';
 import Notify from '@commonComp/Notify';
+import Information from '../Information';
 import $ from "jquery";
 import arrow from '@common/images/icon_tri_blue.png';
 
-(function ($) {
-  var opt;
-
-  $.fn.jqprint = function (options) {
-    opt = $.extend({}, $.fn.jqprint.defaults, options);
-
-    var $element = (this instanceof $) ? this : $(this);
-
-    if (opt.operaSupport && $.browser.opera) {
-      var tab = window.open("", "jqPrint-preview");
-      tab.document.open();
-
-      var doc = tab.document;
-    }
-    else {
-      var $iframe = $("<iframe  />");
-
-      if (!opt.debug) { $iframe.css({ position: "absolute", width: "0px", height: "0px", left: "-300px", top: "-300px" }); }
-
-      $iframe.appendTo("body");
-      var doc = $iframe[0].contentWindow.document;
-    }
-
-    if (opt.importCSS) {
-      if ($("link[media=print]").length > 0) {
-        $("link[media=print]").each(function () {
-          doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' media='print' />");
-        });
-      }
-      else {
-        $("link").each(function () {
-          doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' />");
-        });
-      }
-    }
-
-    if (opt.printContainer) { doc.write($element.outer()); }
-    else { $element.each(function () { doc.write($(this).html()); }); }
-
-    doc.close();
-
-    (opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).focus();
-    setTimeout(function () { (opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).print(); if (tab) { tab.close(); } }, 1000);
-  }
-
-  $.fn.jqprint.defaults = {
-    debug: false,
-    importCSS: true,
-    printContainer: true,
-    operaSupport: true
-  };
-
-  $.fn.outer = function () {
-    return $($('<div></div>').html(this.clone())).html();
-  }
-})($);
+// import "@utils/jqprint";
 
 class PreviewBody extends Component {
   constructor(props) {
@@ -68,16 +14,12 @@ class PreviewBody extends Component {
     this.state = {
       dateTime: "",
     }
-    this.$content = React.createRef();
     this.getCurrentDate = this.getCurrentDate.bind(this);
     this.onPrint = this.onPrint.bind(this);
   }
   componentDidMount() {
     this.getCurrentDate();
   }
-  componentWillReceiveProps() {
-    $(this.$content.current)[0].scrollIntoView(true);
-  }
   onPrint() {
     $("#content").jqprint({
       debug: false,
@@ -99,16 +41,6 @@ class PreviewBody extends Component {
       this.onPrint();
       this.props.save(true)
     }
-    // if(filterDataArr(JSON.parse(jsonStr.chief)) == ''){
-    //   Notify.info('主诉不能为空');
-    //     return false;
-    // }else if(!jsonStr.diag || jsonStr.diag.trim().length < 1){
-    //     Notify.info('诊断不能为空');
-    //     return false;
-    // }else{
-    //     this.onPrint();
-    //     this.props.save(true)
-    // }
   }
   getCurrentDate() {
     let myDate = new Date();
@@ -144,45 +76,32 @@ class PreviewBody extends Component {
   }
   render() {
     const { show, preInfo, dataJson, dataStr, baseObj, flg } = this.props;
+    console.log(dataJson)
     const other_yjs = filterOtherDataArr(JSON.parse(dataStr.other),dataJson.other);
     const noData = JSON.stringify(preInfo) == '{}';
     return <div className={style['content']} style={{ width: flg ? '700' : '820' }}>
       <div className={style['contents']} id="content" style={{ margin: "0 auto", maxWidth: "600px" }}>
-        <div ref={this.$content} style={{ clear: 'both', fontSize: '24px', margin: '0px 0px 30px 0px', textAlign: 'center' }}>{preInfo.hospitalName}</div>
-        <table className={style['patInfo']}>
-          <tr>
-            <td>卡号:{baseObj ? baseObj.patientIdNo : noData ? '' : preInfo.patientIdNo}</td>
-            <td>姓名:{baseObj ? baseObj.patientName : noData ? '' : preInfo.patientName}</td>
-            <td>年龄:{baseObj ? baseObj.patientAge : noData ? '' : preInfo.patientAge}</td>
-            <td>性别:{baseObj ? baseObj.patientSex : noData ? '' : preInfo.patientSex}</td>
-          </tr>
-          <tr>
-            <td>就诊时间:{baseObj ? baseObj.inquiryDate : (noData ? '' : preInfo.systemTime.split(' ')[0])}</td>
-            <td>科室:{baseObj ? baseObj.hospitalDeptName : (noData ? '' : preInfo.hospitalDeptName)}</td>
-            <td>医生:{baseObj ? baseObj.doctorName : (noData ? '' : preInfo.doctorName)}</td>
-            <td>门诊号:{baseObj ? baseObj.inquiryCode : (noData ? '' : preInfo.recordId)}</td>
-          </tr>
-        </table>
+        <Information baseObj={baseObj} preInfo={preInfo}></Information>
         <table className={style['infos']}>
-          <tr>
-            <td>主诉:</td>
-            <td>
+          <tr className={style['patInfoFst']}>
+            <td className={style['patInfoSec']}>主诉:</td>
+            <td className={style['patInfoSec']}>
               {
                 filterDataArr(JSON.parse(dataStr.chief))
               }
             </td>
           </tr>
-          <tr>
-            <td>现病史:</td>
-            <td>
+          <tr className={style['patInfoFst']}>
+            <td className={style['patInfoSec']}>现病史:</td>
+            <td className={style['patInfoSec']}>
               {
                 filterDataArr(JSON.parse(dataStr.present))
               }
             </td>
           </tr>
-          <tr>
-            <td>其他史:</td>
-            <td>
+          <tr className={style['patInfoFst']}>
+            <td className={style['patInfoSec']}>其他史:</td>
+            <td className={style['patInfoSec']}>
               {
                 other_yjs.str1
               }
@@ -202,17 +121,17 @@ class PreviewBody extends Component {
               }
             </td>
           </tr>
-          <tr>
-            <td>查体:</td>
-            <td>
+          <tr className={style['patInfoFst']}>
+            <td className={style['patInfoSec']}>查体:</td>
+            <td className={style['patInfoSec']}>
               {
                 filterDataArr(JSON.parse(dataStr.vital))
               }
             </td>
           </tr>
-          <tr>
-            <td>化验:</td>
-            <td>
+          <tr className={style['patInfoFst']}>
+            <td className={style['patInfoSec']}>化验:</td>
+            <td className={style['patInfoSec']}>
               {
                 dataJson.lis.getExcelDataList && dataJson.lis.getExcelDataList.map((items) => {
                   return items.lisExcelRes && items.lisExcelRes.map((item) => {
@@ -263,9 +182,9 @@ class PreviewBody extends Component {
               }
             </td>
           </tr>
-          <tr>
-            <td>辅检:</td>
-            <td>
+          <tr className={style['patInfoFst']}>
+            <td className={style['patInfoSec']}>辅检:</td>
+            <td className={style['patInfoSec']}>
               {
                 dataStr.pacs && dataStr.pacs != '' && dataStr.pacs.split(';').map((item) => {
                   return <div style={{ fontSize: '14px',wordBreak:"break-all" }}>{item}</div>
@@ -273,9 +192,9 @@ class PreviewBody extends Component {
               }
             </td>
           </tr>
-          <tr>
-            <td>诊断:</td>
-            <td>
+          <tr className={style['patInfoFst']}>
+            <td className={style['patInfoSec']}>诊断:</td>
+            <td className={style['patInfoSec']}>
               {
                 dataStr.diag && dataStr.diag != '' && dataStr.diag.split(';').map((item) => {
                   return <div style={{ fontSize: '14px' }}>{item}</div>
@@ -283,9 +202,9 @@ class PreviewBody extends Component {
               }
             </td>
           </tr>
-          <tr>
-            <td>医嘱:</td>
-            <td style={{ fontSize: '14px', padding: '1px 0px 8px 0px', lineHeight: '20px' }}>
+          <tr className={style['patInfoFst']}>
+            <td className={style['patInfoSec']}>医嘱:</td>
+            <td className={style['patInfoSec']} style={{ fontSize: '14px', padding: '1px 0px 8px 0px', lineHeight: '20px' }}>
               {dataJson.advice.commontreatment && dataJson.advice.commontreatment.length > 0 && <p style={{ fontSize: '14px', marginBottom: '8px', marginTop: '8px' }}><span>一般治疗</span></p>}
               {
                 dataJson.advice.commontreatment && <div style={{ padding: '0px 0px 5px 0px',wordBreak:"break-all" }}>{dataJson.advice.commontreatment}</div>

+ 9 - 4
src/components/PreviewBody/index.less

@@ -16,19 +16,24 @@ table{
   width: 100%;
 }
 .infos{
-  &>tr{
+  .patInfoFst{
     vertical-align: top;
     border-bottom: 1px solid #e2e4e6;
   }
-  &>tr>td{
+  .patInfoFst .patInfoSec{
     padding: 9px 5px 8px 0px;
     line-height: 20px;
   }
-  &>tr>td:first-child {
-    text-align: right;
+  .patInfoFst .patInfoSec:first-child{
+    text-align: right;    
     width: 70px;
     font-size: 14px;
   }
+  &>tr>td:first-child {//打印样式需要改
+    // text-align: right;
+    // width: 70px;
+    // font-size: 14px;
+  }
 }
 .patInfo {
   margin: 0px 0px 30px 0px;

+ 8 - 10
src/components/PrintPreview/index.jsx

@@ -33,16 +33,14 @@ class PrintPreview extends Component {
             <div className={style['shade']} onClick={onClose}></div>
             <div className={style['modal']}>
                 <div className={style['close']}>打印<img src={close} onClick={onClose} /></div>
-                {/* <div id="content"> */}
-                    <PreviewBody
-                        preInfo={preInfo}
-                        dataJson={dataJson}
-                        dataStr={dataStr}
-                        show={true}
-                        onClose={onClose}
-                        save={save}
-                    ></PreviewBody>
-                {/* </div> */}
+                  <PreviewBody
+                      preInfo={preInfo}
+                      dataJson={dataJson}
+                      dataStr={dataStr}
+                      show={true}
+                      onClose={onClose}
+                      save={save}
+                  ></PreviewBody>
             </div>
         </div>
     }

+ 2 - 17
src/components/PushItems/index.jsx

@@ -14,7 +14,7 @@ import store from "@store";
 import { getWindowInnerHeight } from "@common/js/func";
 import {addLabel} from '@store/actions/inspect';
 import {addAssistLabel} from '@store/actions/assistCheck';
-import {windowEventHandler} from '@utils/tools'
+import {windowEventHandler,getCurrentDate} from '@utils/tools'
 import {ConfirmModal} from '@commonComp';
 import ChronicInfo from '@containers/ChronicInfo';//慢病推送模块
 
@@ -51,27 +51,12 @@ class PushItems extends Component {
       showAssess:!this.state.showAssess
     });
   }
-  getCurrentDate(){
-    let myDate = new Date();
-    let year = myDate.getFullYear();       //获取完整的年份(4位,1970-????)
-    let mon = myDate.getMonth()-0+1;       //获取当前月份(0-11,0代表1月)
-    let day = myDate.getDate();            //获取当前日(1-31)
-    let date = year+'-'+(mon<10?'0'+mon:mon)+'-'+(day<10?'0'+day:day);
-    return date;
-  }
 
   billing() {
     const { assay, check } = this.props.pushMessage;
     const checkedAssay = assay.filter(item => item.checked);
     const checkedCheck = check.filter(item => item.checked);
     this.props.billing(checkedAssay, checkedCheck);
-    // if(checkedAssay.length > 0 || checkedCheck.length > 0) {
-    //   const Height = $(".src-components-BodyContainer-2SgEx").height();
-    //   const adviceHeight = $(".src-common-components-ItemBox-1Bpz3").height();
-    //   const winHeight = window.innerHeight;
-    //   const scrollTop = Height;
-    //   $('#addScrollEvent').scrollTop(100000)
-    // }
     let obj = {   //添加化验
       details: [],
       name: '',
@@ -82,7 +67,7 @@ class PushItems extends Component {
       name: '',
       questionId: '',
       showType: 1,
-      time:this.getCurrentDate(),
+      time:getCurrentDate(),
       value:''
     }
     if(checkedAssay.length > 0){

+ 5 - 2
src/components/ScaleTable/index.jsx

@@ -1,7 +1,7 @@
 import React from 'react';
 import style from './index.less';
 import mocks from '../../mock/chronicTable.js'
- 
+import Information from '../Information'
 /**
 *量表 具体信息页面
 *title:量表标题
@@ -24,7 +24,10 @@ class ScaleTable extends React.Component{
     const footContent = data && data[2].content; //表后文字
     const datas = content && JSON.parse(content);
 
-    return <div className={style['tableBox']}>
+    return <div className={style['tableBox']} id="printcontent">
+            <div className={style['printShow']}>
+              <Information></Information>
+            </div> 
             <h1>{title}</h1>
             <div dangerouslySetInnerHTML={{__html:preContent}} className={style['textlh']}></div>
             <table className={style['table']}>

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

@@ -44,4 +44,12 @@ strong{
   p{
     line-height: 22px;
   }
+}
+.printShow {
+  display: none;
+}
+@media print {
+  .printShow {
+    display: block;
+  }
 }

+ 1 - 1
src/containers/AssessResult.js

@@ -17,7 +17,7 @@ import store from '@store';
  *
  * ***/
 
-function mapStateToProps(state) {console.log(state)
+function mapStateToProps(state) {//console.log(state)
   const {assessResult} = state;
   return {
     data:assessResult.data,

+ 1 - 1
src/containers/AssistCheck.js

@@ -8,7 +8,7 @@ import { getSearchList,getInstroduce } from '@store/async-actions/assistCheck';
 import {ISREAD} from '@store/types/homePage.js';
 import {billing} from '@store/async-actions/pushMessage';
 
-function mapStateToProps(state) {//console.log(state.assistCheck)
+function mapStateToProps(state) {//console.log(state)
     return {
         list:state.assistCheck.list,
         assistLabel:state.assistCheck.assistLabel,

+ 2 - 1
src/containers/MainSuit.js

@@ -8,7 +8,7 @@ import {SET_MAIN_SUIT} from '@store/types/fillInfo';
 import {CLEAR_DIAGNOSE} from '@store/types/diagnosticList';
 import {getSearch,getFeature,setOtherHisModule} from '@store/async-actions/fetchModules';
 import {billing} from '@store/async-actions/pushMessage';
-import {didPushParamChange,filterDataArr} from '@utils/tools.js';
+import {didPushParamChange,filterDataArr,inspectAndAssist} from '@utils/tools.js';
 import config from '@config/index.js';
 import {Notify} from '@commonComp';
 import {getInitModules} from '@store/async-actions/homePage.js';
@@ -216,6 +216,7 @@ function mapDispatchToProps(dispatch) {
       autoFillMoudles() {//自动填充模板
         dispatch({type: CURRENT_CHRONIC})//现病史
         //其他史模板填充-先去历史,无历史用模板
+        inspectAndAssist()//化验辅检
         dispatch(setOtherHisModule());
         //查体模板填充
         dispatch((dispatch, getStore) => {

+ 1 - 0
src/main.js

@@ -7,6 +7,7 @@ import store from './store';
 import {AppContainer} from 'react-hot-loader';
 import HomePage from './modules/HomePage';
 import $ from 'jquery';
+import "@utils/jqPrint";
 
 const render = (Component) => {
   //ie8 console兼容

+ 6 - 1
src/store/async-actions/historyTemplates.js

@@ -7,7 +7,12 @@ export const initItemList = (item) => {
     let baseList = store.getState();
     // let whichSign = baseList.typeConfig.typeConfig;
     let state = baseList.patInfo.message;
-    const param = item?{"hospitalId": state.hospitalId,"patientId": state.patientId,"disName":item.name,"disType":1}:{"hospitalId": state.hospitalId,"patientId": state.patientId};
+    const param = {
+      "hospitalId": state.hospitalId,
+      "patientId": state.patientId,
+      "disName":item?item.name : 'bbb',
+      "disType":item?1:0
+    }
     return (dispatch) => {
         axios.json('/inquiryInfo/hisInquirys',param).then((res)=>{
             const data =res.data;

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

@@ -31,6 +31,7 @@ function modulesParseJson(data){
 export const getInitModules= (dispatch,getStore)=>{
   const state = getStore();
   const {message} = state.patInfo;
+  const {allModules} = state.homePage;
   // const chronicMagItem = state.diagnosticList.chronicMagItem;
   // const chronicId = chronicMagItem?chronicMagItem.id:'';//诊断为慢病复诊时储存慢病信息到store
   const chronicMagItem = state.mainSuit.chronicDesease;
@@ -40,10 +41,11 @@ export const getInitModules= (dispatch,getStore)=>{
     sexType:message.sex,
     mouduleType:chronicId?2:(message.hospitalDeptId?1:0),//慢病2  科室1 其他0
     relationId:chronicId?chronicId:(message.hospitalDeptId?message.hospitalDeptId:0), //慢病id  科室id  其他0
+    // mouduleType:2,
+    // relationId:21773, //慢病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);
         const initData = newObj.json;

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

@@ -21,7 +21,6 @@ export const initPersonInfo = (dispatch, getState) => {
         const data = res.data;
         if (data.code == 0) {
             dispatch(getInfos(data.data));
-            //console.log(data.data)
             getPatientMessage(dispatch, getState);
         } else {
             console.log(res)
@@ -98,9 +97,10 @@ export const getPatientMessage = (dispatch, getState) => {
         type: CONFIRM_TYPE,
         confirmType:data1.modeValue
       });
-      dispatch(getInitModules);     //确保病人信息获取以后再获取模板等数据,否则参数为空
+      dispatch(getInitModules);       //确保病人信息获取以后再获取模板等数据,否则参数为空
       dispatch(getCommonList(5));     //获取常用化验标签列表
-      dispatch(getCommonList(6));     //获取常用辅检标签列表
+      dispatch(getCommonList(6));     //获取常用辅检标签列表if(allModules.length == 0){//模板为空才回读
+      dispatch(initHistoryDetails());      //历史病历回读
       // if(state.tabTemplate.items.length == 0){
       //   dispatch(initItemList(data1.modeValue));        //模板列表没有就获取模板列表用于保存时做数据对比是否保存过
       // }

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

@@ -21,7 +21,8 @@ export const billing = (mdata) => {
   const emrData = getEMRParams();
   const params = {
     age: emrData.age,
-    featureType: "4,5,6,7,22",
+    // featureType: "4,5,6,7,22",
+    featureType: "22",
     diag: emrData.dis,
     lis: emrData.lis,
     other: emrData.other,

+ 69 - 0
src/utils/jqprint.js

@@ -0,0 +1,69 @@
+import $ from 'jquery';
+
+(function ($) {
+  var opt;
+  $.fn.jqprint = function (options) {
+    opt = $.extend({}, $.fn.jqprint.defaults, options);
+    var $element = (this instanceof $) ? this : $(this);
+    if (opt.operaSupport && $.browser.opera) {
+      var tab = window.open("", "jqPrint-preview");
+      tab.document.open();
+      var doc = tab.document;
+    }else {
+      var $iframe = $("<iframe  />");
+      if (!opt.debug) { $iframe.css({ position: "absolute", width: "0px", height: "0px", left: "-300px", top: "-300px" }); }
+      $iframe.appendTo("body");
+      var doc = $iframe[0].contentWindow.document;
+    }
+
+    if (opt.importCSS) {
+      doc.write('<!DOCTYPE html>');
+
+      $("style").each(function () {//获取内联样式放到iframe中
+        doc.write('<style type="text/css" rel="stylesheet" media="print" >' + $(this)[0].textContent + '</style>');
+      });
+
+      if ($("link[media=print]").length > 0) {//外联样式获取
+        $("link[media=print]").each(function () {
+          doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' media='print' />");
+        });
+      }
+      else {
+        $("link").each(function () {
+          doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' />");
+        });
+      }
+    }
+
+    var canvasLis = $(this).find('canvas');//页面有canvas需要转换为图片
+    if (!canvasLis) {
+      return
+    } else {
+      $("img").remove('.canvasImg')//删除已添加的图片避免多张图片重叠
+      for (var k = 0; k < canvasLis.length; k++) {
+        var canvasSrc = canvasLis[k].toDataURL();
+        let canvasImg = "<img class='canvasImg' src='" + canvasSrc + "'>"
+        $(canvasLis[k]).parent().append(canvasImg)
+      }
+    }
+
+    if (opt.printContainer) { doc.write($element.outer()); }
+    else { $element.each(function () { doc.write($(this).html()); }); }
+
+    doc.close();
+
+    (opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).focus();
+    setTimeout(function () { (opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).print(); if (tab) { tab.close(); } }, 500);
+  }
+
+  $.fn.jqprint.defaults = {
+    debug: false,
+    importCSS: true,
+    printContainer: true,
+    operaSupport: true
+  };
+
+  $.fn.outer = function () {
+    return $($('<div></div>').html(this.clone())).html();
+  }
+})($);

+ 65 - 2
src/utils/tools.js

@@ -3,8 +3,8 @@ import {CLEAR_MAIN_SUIT} from '@store/types/mainSuit';
 import {CLEAR_CURRENT_ILL} from '@store/types/currentIll';
 import {CLEAROTHERHISTORY} from '@store/types/otherHistory';
 import {CLEARCHECKBODY} from '@store/types/checkBody';
-import {clearAssistData} from '@store/actions/assistCheck';
-import {clearAllLabel} from '@store/actions/inspect';
+import {clearAssistData,addAssistLabel} from '@store/actions/assistCheck';
+import {clearAllLabel,addLabel} from '@store/actions/inspect';
 import {CLEAR_ALL_DIAG} from '@store/types/diagnosticList';
 import {CLEAR_ALL_PUSH_MESSAGE, SET_TIPS} from '@store/types/pushMessage';
 import {ISREAD, SETREADDITEMS} from "../store/types/homePage";
@@ -835,6 +835,67 @@ function dragBox(domWrap,domDrag){
 // function handleMove(event,mouseX){
 //     console.log(event)
 // }
+function getCurrentDate(){
+  let myDate = new Date();
+  let year = myDate.getFullYear();       //获取完整的年份(4位,1970-????)
+  let mon = myDate.getMonth()-0+1;       //获取当前月份(0-11,0代表1月)
+  let day = myDate.getDate();            //获取当前日(1-31)
+  let date = year+'-'+(mon<10?'0'+mon:mon)+'-'+(day<10?'0'+day:day);
+  return date;
+}
+function inspectAndAssist(){
+  let obj = {   //添加化验
+    details: [],
+    name: '',
+    questionId: '',
+    showType: 1,
+  }
+  let obj1 = {  //添加辅检
+    name: '',
+    questionId: '',
+    showType: 1,
+    time:getCurrentDate(),
+    value:''
+  }
+  const state = store.getState();
+  let tmpAll = state.homePage.allModules;
+  let tmpInspected = state.inspect.labelList;
+  let tmpAssisted = state.assistCheck.assistLabel;
+  let tmpInspect = [],tmpAssist = [],assayArr = [],tmpDetail=[],checkArr = [];
+
+  for(let i = 0;i < tmpAll.length;i++){
+    let tmpItem = tmpAll[i];
+    if(tmpItem.type == 5){
+      tmpInspect = tmpItem.moduleDetailDTOList || []
+    }else if(tmpItem.type == 6){
+      tmpAssist = tmpItem.moduleDetailDTOList || []
+    }
+  }
+  for(let i = 0;i < tmpInspect.length;i++){//化验数据处理
+    let tmpObj = JSON.parse(JSON.stringify(obj));
+    if (tmpInspect[i].controlType == 0) {
+      tmpDetail = tmpInspect[i].questionMapping
+    }else if(tmpInspect[i].controlType == 1 || tmpInspect[i].controlType == 6){
+      tmpDetail.push(tmpInspect[i])
+    }
+    tmpObj.questionId = tmpInspect[i].id
+    tmpObj.name = tmpInspect[i].name
+    tmpObj.details = tmpDetail
+    assayArr.push(tmpObj)
+  }
+  for(let i = 0;i < tmpAssist.length;i++){//辅检数据处理
+    let tmpObj = JSON.parse(JSON.stringify(obj1));
+    tmpObj.questionId = tmpAssist[i].id
+    tmpObj.name = tmpAssist[i].name
+    checkArr.push(tmpObj)
+  }
+  if(assayArr.length>0 && tmpInspected.length == 0){//化验
+    store.dispatch(addLabel(assayArr))
+  }
+  if(checkArr.length > 0 && tmpAssisted.length == 0){//辅检
+    store.dispatch(addAssistLabel(checkArr))
+  }
+}
 module.exports = {
     checkType: Type.checkType,
     regexp,
@@ -866,5 +927,7 @@ module.exports = {
     getPageLength,
     dragBox,
     formatContinueDots,
+    inspectAndAssist,
+    getCurrentDate,
     ifOtherClear
 };