Treat.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 } from '@store/types/treat.js';
  5. import { getInstroduce, getRecommendBasic, getInstroduceMore, commonTreatAddToAdvice } 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 { treat } = state;
  10. return {
  11. treatment: treat.treatment,
  12. generalTreat: treat.generalTreat,
  13. surgeryTreat: treat.surgeryTreat,
  14. treatDesc: treat.treatDesc,
  15. drugInfo: treat.drugInfo,
  16. showDrug: treat.showDrugInfo,
  17. treatItem: treat.treatItem,
  18. drugInfoList: treat.drugInfoList, //药品说明书列表(查询多个药品说明书)
  19. }
  20. }
  21. function mapDispatchToProps(dispatch) {
  22. return {
  23. selectDrug: (index, ii)=>{
  24. dispatch ({
  25. type: SELECT_DRUG,
  26. index: index,
  27. ii: ii
  28. })
  29. },
  30. setOtherRecommend: (item, index) => {
  31. dispatch ({
  32. type: SET_OTHER_DRUG,
  33. item: item,
  34. index: index,
  35. })
  36. //推荐依据不展示
  37. // dispatch(getRecommendBasic(item))
  38. },
  39. setDrugInfo: (item) => {
  40. dispatch(getInstroduce(item));
  41. },
  42. hideTreat: () => {
  43. dispatch({
  44. type: HIDE_TREAT
  45. })
  46. },
  47. clearTreat: () => {
  48. dispatch({
  49. type: CLEAR_TREAT
  50. })
  51. },
  52. showDrugInfo: () => {
  53. dispatch({
  54. type: SHOW_DRUG_INFO
  55. })
  56. },
  57. hideDrugInfo: () =>{
  58. dispatch({
  59. type: CLEAR_DRUG_INFO
  60. })
  61. dispatch({
  62. type: HIDE_DRUG_INFO
  63. })
  64. },
  65. addScheme: (title, treatment) => {
  66. dispatch({
  67. type: ADD_SCHEME,
  68. title: title,
  69. treatment: treatment
  70. })
  71. dispatch(commonTreatAddToAdvice())
  72. },
  73. //查询多条药品说明数据(添加数据用)
  74. setDrugInfoMore:(drugIdList) => {
  75. dispatch(getInstroduceMore(drugIdList));
  76. },
  77. hideDrugInfoMore: () =>{
  78. dispatch({
  79. type: HIDE_DRUG_INFO
  80. })
  81. }
  82. }
  83. }
  84. const TreatContainer = connect(
  85. mapStateToProps,
  86. mapDispatchToProps
  87. )(Treat)
  88. export default TreatContainer;