Treat.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 { showDrugInfo } from '../store/actions/treat';
  8. function mapStateToProps(state){
  9. const { treatment, generalTreat, surgeryTreat, drugHistory, adversReactionList, treatDesc, drugInfo, showDrugInfo, treatItem , drugInfoList, followUp, hasFollowUp} = state.treat;
  10. return {
  11. treatment: treatment,
  12. generalTreat: generalTreat,
  13. surgeryTreat: surgeryTreat,
  14. drugHistory: drugHistory,
  15. adversReactionList: adversReactionList,
  16. treatDesc: treatDesc,
  17. drugInfo: drugInfo,
  18. showDrug: showDrugInfo,
  19. treatItem: treatItem,
  20. drugInfoList: drugInfoList, //药品说明书列表(查询多个药品说明书)
  21. followUp: followUp,
  22. hasFollowUp: hasFollowUp,
  23. isRead:state.homePage.isRead,
  24. }
  25. }
  26. function mapDispatchToProps(dispatch) {
  27. return {
  28. changeReact: (it, index) => {
  29. dispatch({type: CHANGE_REACT, it, index})
  30. },
  31. selectDrug: (index, ii)=>{
  32. dispatch ({
  33. type: SELECT_DRUG,
  34. index: index,
  35. ii: ii
  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(getInstroduce(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. dispatch({
  62. type: SHOW_DRUG_INFO
  63. })
  64. },
  65. hideDrugInfo: () =>{
  66. dispatch({
  67. type: CLEAR_DRUG_INFO
  68. })
  69. dispatch({
  70. type: HIDE_DRUG_INFO
  71. })
  72. },
  73. addScheme: (title, treatment) => {
  74. dispatch({
  75. type: ADD_SCHEME,
  76. title: title,
  77. treatment: treatment
  78. })
  79. dispatch(commonTreatAddToAdvice())
  80. },
  81. //保存所有诊断的不良反应
  82. saveAllAdverseReaction: (item) => {
  83. dispatch(saveAllAdverseReactions(item))
  84. },
  85. //保存全部回访时间
  86. setAllFollowUp: (item) => {
  87. dispatch(setAllFollowUp(item))
  88. },
  89. //查询多条药品说明数据(添加数据用)
  90. setDrugInfoMore:(drugIdList) => {
  91. dispatch(getInstroduceMore(drugIdList));
  92. },
  93. setFollowUp: (followUp) => {
  94. dispatch({
  95. type: SET_FOLLOW_UP,
  96. followUp: followUp
  97. })
  98. },
  99. hideDrugInfoMore: () =>{
  100. dispatch({
  101. type: HIDE_DRUG_INFO
  102. })
  103. }
  104. }
  105. }
  106. const TreatContainer = connect(
  107. mapStateToProps,
  108. mapDispatchToProps
  109. )(Treat)
  110. export default TreatContainer;