ChronicInfo.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. }
  26. }
  27. function mapDispatchToProps(dispatch){
  28. return {
  29. getTableList(id){
  30. dispatch(getTableList(id))
  31. // dispatch({type:SHOW_TABLE_LIST})
  32. },
  33. hideList(item){
  34. dispatch({
  35. type:SHOW_TABLE_LIST,
  36. name:item.name,
  37. value:item.value
  38. })
  39. },
  40. getScaleInfo(item){
  41. dispatch(getScaleInfo(item))
  42. },
  43. addAssessItem(row,pIndex,i){ //加入评估记录
  44. let obj = Object.assign({},row);
  45. //obj.details[i].add=true;
  46. dispatch({
  47. type:ADD_ASSESS_ITEMS,
  48. data:obj,
  49. index:pIndex,
  50. subIndex:i
  51. })
  52. },
  53. //保存管理评估
  54. saveAssessInfos(obj,flg,noSave){ //noSave未true则不调页面保存接口
  55. dispatch(Object.assign({},obj,{type:SET_SAVE_ASSESS_DATA}));
  56. if(!noSave){
  57. dispatch(saveClickNum);
  58. if(flg != 1 && flg != 2){
  59. dispatch(() => saveMessage())
  60. }
  61. }
  62. },
  63. //设置量表推送内容
  64. setChronicPush(data) {
  65. dispatch({
  66. type: SET_CHRONIC_PUSHS,
  67. data: data
  68. })
  69. },
  70. // 计算公式计算
  71. calcuFormula(item) {
  72. // dispatch(getFormulaResult(item))
  73. const {param,chronicPushItems} = item;
  74. getFormulaResult(param).then((res)=>{
  75. if(+res.data.code==0){
  76. const data = chronicPushItems;
  77. const result = res.data.data.result;
  78. data[param.ppIndex].details[param.pIndex].content.result = result;
  79. /*if(item.isPop){
  80. dispatch({
  81. type:SET_CHRONIC_CALCU_RESULT,
  82. data:deepClone(result),
  83. id:item.param.disId
  84. });
  85. }*/
  86. dispatch({
  87. type: SET_CHRONIC_PUSHS,
  88. data: deepClone(data),
  89. result:deepClone(result),
  90. id:item.param.disId
  91. })
  92. }else{
  93. Notify.error(res.data.msg||'计算没有结果返回');
  94. }
  95. })
  96. },
  97. // 获取量表静态知识
  98. getInfomation(item){
  99. dispatch(getTips(item));
  100. }
  101. }
  102. }
  103. const ChronicInfoContainer = connect(mapStateToProps,mapDispatchToProps)(ChronicInfo);
  104. export default ChronicInfoContainer;