ChronicInfo.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. import {connect} from 'react-redux';
  2. import ChronicInfo from '../components/ChronicInfo';
  3. import {SHOW_TABLE_LIST,HIDE_TABLE_LIST, SET_CHRONIC_PUSHS} from '@store/types/pushMessage';
  4. import {getTableList,getScaleInfo,getTips} from '../store/async-actions/pushMessage';
  5. import {ADD_ASSESS_ITEMS,SET_SAVE_ASSESS_DATA,SET_CHRONIC_CALCU_RESULT} from "@types/assessResult";
  6. import {saveMessage} from "../store/async-actions/print";
  7. import {saveClickNum} from '@store/async-actions/homePage';
  8. import { getFormulaResult } from '@store/async-actions/fetchModules'
  9. import {deepClone} from '@utils/tools';
  10. import Notify from '@commonComp/Notify';
  11. function mapStateToProps(state){
  12. const {pushMessage,assessResult} = state;
  13. return{
  14. chronicMagItem: state.diagnosticList.chronicMagItem,//慢病疾病
  15. chronicPushItems: pushMessage.chronicPushItems, //慢病右侧推送
  16. tableList: pushMessage.tableList,
  17. showList: pushMessage.showList,
  18. showHide: pushMessage.showHide,
  19. scaleInfo: pushMessage.scaleInfo,//量表内容
  20. chronicDesease:state.mainSuit.chronicDesease,//主诉存的慢病
  21. update:assessResult.update1,
  22. formulaResult:pushMessage.formulaResult, //量表信息
  23. indexs:assessResult.wholeIndexs,
  24. wholeResults:assessResult.wholeResults, //整体评估可能结果
  25. calcuResult:pushMessage.calcuResult, //计算公式结果
  26. calcuValues:pushMessage.calcuValues, //计算公式填的值
  27. }
  28. }
  29. function mapDispatchToProps(dispatch){
  30. return {
  31. getTableList(id){
  32. dispatch(getTableList(id))
  33. // dispatch({type:SHOW_TABLE_LIST})
  34. },
  35. hideList(item){
  36. dispatch({
  37. type:SHOW_TABLE_LIST,
  38. name:item.name,
  39. value:item.value
  40. })
  41. },
  42. getScaleInfo(item){
  43. dispatch(getScaleInfo(item))
  44. },
  45. addAssessItem(row,pIndex,i){ //加入评估记录
  46. let obj = Object.assign({},row);
  47. //obj.details[i].add=true;
  48. dispatch({
  49. type:ADD_ASSESS_ITEMS,
  50. data:obj,
  51. index:pIndex,
  52. subIndex:i
  53. })
  54. },
  55. //保存管理评估
  56. saveAssessInfos(obj,flg,noSave){ //noSave未true则不调页面保存接口
  57. dispatch(Object.assign({},obj,{type:SET_SAVE_ASSESS_DATA}));
  58. if(!noSave){
  59. dispatch(saveClickNum);
  60. if(flg != 1 && flg != 2){
  61. dispatch(() => saveMessage())
  62. }
  63. }
  64. },
  65. savePossibleResult(data){
  66. dispatch({
  67. type: 'SAVE_POSSIBLE_RESULT',
  68. wholeResults: data
  69. })
  70. },
  71. //设置量表推送内容
  72. setChronicPush(data) {
  73. dispatch({
  74. type: SET_CHRONIC_PUSHS,
  75. data: data
  76. })
  77. },
  78. // 计算公式计算
  79. calcuFormula(item) {
  80. // dispatch(getFormulaResult(item))
  81. const {param,chronicPushItems} = item;
  82. getFormulaResult(param).then((res)=>{
  83. if(+res.data.code==0){
  84. const data = chronicPushItems;
  85. const result = res.data.data.result;
  86. const content = data[param.ppIndex].details[param.pIndex].content;
  87. content.result = result;
  88. /*if(item.isPop){
  89. dispatch({
  90. type:SET_CHRONIC_CALCU_RESULT,
  91. data:deepClone(result),
  92. id:item.param.disId
  93. });
  94. }*/
  95. dispatch({
  96. type: SET_CHRONIC_PUSHS,
  97. data: deepClone(data),
  98. result:deepClone(result),
  99. values:deepClone(content.details),
  100. id:item.param.disId
  101. })
  102. }else{
  103. Notify.error(res.data.msg||'计算没有结果返回');
  104. }
  105. })
  106. },
  107. // 获取量表静态知识
  108. getInfomation(item){
  109. dispatch(getTips(item));
  110. }
  111. }
  112. }
  113. const ChronicInfoContainer = connect(mapStateToProps,mapDispatchToProps)(ChronicInfo);
  114. export default ChronicInfoContainer;