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