ChronicInfo.js 3.6 KB

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