Treat.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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: (position) => {
  39. dispatch ({
  40. type: SET_OTHER_DRUG,
  41. position
  42. })
  43. //推荐依据不展示
  44. // dispatch(getRecommendBasic(item))
  45. },
  46. setDrugInfo: (item) => {
  47. dispatch(getConceptDetail(item));
  48. },
  49. hideTreat: () => {
  50. dispatch({
  51. type: HIDE_TREAT
  52. })
  53. },
  54. clearTreat: () => {
  55. dispatch({
  56. type: CLEAR_TREAT
  57. })
  58. },
  59. showDrugInfo: () => {
  60. },
  61. hideDrugInfo: () =>{
  62. dragBoxs('del')
  63. dispatch({
  64. type: CLEAR_DRUG_INFO
  65. })
  66. dispatch({
  67. type: HIDE_DRUG_INFO
  68. })
  69. },
  70. addScheme: (title, treatment) => {
  71. dispatch({
  72. type: ADD_SCHEME,
  73. title: title,
  74. treatment: treatment
  75. })
  76. dispatch(commonTreatAddToAdvice())
  77. },
  78. //保存所有诊断的不良反应
  79. saveAllAdverseReaction: (item) => {
  80. dispatch(saveAllAdverseReactions(item))
  81. },
  82. //保存全部回访时间
  83. setAllFollowUp: (item) => {
  84. dispatch(setAllFollowUp(item))
  85. },
  86. //查询多条药品说明数据(添加数据用)
  87. setDrugInfoMore:(drugIdList) => {
  88. dispatch(getInstroduceMore(drugIdList));
  89. },
  90. setFollowUp: (followUp) => {
  91. dispatch({
  92. type: SET_FOLLOW_UP,
  93. followUp: followUp
  94. })
  95. },
  96. hideDrugInfoMore: () =>{
  97. dispatch({
  98. type: HIDE_DRUG_INFO
  99. })
  100. }
  101. }
  102. }
  103. const TreatContainer = connect(
  104. mapStateToProps,
  105. mapDispatchToProps
  106. )(Treat)
  107. export default TreatContainer;