CurrentIll.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import CurrentIll from '@components/CurrentIll';
  4. import {INSERT_PROCESS,SET_CURRENT_DATA,SETTEXTMODEVALUE,SET_LABEL_MODULE,SELECT_SEARCHDATA,CLEAR_CURRENT_EDIT} from '@store/types/currentIll';
  5. import {SET_CURRENT_ILL} from '@store/types/fillInfo'
  6. import {pushMessage} from '../store/async-actions/pushContainer';
  7. import {getModules} from '../store/async-actions/fetchModules.js';
  8. import {SETDROPSHOW} from '@types/homePage.js';
  9. import {HIDE,RESET,CLICKCOUNT} from '@store/types/homePage.js';
  10. import {billing} from '@store/async-actions/pushMessage';
  11. import {getModule} from '@store/async-actions/fetchModules.js';
  12. function mapStateToProps(state) {
  13. const {homePage} = state;
  14. return {
  15. data:state.currentIll.data,//主诉模板
  16. emptyData:state.currentIll.emptyData,//空模板
  17. searchData:state.currentIll.searchDatas,//搜索结果
  18. focusIndex:state.currentIll.focusIndex,
  19. processModule:state.currentIll.processModule,//病程变化模板
  20. processModuleName:state.currentIll.processModuleName,//病程变化模板名称
  21. showArr:homePage.showDrop,
  22. span:state.currentIll.span,
  23. update:state.currentIll.update,//用于更新
  24. mainText:state.mainSuit.saveText,//主诉选中的数据
  25. mainData:state.mainSuit.data,//主诉使用的模板
  26. moduleNum:state.mainSuit.moduleNum,//主诉使用的模板
  27. type: state.typeConfig.typeConfig,
  28. mainIds:state.mainSuit.mainIds,//主诉症状选中的id
  29. fillInfo: state.fillInfo,
  30. showArr:homePage.showDrop,
  31. totalHide: homePage.totalHide,
  32. saveText:state.currentIll.saveText,
  33. selecteds:state.currentIll.selecteds, //普通多选选中状态
  34. editClear:state.currentIll.editClear,
  35. symptomIds:state.currentIll.symptomIds,//症状id,去重用
  36. isRead:state.homePage.isRead,
  37. fuzhen:state.diagnosticList.mainSuitStr,//诊断第一个复诊值
  38. }
  39. }
  40. function mapDispatchToProps(dispatch) {
  41. return {
  42. insertProcess(obj){//点击病程变化
  43. // 埋点dispatch
  44. dispatch({
  45. type:CLICKCOUNT,
  46. data:{id:obj.id},
  47. clickType:'单击',
  48. num:1
  49. });
  50. dispatch({
  51. type:INSERT_PROCESS,
  52. })
  53. },
  54. async setData(info){//设置现病史使用模板
  55. dispatch(billing);//右侧推送
  56. let idsArr = info.mainIds;
  57. let ids = idsArr.join(",");
  58. let labelModule = await getModules(ids);
  59. if(labelModule.data.code==0){//根据id获取标签模板
  60. dispatch({
  61. type:SET_LABEL_MODULE,
  62. data:labelModule.data.data
  63. })
  64. }
  65. dispatch({
  66. type:SET_CURRENT_DATA,
  67. info
  68. })
  69. },
  70. setCurrentIll: value => {
  71. dispatch({type: SET_CURRENT_ILL, value})
  72. },
  73. pushMessage: (data) => {
  74. dispatch(() => pushMessage(data))
  75. },
  76. //文本模式下推送
  77. fetchPushInfos(){
  78. //调右侧推送
  79. dispatch(billing);
  80. },
  81. handleInput(obj){ //文本模式值保存
  82. dispatch({
  83. type:SETTEXTMODEVALUE,
  84. text:obj.text
  85. })
  86. },
  87. fetchModules(param){
  88. const {id,name,index,span} = param;
  89. getModule(id).then((res)=>{
  90. if(res.data.code=='0'){
  91. dispatch({
  92. type:SELECT_SEARCHDATA,
  93. index,
  94. name,
  95. data: res.data.data,
  96. span,
  97. isReplace:false
  98. })
  99. }
  100. });
  101. },
  102. changeEditIll(bool){
  103. dispatch({
  104. type:CLEAR_CURRENT_EDIT,
  105. editClear:bool
  106. })
  107. }
  108. }
  109. }
  110. const CurrentIllContainer = connect(
  111. mapStateToProps,
  112. mapDispatchToProps
  113. )(CurrentIll);
  114. export default CurrentIllContainer;