Pārlūkot izejas kodu

Merge branch 'newVersion6.0' into byll6.0

luolei 4 gadi atpakaļ
vecāks
revīzija
fb4c5e868f

BIN
src/common/images/icon_del_default@2x.png


BIN
src/common/images/icon_del_hover@2x.png


BIN
src/common/images/icon_edit_default@2x.png


BIN
src/common/images/icon_edit_hover@2x.png


+ 165 - 78
src/components/HistoryCaseContainer/HistoryList/index.jsx

@@ -8,14 +8,19 @@ import PreviewBody from '@components/PreviewBody';
 import Empty from '@components/Empty'
 import { pushAllDataList,didPushParamChange } from '@utils/tools';
 import { dragBox } from '@utils/drag';
+import { initItemList, setInitHistory } from '@store/async-actions/historyTemplates';
+import HistoryCases from '@containers/HistoryCases';
 import $ from 'jquery';
 import { ConfirmModal } from '@commonComp';
 import {showHistory} from "@store/actions/historyTemplates";
 import { SET_READ_MODE } from "@store/types/typeConfig";
 import {billing} from '@store/async-actions/pushMessage';
-import {getHistempDetail} from '@store/async-actions/historyTemplates';
-import del from '../../../common/images/delete_no.png';
-import edit from '../../../common/images/check.png';
+import { getHistempDetail, asyncUpdateByIdUsNames, asyncCancelTemplateInfos} from '@store/async-actions/historyTemplates';
+import edit from '../../../common/images/icon_edit_default@2x.png';
+import editHover from '../../../common/images/icon_edit_hover@2x.png';
+import del from '../../../common/images/icon_del_default@2x.png';
+import delHover from '../../../common/images/icon_del_hover@2x.png';
+import Notify from '@commonComp/Notify';
 
 class HistoryCaseContainer extends React.Component {
     constructor(props){
@@ -28,9 +33,14 @@ class HistoryCaseContainer extends React.Component {
           visible:false,
           delVisible: false,
           editVisible: false,
-          templateName: '',
+          templateName: '', // 病历名称
           historyCase: [],
-          currentIndex:0
+          currentIndex:-1,
+          delId: '', //删除病历id
+          editId: '', //编辑病历id
+          activeIndex: 0,
+          showEditIcon: false,
+          showDelIcon: false,
         }
         this.handleCaseClick=this.handleCaseClick.bind(this)
         this.handleQuoteClick=this.handleQuoteClick.bind(this)
@@ -46,30 +56,35 @@ class HistoryCaseContainer extends React.Component {
       this.handleSortClick = this.handleSortClick.bind(this);
     }
     componentDidMount(){
-      // const {items} = this.props
-      // items.forEach(item=>{
-      //   item.editShow = false
-      // })
-      // items[0].editShow = true
+      const {items} = this.props
       dragBox('hisWrapMove','closeHis','add')
       setTimeout(() => {
-        this.handleCaseClick(0)
+        this.handleCaseClick(0, items[0])
       }, 50);      
       this.setState({
         visible:false,
-        // historyCase: items
       })
     }
 
     componentWillReceiveProps(nextProps){
-      const { items } = nextProps
-      this.setState({
-        // historyCase: items
+    }
+
+    // 操作后获取获取列表数据
+    getTemplatePageAlls() {
+      return new Promise((resolve,reject)=>{
+        initItemList().then(res => {
+          const result = res.data
+          if (result.code == 0 && result.data) {
+            store.dispatch(setInitHistory(result.data));
+            resolve('ok')
+          }
+        })
       })
     }
 
+
     // 点击当前的历史病历
-    handleCaseClick(idx) {
+    handleCaseClick(idx,val) {
       const { items } = this.props;
       let tmpItems = []
       $("#hislistLeft li").eq(idx).css({
@@ -85,25 +100,52 @@ class HistoryCaseContainer extends React.Component {
       this.setState({
         activeId: idx,
         activeHis: tmpItems,
-        dataStr: tmpItems.detailList || [],
+        // dataStr: tmpItems.preview || {},
         // dataJson:JSON.parse(tmpItems.dataJson)||{},
-        currentIndex: idx
+        dataStr: JSON.parse(tmpItems.preview)||[],
+        activeIndex: idx
       })
     }
+    // 确认引用选中病历
     makeSure(){
         const {activeHis} = this.state;
         this.setState({visible:false});
         store.dispatch(showHistory(false));
         //store.dispatch({type: CONFIRM_TYPE, confirmType: activeHis.sign});
         //store.dispatch({type: SET_READ_MODE, readMode: activeHis.sign});
-        store.dispatch(getHistempDetail(activeHis));
+        store.dispatch(getHistempDetail(activeHis));  // 获取引用数据
         const {handleQuoteClick} = this.props;
         handleQuoteClick&&handleQuoteClick();
         dragBox('hisWrapMove','closeHis','del');
     }
     //确认删除病历
     makeSureDel(){
-      console.log('确认删除');
+      const { delId } = this.state
+      store.dispatch(asyncCancelTemplateInfos(delId)).then(res => {
+        if (res.data.code === '0') {
+          Notify.success('病历删除成功');
+          this.setState({
+            delVisible: false
+          })
+          // 重新渲染列表
+          this.getTemplatePageAlls().then(res=>{
+            if(res === 'ok'){
+              const { items } = this.props;
+              if(items.length ===0) {
+                this.setState({
+                  activeHis: {}
+                })
+                store.dispatch(showHistory(false));
+                return
+              }
+              this.handleCaseClick(0, items[0])
+            }
+          })
+        }
+      }).catch(err => {
+        Notify.info(err.msg);
+      })
+
     }
 
     // 取消删除病历
@@ -114,27 +156,44 @@ class HistoryCaseContainer extends React.Component {
     }
     // 显示删除确认框
     handleDelQuoteClick(e, val, idx) {
+      e.stopPropagation()
       this.setState({
         delVisible: true,
+        delId: val.id
       })
     }
 
     // 确认编辑病历
     makeSureEdit(){
-      console.log('确认编辑病历');
-      console.log(this.state.templateName,'======');
+      const { editId, templateName} = this.state
+      store.dispatch(asyncUpdateByIdUsNames(editId, templateName)).then(res=>{
+        if (res.data.code === '0'){
+          Notify.success('病历修改成功');
+          this.setState({
+            editVisible : false
+          })
+          // 重新渲染列表
+          this.getTemplatePageAlls()
+        }
+      }).catch(err =>{
+        Notify.info(err.msg);
+      })
     }
 
     // 取消编辑病历
     closeEdit() {
       this.setState({
-        editVisible: false
+        editVisible: false,
+        templateName: ''
       })
     }
     // 显示编辑确认框
     handleEditQuoteClick(e, val, idx) {
+      e.stopPropagation()
       this.setState({
         editVisible: true,
+        editId: val.id,
+        templateName: ''
       })
     }
 
@@ -143,13 +202,16 @@ class HistoryCaseContainer extends React.Component {
         visible:false
       })
     }
+
+    // 引用,右侧文本数据同步渲染
     handleQuoteClick(e,val,idx){
       this.setState({
         visible:true,
         activeId:idx,
         activeHis:val,
-        dataStr:val.detailList||[],
+        // dataStr: val.preview||{},
         // dataJson:JSON.parse(val.dataJson)||{},
+        dataStr: JSON.parse(val.preview) || [],
       })
     }
     // 修改模板名称 input的值
@@ -160,15 +222,50 @@ class HistoryCaseContainer extends React.Component {
     }
 
     // 处理鼠标移入
-    handleMouseEnter(){
-      // console.log('处理鼠标移入');
+    handleMouseEnterLi(idx){
+      // console.log('处理鼠标移入li');
+      this.setState({
+        currentIndex: idx
+      })
     }
 
     // 处理鼠标移除
-    handleMouseLeave(){
-      // console.log('处理鼠标移除');
+    handleMouseLeaveLi(idx){
+      // console.log('处理鼠标移除li');
+
     }
 
+      // 处理鼠标移入编辑按钮
+    handleMouseEnterEdit(idx) {
+
+        this.setState({
+          showEditIcon: true
+        })
+      }
+
+      // 处理鼠标移出编辑按钮
+    handleMouseLeaveEdit(idx) {
+
+      this.setState({
+        showEditIcon: false
+      })
+    }
+
+  // 处理鼠标移入删除按钮
+  handleMouseEnterDel(idx) {
+
+    this.setState({
+      showDelIcon: true
+    })
+  }
+
+  // 处理鼠标移出删除按钮
+  handleMouseLeaveDel(idx) {
+    this.setState({
+      showDelIcon: false
+    })
+  }
+
     // 排序
     handleSortClick(){
       const { items } = this.props;
@@ -182,18 +279,24 @@ class HistoryCaseContainer extends React.Component {
 
     render(){
         const { items,handleSortClick,showHistoryBox,preInfo } = this.props;
-        const { activeHis, visible, dataJson, dataStr, delVisible, editVisible, historyCase, currentIndex } = this.state;
-        const getAllDataStringList = () =>{           //获取所有模块文本的数据
+      const { activeHis, visible, dataJson, dataStr, delVisible, editVisible, historyCase, currentIndex, activeIndex } = this.state;
+
+     
+        const getAllDataStringList = (dataStr) =>{           //获取所有模块文本的数据
             let jsonDataString = {};
             jsonDataString.lis = {};
-            jsonDataString.chief = dataStr[0].content || '';      //主诉
-            jsonDataString.present = dataStr[1].content || '';     //现病史
-            jsonDataString.other = dataStr[2].content || '';      //其他史
-            jsonDataString.vital = dataStr[3].content || '';    //查体
-            jsonDataString.lis = dataStr[4].content || '';      //化验导入填写
-            jsonDataString.pacs = dataStr[5].content || '';     //辅检
-            jsonDataString.diag = dataStr[6].content || '';      //诊断
-            jsonDataString.advice = dataStr[7].content || '';       //医嘱
+            jsonDataString.chief = dataStr[0] && dataStr[0].content || '';      //主诉
+            jsonDataString.present = dataStr[1] &&dataStr[1].content || '';     //现病史
+            jsonDataString.pastHistory = dataStr[2] &&dataStr[2].content || '';     
+            jsonDataString.personalHistory = dataStr[3] &&dataStr[3].content || '';    
+            jsonDataString.familyHistory = dataStr[4] &&dataStr[4].content || '';  
+            jsonDataString.marriageHistory = dataStr[5] &&dataStr[5].content || '';   
+            jsonDataString.menstruationHistory = dataStr[6] && dataStr[6].content || '';      
+            jsonDataString.vital = dataStr[7] && dataStr[7].content || '';    //查体
+            // jsonDataString.lis = dataStr[4].content || '';      //化验导入填写
+            // jsonDataString.pacs = dataStr[5].content || '';     //辅检
+            // jsonDataString.diag = dataStr[6].content || '';      //诊断
+            // jsonDataString.advice = dataStr[7].content || '';       //医嘱
             return jsonDataString;
         }
         return (
@@ -209,30 +312,30 @@ class HistoryCaseContainer extends React.Component {
                         <ul id="hislistLeft">
                             {(items && items.length > 0) ? items.map((val,idx)=>{
                                     // return <li key={val.id} className={val.id == activeHistory.id?styles.bgc:''} onClick={(e)=>{this.handleCaseClick(e,idx)}}>
-                                  return <li key={val.id} onClick={() => { this.handleCaseClick(idx) }} onMouseEnter={() => this.handleMouseEnter()} onMouseLeave={() => this.handleMouseLeave()}>
-                                        <div class={styles.itemLeft}>
-                                          <span title={val.diagnose}>{val.diagnose}</span>
-                                      { currentIndex === idx && (<div className={styles.edit} onClick={(e) => { this.handleEditQuoteClick(e, val, idx) }}>
-                                            <img src={edit} />
-                                          </div>)}
-                                        </div>
-                                        <div class={styles.itemRight}>
-                                          <div className={styles.del} onClick={(e) => { this.handleDelQuoteClick(e, val, idx) }}>
-                                            <img src={del} />
-                                          </div>
+                              return <li key={val.id} onClick={() => { this.handleCaseClick(idx, val) }} onMouseEnter={() => this.handleMouseEnterLi(idx)} onMouseLeave={() => this.handleMouseLeaveLi(idx)}>
+                                         <div className={styles.itemLeft}>
+                                           <div className={styles.historyTop}>
+                                        <span title={val.name} className={activeIndex === idx ? styles.itemNameActive :styles.itemName}>{val.name}</span>
+                                    {currentIndex === idx && (<div className={styles.edit} onClick={(e) => { this.handleEditQuoteClick(e, val, idx) }} onMouseEnter={() => this.handleMouseEnterEdit(idx)} onMouseLeave={() => this.handleMouseLeaveEdit(idx)}>
+                                      <img src={ this.state.showEditIcon ? editHover :edit} />
+                                              </div>)}
+                                           </div>
+                                  <div className={activeIndex === idx ? styles.timeActive : styles.time}>{val.inquiryDate}</div>
+                                          
+                                         </div>
+                                         <div className={styles.itemRight}>
+                                                                                   
                                           <button
                                             className={styles.quote}
                                             onClick={(e) => { this.handleQuoteClick(e, val, idx) }}
                                           >引 用</button>
+
+                                          {currentIndex === idx && (
+                                      <div className={styles.del} onClick={(e) => { this.handleDelQuoteClick(e, val, idx) }} onMouseEnter={() => this.handleMouseEnterDel(idx)} onMouseLeave={() => this.handleMouseLeaveDel(idx)}>
+                                      <img src={this.state.showDelIcon?delHover :del} />
+                                            </div>
+                                          )} 
                                         </div>
-                                        
-                                        {/* <span className={val.id == activeHistory.id?`${styles.time} ${styles.quoteHide}`:styles.time}>{val.inquiryDate}</span>
-                                        <button 
-                                            className={val.id == activeHistory.id?`${styles.quote} ${styles.quoteShow}`:styles.quote} 
-                                            onClick={(e)=>{handleQuoteClick(e,val)}}
-                                        >引 用</button> */}
-                                        
-                                        {/* <span className={styles.time}>{val.inquiryDate}</span> */}
                                     </li>
                                 }):<Empty message={'无历史病历'}></Empty>
                             }
@@ -247,7 +350,7 @@ class HistoryCaseContainer extends React.Component {
                             showHistoryCases={this.props.showHistoryCases}
                             dataJson={dataJson}
                             baseObj={activeHis}
-                            dataStr={dataStr.length > 0?getAllDataStringList(dataStr):[]}
+                            dataStr={dataStr.length > 0 ? getAllDataStringList(dataStr) : []}
                             show={false}
                             flg={true}
                             showAssessBtn={true}
@@ -291,28 +394,12 @@ class HistoryCaseContainer extends React.Component {
                   okBorderColor={'#3B9ED0'}
                   okColor={'#fff'}
                   oKBg={'#3B9ED0'}
-                  title={'修改模板'}
+                  title={'编辑病历名称'}
                   height={200}
-                >
-                  {/* <div className={style.name}>
-                    <span className={style.leftName}>模板名称:</span>
-                    <input className={style['ipt']}
-                      autocomplete="off"
-                      placeholder="请输入模板名称"
-                      type="text"
-                      maxLength='20'
-                      onInput={(e) => {
-                        this.handleInput(e)
-                      }}
-                      onPropertyChange={(e) => {  // 兼容ie
-                        this.handleInput(e)
-                      }}
-                      onKeyPress={e => this.keypress(e)}
-                    />
-                  </div> */}
+                >                  
                     <div className={styles.outBox}>
-                      <span>模板名称:</span>
-                      <input type="text" placeholder="请输入模板名称" value={this.state.templateName} onChange={this.handleChange} autocomplete="off"/>
+                      <span>病历名称:</span>
+                      <input type="text" placeholder="请输入病历名称" value={this.state.templateName} onChange={this.handleChange} autocomplete="off"/>
                     </div>
                 </ConfirmModal>
             </div>

+ 61 - 23
src/components/HistoryCaseContainer/HistoryList/index.less

@@ -62,36 +62,74 @@
                 border: 1px solid transparent;
                 display: flex;
                 align-items: center;
+                .activeColor {
+                      color: '#3B9ED0';
+                    }
                 .itemLeft{
                     flex: 1;
+
                     display: flex;
-                    align-items: center;
-                    span {
-                        display: inline-block;
-                        max-width: 120px;
-                        overflow: hidden;
-                        text-overflow: ellipsis;
-                        white-space: nowrap;
-                    }
-                    .edit{
-                        width: 30px;
-                        height: 30px;
-                        // background-color: pink;
-                        img{
-                            width: 20px;
-                            height: 20px;
-                            position: relative;
-                            top: -7px;
-                            left: 3px;
-                        }     
+                    // align-items: center;
+                    justify-content: start;
+                    flex-direction: column;
+
+                    .historyTop{
+                        display: flex;
+                        height:34px;
+                        .itemName {
+                            // display: inline-block;
+                            max-width: 120px;
+                            overflow: hidden;
+                            text-overflow: ellipsis;
+                            white-space: nowrap;    
+                            font-size: 14px;  
+                            line-height: 34px;   
+                            color: #1E1E1E;                      
+                        }  
+                        .itemNameActive {
+                            // display: inline-block;
+                            max-width: 120px;
+                            overflow: hidden;
+                            text-overflow: ellipsis;
+                            white-space: nowrap;    
+                            font-size: 14px;  
+                            line-height: 34px;   
+                            color: #3B9ED0;                      
+                        }                   
+                        .edit{
+
+                            width: 30px;
+                            height: 30px;
+                            // background-color: pink;
+                            img{
+                                width: 14px;
+                                height: 14px;
+                                position: relative;
+                                top: -8px;
+                                left: 8px;
+                            }     
+                        }
                     }
+                    .time {
+                        font-size:10px;
+                        height:20px;
+                        line-height: 20px;
+                        color: #777;
+                    }    
+                    .timeActive {
+                        font-size:10px;
+                        height:20px;
+                        line-height: 20px;
+                        color: #3B9ED0;
+                    }                
                 }
                 .itemRight{
-                    width: 106px;
+                    width: 88px;
                     display: flex;
                     align-items: center;
                     .del {
                         // background-color: red;
+                        margin-left: 8px;
                         width: 30px;
                         height:30px;
                         img{
@@ -110,9 +148,7 @@
                 border: 1px solid #66afe9;
                 border: 1px solid #66afe9\0;
             }
-            // .time {
-            //     float: right;
-            // }
+ 
            
             .bgc {
                 background-color: #fff;
@@ -174,3 +210,5 @@
     display: flex;
     align-items: center;
 }
+
+

+ 16 - 4
src/components/InfoTitle/index.jsx

@@ -6,7 +6,7 @@ import historyCase from '@common/images/history.png';
 import health from '@common/images/health.png'
 import store from '@store';
 import { showHistory } from '@store/actions/historyTemplates';
-import { initItemList,setInitHistory } from '@store/async-actions/historyTemplates';
+import { initItemList, setInitHistory, getHospitalInfo } from '@store/async-actions/historyTemplates';
 import HistoryCases from '@containers/HistoryCases';
 import $ from 'jquery';
 import {Notify,Loading} from '@commonComp';
@@ -25,9 +25,20 @@ class InfoTitle extends Component {
         showLoading();
         // store.dispatch(initItemList());
         // store.dispatch(showHistory(true))
-        initItemList().then((res)=>{
-            const result = res.data;
-            if(result.code==0 && result.data){
+        // initItemList().then((res)=>{
+        //     const result = res.data;
+        //     if(result.code==0 && result.data){
+        //         hideLoading();
+        //         store.dispatch(setInitHistory(result.data));
+        //         store.dispatch(showHistory(true));
+        //     }else{
+        //         hideLoading();
+        //         Notify.info("暂无历史病历");
+        //     }
+        // })
+        initItemList().then(res=>{           
+            const result = res.data
+            if (result.code === '0' && result.data.records.length !== 0) {
                 hideLoading();
                 store.dispatch(setInitHistory(result.data));
                 store.dispatch(showHistory(true));
@@ -36,6 +47,7 @@ class InfoTitle extends Component {
                 Notify.info("暂无历史病历");
             }
         })
+        store.dispatch(getHospitalInfo())
     }
     componentWillReceiveProps(next){
         const that = this;

+ 8 - 8
src/components/Information/index.jsx

@@ -14,27 +14,27 @@ class Information extends Component {
     $(this.$content.current)[0].scrollIntoView(true);
   }
   render() {
-    const { baseObj } = this.props;
+    const { baseObj} = this.props;
     let baseData = store.getState()
-    let preInfo = baseData.patInfo.message;
+    let preInfo = baseData.historyTemplates.HospitalInfo.name
     const noData = JSON.stringify(preInfo) == '{}';
     return <div className={style['information']}>
-        <div ref={this.$content} className={style['title']}>{preInfo.hospitalName}</div>
+        <div ref={this.$content} className={style['title']}>{preInfo}</div>
         <table className={style['patInfo']}>
           <tr>
-            <td>姓名:{baseObj ? baseObj.patientName : noData ? '' : preInfo.patientName}</td>
+            <td>姓名:{baseObj ? baseObj.patName : noData ? '' : preInfo.patientName}</td>
             <td>门诊号:{baseObj ? baseObj.inquiryCode : (noData ? '' : preInfo.recordId)}</td>
           </tr>
           <tr>
-            <td>年龄:{baseObj ? baseObj.patientAge : noData ? '' : preInfo.patientAge}</td>
+            <td>年龄:{baseObj ? baseObj.age : noData ? '' : preInfo.patientAge}</td>
             <td>医生:{baseObj ? baseObj.doctorName : (noData ? '' : preInfo.doctorName)}</td>
           </tr>
           <tr>
-            <td>性别:{baseObj ? baseObj.patientSex : noData ? '' : preInfo.patientSex}</td>
-            <td>科室:{baseObj ? baseObj.hospitalDeptName : (noData ? '' : preInfo.hospitalDeptName)}</td>
+            <td>性别:{baseObj.sex === 0 ? '女' : '男'}</td>
+            <td>科室:{baseObj ? baseObj.deptName : (noData ? '' : preInfo.hospitalDeptName)}</td>
           </tr>
           <tr>
-            <td>卡号:{baseObj ? baseObj.patientIdNo : noData ? '' : preInfo.patientIdNo}</td>
+            <td>卡号:{baseObj ? baseObj.cardNo : noData ? '' : preInfo.patientIdNo}</td>
             <td>就诊时间:{baseObj ? baseObj.inquiryDate : (noData ? '' : preInfo.systemTime.split(' ')[0])}</td>
           </tr>
         </table>

+ 1 - 1
src/components/Information/index.less

@@ -9,7 +9,7 @@
   margin: 0px 0px 15px 0px;
   td {
     border: 1px solid #aaa;
-    padding: 4px 8px;
+    padding: 14px 8px;
     font-size: 14px;
   }
   tr td{

+ 54 - 19
src/components/Operation/index.jsx

@@ -42,6 +42,7 @@ class Operation extends Component {
       folderNameVal:'未分类文件夹',//选中文件夹名称
       folderId:'',//选中文件夹名称
       folderListShow:false, //文件夹列表展示
+      medicalName: '', //保存病历名称
     }
     this.showPrint = this.showPrint.bind(this);
     this.closePrint = this.closePrint.bind(this);
@@ -61,6 +62,7 @@ class Operation extends Component {
     this.closeDiagBox = this.closeDiagBox.bind(this);
     this.spellFst = this.spellFst.bind(this);
     this.hideFolderList = this.hideFolderList.bind(this)
+    this.handleMedicalChange = this.handleMedicalChange.bind(this)
     this.$inp = React.createRef()
   }
 
@@ -95,25 +97,48 @@ class Operation extends Component {
   }
 
   saveAll(type) {
-    let keepState = readyKeepHistory();
-    if(keepState == 1){
-        Notify.info('主诉不能为空');
-        return;
-    }else if(keepState == 2){
-        Notify.info('诊断不能为空');
-        return;
-    }else{
-      this.setState({
-        type: type,
-        okText: '保存',
-        borderColor: '#3B9ED0',
-        okColor: '#fff',
-        oKBg: '#3B9ED0',
-        msg: <p className={style['msg']}>是否保存该病历?</p>
-      })
-      this.props.diagShowTmp(true)
-    }
+    // let keepState = readyKeepHistory();
+    // if(keepState == 1){
+    //     Notify.info('主诉不能为空');
+    //     return;
+    // }else if(keepState == 2){
+    //     Notify.info('诊断不能为空');
+    //     return;
+    // }else{
+    //   this.setState({
+    //     type: type,
+    //     okText: '保存',
+    //     borderColor: '#3B9ED0',
+    //     okColor: '#fff',
+    //     oKBg: '#3B9ED0',
+    //     msg: <p className={style['msg']}>是否保存该病历?</p>
+    //   })
+    //   this.props.diagShowTmp(true)
+    // }
+    // 清除store中 medicalName的值
+    const { clearmedicalName} = this.props
+    clearmedicalName && clearmedicalName()
+    this.setState({            
+      type: type,
+      okText: '保存',
+      borderColor: '#3B9ED0',
+      okColor: '#fff',
+      oKBg: '#3B9ED0',
+      // msg: <p className={style['msg']}>是否保存该病历?</p>
+      msg: <div className={style.outBox}><span>病历名称:</span><input type="text" placeholder="请输入病历名称" value={this.state.medicalName} onChange={this.handleMedicalChange} autocomplete="off" /></div>
+    })
+    this.props.diagShowTmp(true)
+  }
+
+  handleMedicalChange(e){
+    const { setmedicalName} = this.props
+    this.setState({
+      medicalName: e.target.value
+    },()=>{
+      setmedicalName &&setmedicalName(this.state.medicalName)
+    })
   }
+
   clearAll(type) {
     let baseList = store.getState();
     let jsonData = getAllDataList(baseList);
@@ -304,6 +329,11 @@ class Operation extends Component {
     if (type == 1) {
       diagShowTmp(false)
       this.setState({ title: '' })
+      if (type == 1) {
+        this.setState({
+          medicalName: ''
+        })
+      }
       save();
     } else if (type == 2) {
       diagShowTmp(false);
@@ -377,6 +407,11 @@ class Operation extends Component {
     if (type == 3){
       this.setState({ title: '',deptId:"",value:"",folderListShow:false,folderNameVal:'未分类文件夹',folderId:'',fstName:''})
     }
+    if(type==1){
+      this.setState({
+        medicalName: ''
+      })
+    }
     diagShowTmp(false)
   }
   setDeptId(id,name){
@@ -459,7 +494,7 @@ class Operation extends Component {
         okColor={this.state.okColor}
         oKBg={this.state.oKBg}
         borderBtm={type==3?'1px solid #ccc':null}
-        title={type==3?'保存病历模板':type==4?"新建文件夹":null}
+        title={type==3?'保存病历模板':type==4?"新建文件夹":type==1?"保存病历":null}
       >
         {this.state.msg}
         {

+ 9 - 1
src/components/Operation/index.less

@@ -336,4 +336,12 @@
 
 .selectFolderIpt {
     cursor: pointer;
-  }
+  }
+
+  .outBox{
+    padding-left: 18px;
+    height: 100px;
+    width: 100%;
+    display: flex;
+    align-items: center;
+}

+ 30 - 23
src/components/PatInfo/index.jsx

@@ -9,49 +9,49 @@ class PatInfo extends Component {
         {
           label: 'patientIdNo',
           id: 'patientIdNo',
-          value: '',
+          value: '330127198912311234',
           title: '卡号'
         },
         {
           label: 'patientName',
           id: 'patientName',
-          value: '',
+          value: '王明明',
           title: '姓名'
         },
         {
           label: 'patientAge',
           id: 'patientAge',
-          value: '',
+          value: '56',
           title: '年龄'
         },
         {
           label: 'patientSex',
           id: 'patientSex',
-          value: '',
+          value: 1,
           title: '性别'
         },
         {
           label: 'systemTime',
           id: 'systemTime',
-          value: '',
+          value: '2020-08-10',
           title: '就诊时间'
         },
         {
           label: 'hospitalDeptName',
           id: 'hospitalDeptName',
-          value: '',
+          value: '全科',
           title: '科室'
         },
         {
           label: 'doctorName',
           id: 'doctorName',
-          value: '',
+          value: '付医生',
           title: '医生'
         },
         {
           label: 'recordId',
           id: 'recordId',
-          value: '',
+          value: '4332',
           title: '门诊号'
         }
 
@@ -60,31 +60,38 @@ class PatInfo extends Component {
     this.handleChange = this.handleChange.bind(this)
   }
   componentWillMount() {
-    const { getMessage } = this.props;
+    const { getMessage, initPatInfoData } = this.props;
     getMessage && getMessage()
+    initPatInfoData && initPatInfoData(this.state.patientInfo)
   }
   componentWillReceiveProps(nextProps){
-    const {message} = nextProps.patInfo
-    let { patientInfo} = this.state
-    if (Object.keys(message).legnth !== 0){     
-      patientInfo.forEach(item =>{
-        item.value = message[item.label]
-      })
-      this.setState({
-        patientInfo
-      })
-    }
+    const { patInfoData } = nextProps.patInfo
+    this.setState({
+      patientInfo:patInfoData
+    })
+    // const {message} = nextProps.patInfo
+    // let { patientInfo} = this.state
+    // if (Object.keys(message).legnth !== 0){     
+    //   patientInfo.forEach(item =>{
+    //     item.value = message[item.label]
+    //   })
+    //   this.setState({
+    //     patientInfo
+    //   })
+    // }
   }
 
   handleChange(e){
+    const { initPatInfoData } = this.props;
     let { patientInfo } = this.state
     let patientItem = patientInfo.find(item =>{
       return item.id === e.target.id
     })
     patientItem.value = e.target.value;
-    this.setState({
-      patientInfo
-    })
+    initPatInfoData && initPatInfoData(this.state.patientInfo)
+    // this.setState({
+    //   patientInfo
+    // })
   }
 
   render(){
@@ -111,7 +118,7 @@ class PatInfo extends Component {
               return (
                 <div className={style["infoItem"]} key={item.id}>
                   <label for={item.label}>{item.title}:</label>
-                  <input id={item.id} type="text" autocomplete="off"  value={item.value} onChange={this.handleChange}/>
+                  {item.id === 'patientSex' ? (<input id={item.id} type="text" autocomplete="off" value={item.value === 0 ? '女' : '男'} onChange={this.handleChange} />) : (<input id={item.id} type="text" autocomplete="off" value={item.value} onChange={this.handleChange} />) }
                 </div>
               )
             })

+ 32 - 34
src/components/PreviewBody/index.jsx

@@ -32,17 +32,17 @@ class PreviewBody extends Component {
   }
 
   surePrint(jsonStr) {
-    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();
-      dragBox('previewPrintWrapper','previewPrintStatic','del')
-      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();
+    //   dragBox('previewPrintWrapper','previewPrintStatic','del')
+    //   this.props.save(true)
+    // }
   }
   getCurrentDate() {
     let myDate = new Date();
@@ -81,42 +81,40 @@ class PreviewBody extends Component {
   render() {
     const { show, preInfo, dataJson, dataStr, baseObj, flg ,come,showAssessBtn,showHistoryCases} = this.props;
     let other_data={},lis_data={},pas_data={},other_yjs='',access='',adviceData={};
-    if(!come){
-      other_data = JSON.parse(baseObj.detailList[2].contentJson)
-      lis_data = JSON.parse(baseObj.detailList[4].contentJson)
-      pas_data = JSON.parse(baseObj.detailList[5].contentJson)
-      adviceData = JSON.parse(baseObj.detailList[7].contentJson)
-      other_yjs = other_data&&other_data.pfix;
-      access = other_data&&other_data.haveAssess
-    }else{
-      other_yjs = dataStr.other?filterOtherDataArr(JSON.parse(dataStr.other),dataJson.other):'';
-      access = dataJson.haveAssess
-      adviceData=dataJson.advice
-    }
-    //const isChronic = (dataJson.diagChronicMagItem&&dataJson.diagChronicMagItem.name)||(dataJson.mainChronicDesease&&dataJson.mainChronicDesease.name);
-    const noData = JSON.stringify(preInfo) == '{}';
+    // if(!come){
+    //   other_data = JSON.parse(baseObj.detailList[2].contentJson)
+    //   lis_data = JSON.parse(baseObj.detailList[4].contentJson)
+    //   pas_data = JSON.parse(baseObj.detailList[5].contentJson)
+    //   adviceData = JSON.parse(baseObj.detailList[7].contentJson)
+    //   other_yjs = other_data&&other_data.pfix;
+    //   access = other_data&&other_data.haveAssess
+    // }else{
+    //   other_yjs = dataStr.other?filterOtherDataArr(JSON.parse(dataStr.other),dataJson.other):'';
+    //   access = dataJson.haveAssess
+    //   adviceData=dataJson.advice
+    // }
+    // 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: "620px" }}>
         <Information baseObj={baseObj} preInfo={preInfo}></Information>
         <table className={style['infos']}>
           <ItemPart dataStr={dataStr.chief} title={'主诉:'} type={1}></ItemPart>
           <ItemPart dataStr={dataStr.present} title={'现病史:'} type={1}></ItemPart>
-          <ItemPart dataStr={dataStr.present} title={'既往史:'} type={1}></ItemPart>
-          <ItemPart dataStr={dataStr.present} title={'个人史:'} type={1}></ItemPart>
-          <ItemPart dataStr={dataStr.present} title={'家族史:'} type={1}></ItemPart>
-          <ItemPart dataStr={dataStr.present} title={'婚育史:'} type={1}></ItemPart>
-          <ItemPart dataStr={dataStr.present} title={'月经史:'} type={1}></ItemPart>
-          {/* <ItemPart dataStr={dataStr.present} title={'其他史:'} dataJson={come?dataJson:other_data} other_yjs={other_yjs} type={3}></ItemPart> */}
+          <ItemPart dataStr={dataStr.pastHistory} title={'既往史:'} type={1}></ItemPart>
+          <ItemPart dataStr={dataStr.personalHistory} title={'个人史:'} type={1}></ItemPart>
+          <ItemPart dataStr={dataStr.familyHistory} title={'家族史:'} type={1}></ItemPart>
+          <ItemPart dataStr={dataStr.marriageHistory} title={'婚育史:'} type={1}></ItemPart>
+          <ItemPart dataStr={dataStr.menstruationHistory} title={'月经史:'} type={1}></ItemPart>
           <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>
+          {/* <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} lastDot={true}></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']}`}>
               {((adviceData&&adviceData.assay && adviceData.assay.length > 0) || ((adviceData&&adviceData.check)&& (adviceData&&adviceData.assay.check > 0))) && <p className={style.pushMessageTitle}><span>开单项目</span></p>}
               {
-  ((adviceData&&adviceData.assay && adviceData.assay.length > 0) || ((adviceData&&adviceData.check) && (adviceData&&adviceData.assay.check > 0))) && <div className={style.pushMessageDes}>{adviceData.assay}{adviceData.check}</div>
+               ((adviceData&&adviceData.assay && adviceData.assay.length > 0) || ((adviceData&&adviceData.check) && (adviceData&&adviceData.assay.check > 0))) && <div className={style.pushMessageDes}>{adviceData.assay}{adviceData.check}</div>
               }
               {adviceData&&adviceData.commontreatment && adviceData.commontreatment.length > 0 && <p  className={style.pushMessageTitle}><span>一般治疗</span></p>}
               {

+ 2 - 1
src/containers/HistoryCases.js

@@ -11,7 +11,8 @@ function mapStateToProps(state) {
         activeHistory:state.historyTemplates.activeHistory,
         items:state.historyTemplates.items,
         visible:state.historyTemplates.visible,
-        preInfo : state.patInfo.message
+        // preInfo: { ...state.patInfo.message, hispitalName: state.historyTemplates.HospitalInfo.name},
+        preInfo: { hispitalName: state.historyTemplates.HospitalInfo.name}
     }
 }
 

+ 13 - 1
src/containers/OperationContainer.js

@@ -17,6 +17,7 @@ import { RECOVER_TAG_MAIN } from '@store/types/mainSuit';
 import { RECOVER_TAG_CURRENT } from '@store/types/currentIll';
 import { RECOVER_TAG_OTHER } from '@store/types/otherHistory';
 import { RECOVER_TAG_CHECK } from '@store/types/checkBody';
+import { SETMEDICALNAME, CLEARMEDICALNAME } from '@store/types/patInfo';
 import { Notify } from '@commonComp';
 import { didPushParamChange } from '@utils/tools.js';
 import { billing } from '@store/async-actions/pushMessage';
@@ -83,9 +84,20 @@ function mapDispatchToProps(dispatch) {
         type: CLOSE_PREVIEW
       });
     },
+    setmedicalName: (val) =>{
+      dispatch({
+        type: SETMEDICALNAME,
+        params: val
+      });
+    },
+    clearmedicalName: (val) => {
+      dispatch({
+        type: CLEARMEDICALNAME,
+      });
+    },
     save: () => {
       // 埋点事件,点击保存时调用
-      dispatch(saveClickNum);
+      // dispatch(saveClickNum);
       dispatch(() => saveMessage())
     },
     clear: (flag) => {

+ 7 - 0
src/containers/PatInfoContainer.js

@@ -2,6 +2,7 @@ import React from 'react';
 import {connect} from 'react-redux';
 import {initPersonInfo} from '../store/async-actions/patInfo';
 import PatInfo from '../components/PatInfo';
+import { SETINITPATINFO} from '../store/types/patInfo'
 
 function mapStateToProps({patInfo}) {
     return ({patInfo})
@@ -11,6 +12,12 @@ function mapDispatchToProps(dispatch) {
     return {
         getMessage: () => {
             dispatch(initPersonInfo)
+        },
+        initPatInfoData: (params) =>{
+            dispatch({
+                type: SETINITPATINFO,
+                params
+            })
         }
     }
 }

+ 12 - 2
src/store/actions/historyTemplates.js

@@ -1,4 +1,4 @@
-import { HISTORY_TEMPLATES,HISTORY_TEMPLATES_SORT,HISTORY_INIT,HISTORY_ACTIVE,HISTORY_VISIBLE } from '@store/types/historyTemplates';
+import { HISTORY_TEMPLATES, HISTORY_TEMPLATES_SORT, HISTORY_INIT, HISTORY_ACTIVE, HISTORY_VISIBLE, HISTORY_UPDATEBYIDUSNAMES, HISTORY_GETHOSPITALINFO } from '@store/types/historyTemplates';
 
 export const showHistory=(bool) => ({   //显示隐藏历史病历
     type:HISTORY_TEMPLATES,
@@ -18,4 +18,14 @@ export const activeHistory=(idx) => ({   //历史病历预览
 export const visibleHistory=(bool) => ({   //历史病历弹窗
     type:HISTORY_VISIBLE,
     bool
-});
+});
+
+export const updateByIdUsNamesHistory = () => ({   //修改病历名称
+    type: HISTORY_UPDATEBYIDUSNAMES,
+});
+
+
+// export const getInitHospitalInfo = (val) => ({   //获取医院信息
+//     type: HISTORY_GETHOSPITALINFO,
+//     val
+// });

+ 22 - 1
src/store/actions/patInfo.js

@@ -49,4 +49,25 @@ export const updateHospitalMessage=(state,action)=>{
     }
     res.hospitalMsg = tmpObj || {};
     return res;
-};
+};
+
+// 获取设置病历信息
+export const setPatInfo = (state,action) => {
+  const res = Object.assign({}, state);
+  res.patInfoData = action.params
+  return res
+}
+
+// 设置病历名称
+export const setMedicalName = (state, action) => {
+  const res = Object.assign({}, state);
+  res.medicalName = action.params
+  return res
+}
+
+// clearMedicalName
+export const clearMedicalName = (state, action) => {
+  const res = Object.assign({}, state);
+  // res.medicalName = ''
+  return res
+}

+ 82 - 18
src/store/async-actions/historyTemplates.js

@@ -1,37 +1,47 @@
 import axios from '@utils/ajax';
 import { pushAllDataList,didPushParamChange } from '@utils/tools';
 import { initHistory } from '@store/actions/historyTemplates';
+import { HISTORY_GETHOSPITALINFO } from '@store/types/historyTemplates';
 import Notify from '@commonComp/Notify';
 import store from '@store';
 import { billing, getMRAnalyse} from '@store/async-actions/pushMessage';
 
 export const initItemList = (item) => {
-  let baseList = store.getState();
-  let state = baseList.patInfo.message;
-  const param = {
-      "hospitalId": state.hospitalId,
-      "patientId": state.patientId,
-      "disName":item&&item.name?item.name : 'dis',
-      "disType":item?1:0,
-      "current": 1,
-      "size": 9999
-    }
-    return axios.json('/inquiryInfo/hisInquirys',param);
+  // let baseList = store.getState();
+  // let state = baseList.patInfo.message;
+  // const param = {
+  //     "hospitalId": state.hospitalId,
+  //     "patientId": state.patientId,
+  //     "disName":item&&item.name?item.name : 'dis',
+  //     "disType":item?1:0,
+  //     "current": 1,
+  //     "size": 9999
+  //   }
+  //   return axios.json('/inquiryInfo/hisInquirys',param);
+  const params = {
+    sex: "",
+    name: '',
+    current: 1,
+    size: 9999
+  } 
+  return axios.json('/demo/templateInfo/getTemplatePageAlls', params);
 };
 export const getHistempDetail = (item) => {
   const param = {
-      "inquiryId": item.id
+      "id": item.id
     }
     return (dispatch) => {
-        axios.json('/inquiryInfo/getInquiryDetail',param).then((res)=>{
+       axios.json('/demo/templateInfo/getTemplatebyId',param).then((res)=>{        
             const data =res.data;
             if(data.code == 0){
                 let tmpData = data.data
-                pushAllDataList(item.sign,'push',tmpData,'history')       //引用
-                if(didPushParamChange()) {
-                  dispatch(billing());
-                }
-                dispatch(getMRAnalyse())
+                // pushAllDataList(item.sign,'push',tmpData,'history')       //引用
+                // if(didPushParamChange()) {
+                //   dispatch(billing());
+                // }
+                // dispatch(getMRAnalyse())
+
+                
             }else{
                 Notify.error(data.msg);
             }
@@ -44,3 +54,57 @@ export function setInitHistory(data){
     dispatch(initHistory(data));
   }
 }
+
+
+export const asyncUpdateByIdUsNames = (editId, templateName) => {
+  return (dispatch) => {
+    return new Promise((resolve, reject)=>{
+      let param = {
+        id: editId,
+        modeName: templateName,
+        doctorId: ''
+      }
+      axios.json('/demo/templateInfo/updateByIdUsNames', param).then(res=>{
+        if (res.data.code === '0'){
+          resolve(res)
+        }else{
+          reject(res.data)
+        }
+      })
+    })
+  }
+}
+
+export const asyncCancelTemplateInfos = (delId) => {
+  return (dispatch) => {
+    return new Promise((resolve, reject) => {
+      let param = {
+        ids: delId
+      }
+      axios.json('/demo/templateInfo/cancelTemplateInfos', param).then(res => {
+        if (res.data.code === '0') {
+          resolve(res)
+        } else {
+          reject(res.data)
+        }
+      })
+    })
+  }
+}
+
+
+// 获取医院信息
+export const getHospitalInfo = () =>{
+  return (dispatch) =>{
+    axios.json('/tran/hospitalInfo/getHospitalInfoById', { id: 1 }).then(res => {
+      if (res.data.code === '0') {
+        dispatch({
+          type: HISTORY_GETHOSPITALINFO,
+          data: res.data.data
+        })
+      }
+    })
+  }
+  
+}
+

+ 5 - 0
src/store/async-actions/patInfo.js

@@ -249,3 +249,8 @@ export async function getPatientMessage(dispatch, getState){
   //dispatch(initHistoryDetails());      //历史病历回读
 }
 
+
+//  获取病历信息
+export async function getPatInfoData(dispatch,getState) {
+  
+}

+ 122 - 5
src/store/async-actions/print.js

@@ -10,7 +10,9 @@ import {
     getAllDataStringList,
     pushAllDataList,
     filterDataArr,
-    filterOtherDataArr
+    filterOtherDataArr,
+    timestampToTime,
+    formatTextInfo
 } from '@utils/tools';
 export const getConceptDetails = (bool) => {
     let baseList = store.getState();
@@ -45,15 +47,130 @@ export const getConceptDetails = (bool) => {
 }
 export const saveMessage=(bool)=>{
     store.dispatch({type:MODI_LOADING,flag:true});
-    getConceptDetails(bool)
+    // getConceptDetails(bool)  //保存病历 老版本
+    saveMedicalData()
 }
 
+// 获取参数value
+function formatFormParmas(val,arr){
+    let item = arr.length!==0 && arr.find(item=>{
+       return item.id === val
+    })
+    return item.value
+}
+
+// 保存病历_lcq_new_重写
+export const saveMedicalData = () =>{
+    let baseList = store.getState();
+    // console.log(baseList,'======baseList========');
+    const { patInfo: { patInfoData } } = baseList
+    let inquiryDate = timestampToTime(new Date().getTime())  // 获取当前时间  
+    let modeName = baseList.patInfo.medicalName   //病历名称
+    let jsonData = getAllDataList(baseList);
+    // let preview = getAllDataList(preview);
+    let tempPreview = formatTextInfo(baseList);
+    let preview = [
+        {
+            "content": tempPreview.chief,
+            "contentValue": filterDataArr(JSON.parse(tempPreview.chief)),
+            "contentJson": '',
+            "type": 1
+        },
+        {
+            "content": tempPreview.present,
+            "contentValue": filterDataArr(JSON.parse(tempPreview.present)),
+            "contentJson": '',
+            "type": 2
+        },
+        {
+            "content": tempPreview.pastHistory,
+            "contentValue": filterDataArr(JSON.parse(tempPreview.pastHistory)),
+            "contentJson": '',
+            "type": 3
+        },
+        {
+            "content": tempPreview.personalHistory,
+            "contentValue": filterDataArr(JSON.parse(tempPreview.personalHistory)),
+            "contentJson": '',
+            "type": 4
+        },
+        {
+            "content": tempPreview.familyHistory,
+            "contentValue": filterDataArr(JSON.parse(tempPreview.familyHistory)),
+            "contentJson": '',
+            "type": 5
+        },
+        {
+            "content": tempPreview.marriageHistory,
+            "contentValue": filterDataArr(JSON.parse(tempPreview.marriageHistory)),
+            "contentJson": '',
+            "type": 6
+        },
+        {
+            "content": tempPreview.menstruationHistory,
+            "contentValue": filterDataArr(JSON.parse(tempPreview.menstruationHistory)),
+            "contentJson": '',
+            "type": 7
+        },
+        {
+            "content": tempPreview.vital,
+            "contentValue": filterDataArr(JSON.parse(tempPreview.vital)),
+            "contentJson": '',
+            "type": 8
+        },
+        // {
+        //     "content": tempPreview.lis,
+        //     "contentValue": filterDataArr(JSON.parse(tempPreview.lis)),
+        //     "contentJson": '',
+        //     "type": 9
+        // },
+        // {
+        //     "content": tempPreview.pacs,
+        //     "contentValue": filterDataArr(JSON.parse(tempPreview.pacs)),
+        //     "contentJson": '',
+        //     "type": 10
+        // },
+        // {
+        //     "content": tempPreview.diag,
+        //     "contentValue": filterDataArr(JSON.parse(tempPreview.diag)),
+        //     "contentJson": '',
+        //     "type": 11
+        // },
+        // {
+        //     "content": tempPreview.advice,
+        //     "contentValue": filterDataArr(JSON.parse(tempPreview.advice)),
+        //     "contentJson": '',
+        //     "type": 12
+        // }
+    ]
+    let params = {
+        "age": formatFormParmas('patientAge', patInfoData),
+        "cardNo": formatFormParmas('patientIdNo', patInfoData),
+        "dataJson": JSON.stringify(Object.assign({}, jsonData)),
+        "deptName": formatFormParmas('hospitalDeptName', patInfoData),
+        "doctorName": formatFormParmas('doctorName', patInfoData),
+        "inquiryCode": formatFormParmas('recordId', patInfoData),
+        "inquiryDate": inquiryDate,
+        "modeName": modeName,
+        "patName": formatFormParmas('patientName', patInfoData),
+        "preview": JSON.stringify(preview),  // 左侧病历预览信息
+        "sex": formatFormParmas('patientSex', patInfoData),
+    }
+    json('/demo/templateInfo/saveTemplateInfo', params).then(res=>{
+        let data = res.data
+        if (data.code == 0) {            
+            Notify.success('病历保存成功');
+        } else {
+            Notify.info(data.msg);
+        }
+        store.dispatch({ type: MODI_LOADING, flag: false });
+    })
+}
+
+
 // 保存病历信息
 export const realSaveData = (bool,list) => {
-    console.log(bool,'==============');
-    console.log(list,'==============');
     let baseList = store.getState();
-    console.log(baseList,'baseList=========');
     const dConfig = baseList.typeConfig;
     const readMode = dConfig.readMode;          //回读模式
     let state = baseList.patInfo.message;

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

@@ -18,7 +18,8 @@ const api={
   getTableInfo:'/scale/getContent', //获取量表明细
   getConceptDetail:'/conceptDetail/getConceptDetail', //获取静态提示信息
   getMRAnalyse: '/mrqc/analyse', //病历质控
-  setMrInfo:'/api/data/mrv2/createMr',      //存页面信息,供页面推送模式调取
+  // setMrInfo:'/api/data/mrv2/createMr',      //存页面信息,供页面推送模式调取
+  setMrInfo:'/sys/mr/createMr',      //存页面信息,供页面推送模式调取
 };
 
 export const embedPush = (obj) => {      //内嵌页面推送时推送

+ 15 - 1
src/store/reducers/historyTemplates.js

@@ -4,6 +4,8 @@ import {
     HISTORY_INIT,
     HISTORY_ACTIVE,
     HISTORY_VISIBLE,
+    HISTORY_UPDATEBYIDUSNAMES,
+    HISTORY_GETHOSPITALINFO
 } from '../types/historyTemplates';
 
 
@@ -11,7 +13,8 @@ const initHistoryList = {
     showHistoryCases: false,//历史病历显示隐藏
     visible:false,
     activeHistory:{},//需要显示的病例
-    items: []
+    items: [],
+    HospitalInfo: {}, // 医院信息
 }
 
 export default (state = initHistoryList, action) => {
@@ -44,5 +47,16 @@ export default (state = initHistoryList, action) => {
         newState.visible = action.bool;
         return newState;
     }
+    if (action.type === HISTORY_UPDATEBYIDUSNAMES) {
+        const newState = Object.assign({}, state);
+        // console.log(newState,'newState');
+        return newState;
+    }
+
+    if (action.type === HISTORY_GETHOSPITALINFO) {
+        const newState = Object.assign({}, state);
+        newState.HospitalInfo = action.data
+        return newState;
+    }
     return state;
 }

+ 11 - 3
src/store/reducers/patInfo.js

@@ -1,9 +1,11 @@
-import {GET_PATIENT_MESSAGE,GET_HOSPITAL_MESSAGE} from '../types/patInfo';
-import {updatePatientMessage,updateHospitalMessage} from '../actions/patInfo';
+import { GET_PATIENT_MESSAGE, GET_HOSPITAL_MESSAGE, SETINITPATINFO, SETMEDICALNAME, CLEARMEDICALNAME} from '../types/patInfo';
+import { updatePatientMessage, updateHospitalMessage, setPatInfo, setMedicalName, clearMedicalName} from '../actions/patInfo';
 
 const initState = {
     message: {},
-    hospitalMsg:{}
+    hospitalMsg:{},
+    patInfoData: [],  // 病历基本信息
+    medicalName: '' //病历名称
 };
 export default function(state = initState,action){
   switch(action.type){
@@ -11,6 +13,12 @@ export default function(state = initState,action){
       return updatePatientMessage(state,action);
     case GET_HOSPITAL_MESSAGE:
       return updateHospitalMessage(state,action);
+    case SETINITPATINFO:
+      return setPatInfo(state, action);
+    case SETMEDICALNAME:
+      return setMedicalName(state, action);
+    case CLEARMEDICALNAME:
+      return clearMedicalName(state, action);
     default:
       return state;
   }

+ 4 - 0
src/store/types/historyTemplates.js

@@ -3,3 +3,7 @@ export const HISTORY_TEMPLATES_SORT = 'HISTORY_TEMPLATES_SORT';
 export const HISTORY_INIT = 'HISTORY_INIT';
 export const HISTORY_ACTIVE = 'HISTORY_ACTIVE';
 export const HISTORY_VISIBLE = 'HISTORY_VISIBLE';
+
+
+export const HISTORY_UPDATEBYIDUSNAMES = 'HISTORY_UPDATEBYIDUSNAMES';  //修改病历名称
+export const HISTORY_GETHOSPITALINFO = 'HISTORY_GETHOSPITALINFO';  //获取医院信息

+ 4 - 1
src/store/types/patInfo.js

@@ -1,2 +1,5 @@
 export const GET_PATIENT_MESSAGE = 'GET_PATIENT_MESSAGE'
-export const GET_HOSPITAL_MESSAGE = 'GET_HOSPITAL_MESSAGE'
+export const GET_HOSPITAL_MESSAGE = 'GET_HOSPITAL_MESSAGE'
+export const SETINITPATINFO = 'SET_INITPAT_INFO'
+export const SETMEDICALNAME = 'SET_MEDICAL_NAME'
+export const CLEARMEDICALNAME = 'CLEAR_MEDICAL_NAME'

+ 2 - 1
src/utils/ajax.js

@@ -6,7 +6,8 @@ const axios=require('axios');
 const qs=require('querystring');
 const isLocal = window.location.hostname.indexOf('localhost')!=-1;
 const orgin = window.location.origin;
-const qhost = isLocal?host+prefix:prefix;
+// const qhost = isLocal?host+prefix:prefix;
+const qhost = isLocal ? host  :'';
 axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
 //axios.defaults.baseURL = host;       //默认地址
 // axios.defaults.timeout = 60000;       //请求超时

+ 60 - 30
src/utils/tools.js

@@ -74,35 +74,45 @@ const getUrlArgObject = (parm) => {
     return args[parm];//返回对象  
 } 
 const getAllDataList =(baseList) =>{           //获取所有模块结构化的数据
-    let jsonData = {};//console.log(111,baseList)
+    let jsonData = {};
+    // console.log(baseList,'=======================');
+    jsonData.chief = baseList.mainSuit.saveText&&baseList.mainSuit.saveText[0];   // 主诉
+    jsonData.currentIll = baseList.currentIll.saveText && baseList.currentIll.saveText[0];   //现病史
+    jsonData.pastHistory = baseList.pastHistory.saveText && baseList.pastHistory.saveText[0];   //既往史
+    jsonData.personalHistory = baseList.personalHistory.saveText && baseList.personalHistory.saveText[0];   //个人史
+    jsonData.familyHistory = baseList.familyHistory.saveText && baseList.familyHistory.saveText[0];   //家族史
+    jsonData.marriageHistory = baseList.marriageHistory.saveText && baseList.marriageHistory.saveText[0];   //婚育史
+    jsonData.menstruationHistory = baseList.menstruationHistory.saveText && baseList.menstruationHistory.saveText[0];   //月经史
+    jsonData.checkBody = baseList.checkBody.saveText && baseList.checkBody.saveText[0];   //查体
+
+
     //月经史公式
-    const other = baseList.otherHistory;
-    jsonData.lis = {};
-    jsonData.chief = baseList.mainSuit.data;      //主诉
-    jsonData.present = baseList.currentIll.data;    //现病史
-    jsonData.other = other.data;      //其他史
-    jsonData.otherHistoryIsEmpty = other.isEmpty;
-    jsonData['yjs_1'] = other['yjs_1'];
-    jsonData['yjs_2'] = other['yjs_2'];
-    jsonData['yjs_3'] = other['yjs_3'];
-    jsonData['yjs_4'] = other['yjs_4'];
-    jsonData.vital = baseList.checkBody.data;    //查体
-    jsonData.checkBodyIsEmpty = baseList.checkBody.isEmpty;
-    jsonData.lis.labelList = baseList.inspect.labelList;      //化验
-    jsonData.lis.getExcelDataList =  baseList.inspect.getExcelDataList;      //化验导入
-    jsonData.checkedListImport = baseList.assistCheck.checkedListImport;     //辅检导入
-    jsonData.pacs = baseList.assistCheck.assistLabel;     //辅检
-    jsonData.diag = baseList.diagnosticList.diagnosticList;      //诊断
-    jsonData.advice = baseList.pushMessage.advice;       //医嘱
-    jsonData.addItems = baseList.homePage.addItems||{};
-    jsonData.mainsuitIds = baseList.mainSuit.mainIds;      //主诉去重
-    jsonData.mainChronicDesease = baseList.mainSuit.chronicDesease;      //主诉慢病{}
-    jsonData.diagChronicMagItem = baseList.diagnosticList.chronicMagItem;      //诊断慢病{}
-    jsonData.currentIds = baseList.currentIll.symptomIds;      //现病史去重
-    jsonData.isFirstMainDiag = baseList.treat.isFirstMainDiag;      //治疗方案
-    jsonData.mainReadSonM = baseList.mainSuit.addSmoduleData;      //主诉-子模板
-    jsonData.currReadSonM = baseList.currentIll.useEmpty?baseList.currentIll.currentEmptySon:baseList.currentIll.processModule;      //现病史-子模板
-    // console.log(jsonData,'结构化数据获取')
+    // const other = baseList.otherHistory;
+    // jsonData.lis = {};
+    // jsonData.chief = baseList.mainSuit.data;      //主诉
+    // jsonData.present = baseList.currentIll.data;    //现病史
+    // jsonData.other = other.data;      //其他史
+    // jsonData.otherHistoryIsEmpty = other.isEmpty;
+    // jsonData['yjs_1'] = other['yjs_1'];
+    // jsonData['yjs_2'] = other['yjs_2'];
+    // jsonData['yjs_3'] = other['yjs_3'];
+    // jsonData['yjs_4'] = other['yjs_4'];
+    // jsonData.vital = baseList.checkBody.data;    //查体
+    // jsonData.checkBodyIsEmpty = baseList.checkBody.isEmpty;
+    // jsonData.lis.labelList = baseList.inspect.labelList;      //化验
+    // jsonData.lis.getExcelDataList =  baseList.inspect.getExcelDataList;      //化验导入
+    // jsonData.checkedListImport = baseList.assistCheck.checkedListImport;     //辅检导入
+    // jsonData.pacs = baseList.assistCheck.assistLabel;     //辅检
+    // jsonData.diag = baseList.diagnosticList.diagnosticList;      //诊断
+    // jsonData.advice = baseList.pushMessage.advice;       //医嘱
+    // jsonData.addItems = baseList.homePage.addItems||{};
+    // jsonData.mainsuitIds = baseList.mainSuit.mainIds;      //主诉去重
+    // jsonData.mainChronicDesease = baseList.mainSuit.chronicDesease;      //主诉慢病{}
+    // jsonData.diagChronicMagItem = baseList.diagnosticList.chronicMagItem;      //诊断慢病{}
+    // jsonData.currentIds = baseList.currentIll.symptomIds;      //现病史去重
+    // jsonData.isFirstMainDiag = baseList.treat.isFirstMainDiag;      //治疗方案
+    // jsonData.mainReadSonM = baseList.mainSuit.addSmoduleData;      //主诉-子模板
+    // jsonData.currReadSonM = baseList.currentIll.useEmpty?baseList.currentIll.currentEmptySon:baseList.currentIll.processModule;      //现病史-子模板
     return jsonData;
 }
 const getAllDataStringList =(baseList) =>{           //获取所有模块文本的数据
@@ -141,9 +151,28 @@ const getAllDataStringList =(baseList) =>{           //获取所有模块文本
       'diag' : baseList.diagnosticList.diagnosticStr,
       'advice' : baseList.pushMessage.AdviceStr
     }
-    // console.log(JSON.stringify(chiefData),chiefData,'文本模式数据获取')
     return jsonDataString;
 }
+
+ // 返回文本信息  _lcq
+const formatTextInfo = (baseList) =>{
+  return {
+       'chief': JSON.stringify(baseList.mainSuit.saveText),
+      'present': JSON.stringify(baseList.currentIll.saveText),
+       'pastHistory': JSON.stringify(baseList.pastHistory.saveText),
+       'personalHistory': JSON.stringify(baseList.personalHistory.saveText),
+       'familyHistory': JSON.stringify(baseList.familyHistory.saveText),
+       'marriageHistory': JSON.stringify(baseList.marriageHistory.saveText),
+       'menstruationHistory': JSON.stringify(baseList.menstruationHistory.saveText),
+       'vital': JSON.stringify(baseList.checkBody.saveText),
+//        'lis': baseList.inspect.inspectStrPlus,
+//        'pacs': baseList.assistCheck.dataString,
+//        'diag': baseList.diagnosticList.diagnosticStr,
+//        'advice': baseList.pushMessage.AdviceStr
+  }
+}
+
+
 /**
  * 
  * @param {回读数据} reData 
@@ -1839,5 +1868,6 @@ module.exports = {
     removeRepeat,
     handleMouseUp,
     checkDeptContent,
-    getArrow
+    formatTextInfo,
+    getArrow,
 };