Treat.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import Treat from '@components/Treat';
  4. import { SELECT_DRUG, SET_OTHER_DRUG, SET_DRUG_INFO, CLEAR_DRUG_INFO,HIDE_TREAT, CLEAR_TREAT, SHOW_DRUG_INFO, HIDE_DRUG_INFO, CHANGE_REACT, DEL_REACT, SET_FOLLOW_UP } from '@store/types/treat.js';
  5. import { getInstroduce, getRecommendBasic, getInstroduceMore, commonTreatAddToAdvice, saveAllAdverseReactions, setAllFollowUp } from '@store/async-actions/treat';
  6. import { ADD_SCHEME } from '@store/types/pushMessage.js'
  7. import { getConceptDetail } from '@store/async-actions/pushMessage';
  8. import {dragBoxs} from '@utils/drag';
  9. function mapStateToProps(state){
  10. const { treatment, generalTreat, surgeryTreat, drugHistory, adversReactionList, treatDesc, drugInfo, showDrugInfo, treatItem , drugInfoList, followUp, hasFollowUp} = state.treat;
  11. return {
  12. treatment: treatment,
  13. generalTreat: generalTreat,
  14. surgeryTreat: surgeryTreat,
  15. drugHistory: drugHistory,
  16. adversReactionList: adversReactionList,
  17. treatDesc: treatDesc,
  18. drugInfo: drugInfo,
  19. showDrug: showDrugInfo,
  20. treatItem: treatItem,
  21. drugInfoList: drugInfoList, //药品说明书列表(查询多个药品说明书)
  22. followUp: followUp,
  23. hasFollowUp: hasFollowUp,
  24. isRead:state.homePage.isRead,
  25. }
  26. }
  27. function mapDispatchToProps(dispatch) {
  28. return {
  29. changeReact: (it, index) => {
  30. dispatch({type: CHANGE_REACT, it, index})
  31. },
  32. selectDrug: (position)=>{
  33. dispatch ({
  34. type: SELECT_DRUG,
  35. indexList: position,
  36. })
  37. },
  38. setOtherRecommend: (item, index) => {
  39. dispatch ({
  40. type: SET_OTHER_DRUG,
  41. item: item,
  42. index: index,
  43. })
  44. //推荐依据不展示
  45. // dispatch(getRecommendBasic(item))
  46. },
  47. setDrugInfo: (item) => {
  48. dispatch(getConceptDetail(item));
  49. },
  50. hideTreat: () => {
  51. dispatch({
  52. type: HIDE_TREAT
  53. })
  54. },
  55. clearTreat: () => {
  56. dispatch({
  57. type: CLEAR_TREAT
  58. })
  59. },
  60. showDrugInfo: () => {
  61. },
  62. hideDrugInfo: () =>{
  63. dragBoxs('del')
  64. dispatch({
  65. type: CLEAR_DRUG_INFO
  66. })
  67. dispatch({
  68. type: HIDE_DRUG_INFO
  69. })
  70. },
  71. addScheme: (title, treatment) => {
  72. dispatch({
  73. type: ADD_SCHEME,
  74. title: title,
  75. treatment: treatment
  76. })
  77. dispatch(commonTreatAddToAdvice())
  78. },
  79. //保存所有诊断的不良反应
  80. saveAllAdverseReaction: (item) => {
  81. dispatch(saveAllAdverseReactions(item))
  82. },
  83. //保存全部回访时间
  84. setAllFollowUp: (item) => {
  85. dispatch(setAllFollowUp(item))
  86. },
  87. //查询多条药品说明数据(添加数据用)
  88. setDrugInfoMore:(drugIdList) => {
  89. dispatch(getInstroduceMore(drugIdList));
  90. },
  91. setFollowUp: (followUp) => {
  92. dispatch({
  93. type: SET_FOLLOW_UP,
  94. followUp: followUp
  95. })
  96. },
  97. hideDrugInfoMore: () =>{
  98. dispatch({
  99. type: HIDE_DRUG_INFO
  100. })
  101. }
  102. }
  103. }
  104. const TreatContainer = connect(
  105. mapStateToProps,
  106. mapDispatchToProps
  107. )(Treat)
  108. export default TreatContainer;