123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import React, { Component } from 'react';
- import style from './index.less';
- import {ConfirmModal} from '@commonComp';
- import Notify from '@commonComp/Notify';
- import {getChronic} from '@store/async-actions/homePage.js';
- import {storageLocal} from '@utils/tools';
- class DiagnosticItem extends Component{
- constructor(props){
- super(props);
- this.state = {
- visible: false
- }
- this.addDiagodal = this.addDiagodal.bind(this);
- this.chooseDiagodal = this.chooseDiagodal.bind(this);
- this.confirm = this.confirm.bind(this);
- this.cancel = this.cancel.bind(this)
- this.close = this.close.bind(this)
- }
- confirm() {
- this.close();
- const diagType = 1;
- this.addDiagodal(diagType)
- }
- cancel() {
- this.close();
- const diagType = 2;
- this.addDiagodal(diagType)
- }
- close(){
- this.setState({
- visible: false
- })
- }
- chooseDiagodal(item) {
- this.setState({
- visible: true
- })
- const { getTips } = this.props;
- getTips && getTips(item);
- }
- addDiagodal(diagType){
- const {item, isChronicMag} = this.props;
- item.type = diagType;
- // setTimeout(()=>{
- // this.setState({
- // visible: false,
- // },()=>{
- const { diagnosticList, addDiagnostic, clearInput, hideSearch } = this.props;
- for (let i = 0; i < diagnosticList.length; i++) {
- if(diagnosticList[i].id === item.id && diagnosticList[i].name === item.name) {
- Notify.info('该诊断已存在');
- return
- }
- }
- isChronicMag(item);
- // 从缓存取慢病列表
- let chronicList = JSON.parse(storageLocal.get('chronic'));
- if(!chronicList){
- getChronic();
- chronicList = JSON.parse(storageLocal.get('chronic'));
- }
- console.log(999,chronicList)
- for(let i=0; i<chronicList.length; i++){
- if(chronicList[i].id==item.id&&chronicList[i].name==item.name){
- //弹窗提示 “是否引用往期病例”?--往期病例接口、弹窗、引用
- // 是--引用 否--走慢病流程
- console.log("是慢病!")
- }
- }
- addDiagnostic&&addDiagnostic(item);
- clearInput&&clearInput();
- hideSearch&&hideSearch()
- // })
- // }, 0)
- }
- render(){
- const { visible } = this.state
- const { item, title } = this.props
- return (<span className={style['diag-item']} >
- <span className={style['diag-name']}
- title = {title && item.name + (item.showType === 2 || item.showType === 3 ? '('+ item.retrievalName+')': '')}
- onClick={() =>{this.chooseDiagodal(item)}}>
- {item.name} {item.showType === 2 || item.showType === 3 ? '('+ item.retrievalName+')': ''}
- </span>
- <ConfirmModal visible={visible} okText='初诊' cancelText='复诊' confirm={this.confirm} cancel={this.cancel} close={this.close}>
- <div className={style['confirm-info']}>确定选择“{item.name}”为</div>
- </ConfirmModal>
- </span>)
- }
- }
- export default DiagnosticItem;
|