ChronicInfo.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import {connect} from 'react-redux';
  2. import ChronicInfo from '../components/ChronicInfo';
  3. import {SHOW_TABLE_LIST,HIDE_TABLE_LIST, SET_CHRONIC_PUSHS,TOGGLE_CHRONIC_INFO} from '@store/types/pushMessage';
  4. import {getTableList,getScaleInfo,getConceptDetail} from '../store/async-actions/pushMessage';
  5. import {ADD_ASSESS_ITEMS,SET_SAVE_ASSESS_DATA,SET_CHRONIC_CALCU_RESULT,ADD_WHOLE_SCALE_ITEMS,SET_CALCU_VALUES} 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 {dragBox} from '@utils/drag';
  12. function mapStateToProps(state){
  13. const {pushMessage,assessResult} = state;
  14. return{
  15. chronicMagItem: state.diagnosticList.chronicMagItem,//慢病疾病
  16. //data: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. formulaResult:pushMessage.formulaResult, //量表信息
  24. indexs:assessResult.wholeIndexs,
  25. wholeResults:assessResult.wholeResults, //整体评估可能结果
  26. calcuResult:assessResult.calcuResult, //计算公式结果
  27. calcuValues:assessResult.calcuValues, //计算公式填的值
  28. wholeScaleItems:assessResult.wholeScaleItems, //全部量表中已加入病例的量表
  29. addedScaleIds:assessResult.addedScaleIds, //已加入的量表id
  30. slideUp:pushMessage.slideUp, //是否收起指标推送模块
  31. typeConfig: state.typeConfig
  32. }
  33. }
  34. function mapDispatchToProps(dispatch){
  35. return {
  36. toggleSlide(flag){
  37. dispatch({
  38. type:TOGGLE_CHRONIC_INFO,
  39. flag
  40. });
  41. },
  42. getTableList(name){
  43. dispatch(getTableList(name))
  44. // dispatch({type:SHOW_TABLE_LIST})
  45. },
  46. hideList(param,item){
  47. dispatch({
  48. type:SHOW_TABLE_LIST,
  49. name:param.name,
  50. value:param.value,
  51. item:item?Object.assign({},item):undefined
  52. })
  53. if(!param.value){
  54. dragBox('dragModalWrap','dragModalTitle','del')
  55. }
  56. },
  57. getScaleInfo(item){
  58. dispatch(getScaleInfo(item))
  59. },
  60. addAssessItem(row,pIndex,i){ //加入评估记录
  61. let obj = Object.assign({},row);
  62. const it = obj.details[i];
  63. dispatch({
  64. type:ADD_ASSESS_ITEMS,
  65. data:obj,
  66. index:pIndex,
  67. subIndex:i,
  68. id:it.type==1?it.content.conceptId:undefined, //只有量表需要记录id,去重用
  69. })
  70. },
  71. addScaleItems(obj,id){
  72. dispatch({
  73. type:ADD_WHOLE_SCALE_ITEMS,
  74. data:obj,
  75. id
  76. })
  77. },
  78. //保存管理评估
  79. saveAssessInfos(obj,flg,noSave){ //noSave未true则不调页面保存接口
  80. dispatch(Object.assign({},obj,{type:SET_SAVE_ASSESS_DATA}));
  81. if(!noSave){
  82. dispatch(saveClickNum);
  83. if(flg != 1 && flg != 2){
  84. dispatch(() => saveMessage())
  85. }
  86. }
  87. },
  88. savePossibleResult(data){
  89. dispatch({
  90. type: 'SAVE_POSSIBLE_RESULT',
  91. wholeResults: data
  92. })
  93. },
  94. //设置量表推送内容
  95. setChronicPush(data,id,calcuItem) {
  96. dispatch({
  97. type: SET_CHRONIC_PUSHS,
  98. data: data
  99. });
  100. },
  101. setCalcuInfo(id, calcuVal, calcuResult) {
  102. dispatch({
  103. type: SET_CHRONIC_CALCU_RESULT,
  104. result:calcuResult,
  105. id:id
  106. });
  107. dispatch({
  108. type:SET_CALCU_VALUES,
  109. data:deepClone(calcuVal),
  110. id:id
  111. })
  112. },
  113. // 计算公式计算
  114. calcuFormula(param,data,i, j) {
  115. getFormulaResult(param).then((res)=>{
  116. if(+res.data.code==0){
  117. const result = res.data.data.result;
  118. const dataCopy = deepClone(data)
  119. dataCopy[i].details[j].content.result = result
  120. dispatch({
  121. type: SET_CHRONIC_PUSHS,
  122. data: dataCopy
  123. });
  124. // dispatch({
  125. // type: SET_CHRONIC_CALCU_RESULT,
  126. // result:deepClone(result),
  127. // id:param.disId
  128. // });
  129. // dispatch({
  130. // type:SET_CALCU_VALUES,
  131. // data:param.data.content.details,
  132. // id:param.disId
  133. // })
  134. }else{
  135. Notify.error(res.data.msg||'计算没有结果返回');
  136. }
  137. })
  138. },
  139. // 获取量表静态知识
  140. getInfomation(item){
  141. dispatch(getConceptDetail(item));
  142. }
  143. }
  144. }
  145. const ChronicInfoContainer = connect(mapStateToProps,mapDispatchToProps)(ChronicInfo);
  146. export default ChronicInfoContainer;