Browse Source

评估接口对接

zhouna 6 năm trước cách đây
mục cha
commit
197587d63e

+ 3 - 3
src/common/components/ComplexModal/index.less

@@ -4,14 +4,14 @@
   .content{
     overflow: auto;
     position: fixed;
-    bottom: 130px;
-    top: 110px;
+    bottom: 70px;
+    top: 70px;
     // width: 820px;
   }
   .footer{
     // width: 820px;
     position: fixed;
-    bottom:80px;
+    bottom:30px;
     text-align: right;
   }
   .shade {

+ 38 - 17
src/components/AssessResult/ChartItem/index.jsx

@@ -6,26 +6,55 @@ import echarts from 'echarts';
 class ChartItem extends Component {
   constructor(props) {
     super(props);
-    this.drawChart = this.drawChart.bind(this);
+    this.getContainers = this.getContainers.bind(this);
+  }
+  getContainers(){
+    const {data} = this.props;
+    let arr = [];
+    arr = data&&data.map((it,i)=>{
+      return <Chart data={it} index={i}/>
+    });
+    return arr;
+  }
+  componentDidMount(){
+    const {initFn} = this.props;
+    initFn&&initFn();
+  }
+  render() {
+    const {title,data } = this.props;
+    return <div className={style['assess-item']}>
+      <h2>{title}</h2>
+      <div className={style['item-content']}>
+        {this.getContainers()}
+      </div>
+    </div>;
+  }
+}
 
+class Chart extends Component{
+  constructor(props) {
+    super(props);
+    this.drawChart = this.drawChart.bind(this);
   }
-  drawChart(id){
+  drawChart(){
+    const {index,data} = this.props;
+    const id = 'chart'+index;
     var myChart = echarts.init(document.getElementById(id));
 
     // 指定图表的配置项和数据
     var option = {
       tooltip: {},
       legend: {
-        data:['销量']
+        data:[data.itemName]
       },
       xAxis: {
-        data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
+        data: data.creatTime
       },
       yAxis: {},
       series: [{
-        name: '销量',
+        name: data.itemName,
         type: 'line',
-        data: [5, 20, 36, 10, 10, 20]
+        data: data.indexValue
       }]
     };
 
@@ -33,18 +62,10 @@ class ChartItem extends Component {
     myChart.setOption(option);
   }
   componentDidMount(){
-    this.drawChart('chart1');
-    this.drawChart('chart2');
+    this.drawChart();
   }
-  render() {
-    const {title,data  } = this.props;
-    return <div className={style['assess-item']}>
-      <h2>{title}</h2>
-      <div className={style['item-content']}>
-        <div className={style["chart-box"]} id={'chart1'}></div>
-        <div className={style["chart-box"]} id={'chart2'}></div>
-      </div>
-    </div>;
+  render(){
+    return <div className={style["chart-box"]} id={'chart'+this.props.index}></div>
   }
 }
 

+ 6 - 2
src/components/AssessResult/index.jsx

@@ -11,12 +11,16 @@ class AssessResult extends Component {
   constructor(props) {
     super(props)
   }
+  componentWillMount(){
+    //获取评估
+    this.props.getAssess();
+  }
   render() {
-    const { onClose } = this.props;
+    const { onClose ,data, getIndexData,indexData} = this.props;
     return <div className={style['assess-cont']}>
       <RadioItem title='疗效评估:' data={[]}></RadioItem>
       <ScaleItem title='整体评估:' data={[]}></ScaleItem>
-      <ChartItem title='血糖控制情况:' data={[]}></ChartItem>
+      <ChartItem title='血糖控制情况:' data={indexData} initFn={getIndexData}></ChartItem>
     </div>;
   }
 }

+ 1 - 2
src/components/ChronicInfo/index.jsx

@@ -11,9 +11,8 @@ import tableIcon from '@common/images/table.png';
 import allTableIcon from '@common/images/all-table.png';
 import checkIcon from '@common/images/check.png';
 import {ComplexModal} from '@commonComp';
-import AssessResult from '../AssessResult';
+import AssessResult from '@containers/AssessResult';
 import ScaleTable from '../ScaleTable';
-import $ from 'jquery';
 
 // 慢病右侧推送模块
 class ChronicInfo extends React.Component{

+ 49 - 0
src/containers/AssessResult.js

@@ -0,0 +1,49 @@
+import React from 'react';
+import {connect} from 'react-redux';
+import AssessResult from '@components/AssessResult';
+import {ISREAD} from '@store/types/homePage.js';
+import {billing} from '@store/async-actions/pushMessage';
+import {getAssessData,getIndexData} from '@store/async-actions/fetchModules';
+import {SET_ASSESS_DATA,SET_INDEX_DATA} from '@types/assessResult';
+
+function mapStateToProps(state) {
+  //console.log(state)
+  const {assessResult} = state;
+  return {
+    data:assessResult.data,
+    indexData:assessResult.indexData
+  }
+}
+
+function mapDispatchToProps(dispatch, store) {
+  return {
+    getAssess(){
+      dispatch(getAssessData()).then((res)=>{
+        if(res.data.code=='0'){
+          dispatch({
+            type:SET_ASSESS_DATA,
+            data:res.data.data
+          })
+        }
+      }).catch(error=>{
+        console.log(error);
+      });
+    },
+    getIndexData(){
+      dispatch(getIndexData()).then((res)=>{
+        if(res.data.code=='0'){
+          dispatch({
+            type:SET_INDEX_DATA,
+            data:res.data.data
+          })
+        }
+      }).catch(error=>{
+        console.log(error);
+      });
+    }
+  }
+}
+
+const AssessResultContainer = connect(mapStateToProps, mapDispatchToProps)(AssessResult);
+
+export default AssessResultContainer;

+ 32 - 1
src/store/async-actions/fetchModules.js

@@ -16,7 +16,8 @@ const api={
   getBigPush:'/push/pushInner',
   saveMode:'/doctorPageMode/saveDoctorPageModes',
   getSymptomFeature:'/feature/getSymptomFeature',
-  getAssess:'http://192.168.3.1:5050/api/icss/evaluationModuleMapping/getEvaluationModules'
+  getAssess:'/evaluationModuleMapping/getEvaluationModules',    //获取管理评估-慢病
+  getIndexData:'/indexData/getIndexDatas',    //获取指标数据-图表-慢病
 };
 
 export const getFeature = (item)=>{
@@ -179,4 +180,34 @@ export function saveMode(mode){
     };
     return json(api.saveMode,param);
   }
+}
+
+//慢病-获取管理评估
+export function getAssessData(){
+  return (dispatch,getStore)=>{
+    const {patInfo} = getStore();
+    const param = {
+      diseaseId:21773,
+      disType:1,
+      diag:'糖尿病',
+      featureType:11,
+      lis:[],
+      sex:patInfo.message.sex,
+      age:patInfo.message.patientAge
+    };
+    return json(api.getAssess,param);
+  }
+}
+
+export function getIndexData(){
+  return (dispatch,getStore)=>{
+    const {patInfo} = getStore();
+    const param = {
+      diseaseId:21773,
+      startTime:'2017-08-01',
+      endTime:'2019-04-10',
+      patientId:1001,//patInfo.message.patientId,
+    };
+    return json(api.getIndexData,param);
+  }
 }

+ 3 - 1
src/store/index.js

@@ -28,6 +28,7 @@ import checkBody from './reducers/checkBody';
 import getInfoByUuid from './reducers/getInfoByUuid';
 import treat from './reducers/treat';
 import currentIll from './reducers/currentIll';
+import assessResult from './reducers/assessResult';
 
 
 const composeEnhancers =
@@ -62,7 +63,8 @@ const rootReducer = combineReducers({
     checkBody,
     getInfoByUuid,
 	checkBody,
-    currentIll
+    currentIll,
+  assessResult
 });
 
 export default createStore(rootReducer, enhancer);

+ 16 - 0
src/store/reducers/assessResult.js

@@ -0,0 +1,16 @@
+import {SET_ASSESS_DATA,SET_INDEX_DATA} from '@types/assessResult';
+
+const init = {};
+export default (state=init,action)=>{
+  const res = Object.assign({},state);
+  switch (action.type){
+    case SET_ASSESS_DATA:
+      res.data = action.data;
+      return res;
+    case SET_INDEX_DATA:
+      res.indexData = action.data;
+      return res;
+    default:
+      return res;
+  }
+}

+ 2 - 0
src/store/types/assessResult.js

@@ -0,0 +1,2 @@
+export const SET_ASSESS_DATA = 'SET_ASSESS_DATA';
+export const SET_INDEX_DATA = 'SET_INDEX_DATA';