|
@@ -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>
|