CurrentIll.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import CurrentIll from '@components/CurrentIll';
  4. import {INSERT_PROCESS,SET_CURRENT_DATA,SETTEXTMODEVALUE,SET_LABEL_MODULE,SELECT_SEARCHDATA,CLEAR_CURRENT_EDIT,SAVE_CURR_FREE} from '@store/types/currentIll';
  5. import {pushMessage} from '../store/async-actions/pushContainer';
  6. import {getModules} from '../store/async-actions/fetchModules.js';
  7. import {HIDE,RESET,CLICKCOUNT,ISREAD,SETDROPSHOW} from '@store/types/homePage';
  8. import {billing} from '@store/async-actions/pushMessage';
  9. import {getModule} from '@store/async-actions/fetchModules';
  10. import {didPushParamChange,filterDataArr} from '@utils/tools';
  11. import {Notify} from '@commonComp';
  12. function mapStateToProps(state) {
  13. const {homePage,currentIll,mainSuit,diagnosticList,typeConfig} = state;
  14. const hasMain = filterDataArr(mainSuit.saveText);
  15. return {
  16. data:currentIll.data,//主诉模板
  17. emptyData:currentIll.emptyData,//空模板
  18. searchData:currentIll.searchDatas,//搜索结果
  19. focusIndex:currentIll.focusIndex,
  20. processModule:currentIll.processModule,//病程变化模板
  21. showArr:homePage.showDrop,
  22. span:currentIll.span,
  23. update:currentIll.update,//用于更新
  24. mainText:mainSuit.saveText,//主诉选中的数据
  25. mainData:mainSuit.data,//主诉使用的模板
  26. symptomFeature:mainSuit.symptomFeature,//主诉分词数据
  27. moduleNum:mainSuit.moduleNum,//主诉使用的模板
  28. type: typeConfig.typeConfig,
  29. mainIds:mainSuit.mainIds,//主诉症状选中的id(去重用)
  30. mainTailIds:mainSuit.mainTailIds,//主诉症状选中的id(去重用)
  31. totalHide: homePage.totalHide,
  32. saveText:currentIll.saveText,
  33. selecteds:currentIll.selecteds, //普通多选选中状态
  34. editClear:currentIll.editClear,
  35. symptomIds:currentIll.symptomIds,//症状id,去重用
  36. isRead:homePage.isRead,
  37. fuzhen:diagnosticList.mainSuitStr,//诊断第一个复诊值
  38. allModules:homePage.allModules,
  39. // isChronic:!!diagnosticList.chronicMagItem,
  40. isChronic:mainSuit.chronicDesease?mainSuit.chronicDesease:diagnosticList.chronicMagItem,
  41. readMode:typeConfig.readMode, //回读回来的模式(与当前模式并存)
  42. hasMain, //是否有主诉
  43. }
  44. }
  45. function mapDispatchToProps(dispatch) {
  46. return {
  47. insertProcess(obj,allModules){//点击病程变化
  48. // 埋点dispatch
  49. dispatch({
  50. type:CLICKCOUNT,
  51. data:{id:obj.id},
  52. clickType:'单击',
  53. num:1
  54. });
  55. dispatch({
  56. type:INSERT_PROCESS,
  57. });
  58. dispatch({
  59. type:ISREAD
  60. })
  61. },
  62. async setData(info){//设置现病史使用模板
  63. // let idsArr = info.mainIds;
  64. let idsArr = info.mainTailIds.filter((it,i)=>{return it});
  65. // let ids = idsArr.join(",");
  66. let labelModule = await getModules(idsArr);
  67. if(labelModule.data.code==0){//根据id获取标签模板
  68. dispatch({
  69. type:SET_LABEL_MODULE,
  70. data:labelModule.data.data
  71. })
  72. }
  73. dispatch({
  74. type:SET_CURRENT_DATA,
  75. info
  76. })
  77. //右侧推送
  78. setTimeout(function(){ //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
  79. if(didPushParamChange()){ //操作后内容有变化才推送
  80. dispatch(billing());
  81. }
  82. },500);
  83. },
  84. pushMessage: (data) => {
  85. dispatch(() => pushMessage(data))
  86. },
  87. //文本模式下推送
  88. fetchPushInfos(){
  89. //调右侧推送
  90. if(didPushParamChange()) {
  91. dispatch(billing());
  92. }
  93. },
  94. handleInput(obj){ //文本模式值保存
  95. dispatch({
  96. type:SETTEXTMODEVALUE,
  97. text:obj.text
  98. })
  99. },
  100. fetchModules(param){
  101. const {id,name,index,span,conceptId} = param;
  102. getModule(id).then((res)=>{
  103. if(res.data.code=='0'){
  104. dispatch({
  105. type:SELECT_SEARCHDATA,
  106. index,
  107. name,
  108. data: res.data.data,
  109. span,
  110. isReplace:false,
  111. conceptId
  112. });
  113. dispatch({
  114. type:ISREAD
  115. });
  116. /*
  117. * 选中后推送的入参可能变了,如输入心率搜索出心率不齐,
  118. * 500ms内心率不齐标签未选中,系统会推送入参心率,
  119. * 此时推送结果可能影响查体高亮结果且并不准确,
  120. * 所以选中后要重新推送
  121. * */
  122. if(didPushParamChange()){ //操作后内容有变化才推送
  123. dispatch(billing());
  124. }
  125. }
  126. });
  127. //右侧推送
  128. setTimeout(function(){
  129. dispatch(billing());
  130. },200);
  131. },
  132. changeEditIll(bool){
  133. dispatch({
  134. type:CLEAR_CURRENT_EDIT,
  135. editClear:bool
  136. })
  137. },
  138. freeText(item){//自由输入
  139. dispatch({
  140. type: SAVE_CURR_FREE,
  141. data:item
  142. })
  143. //右侧推送
  144. setTimeout(function(){
  145. if(didPushParamChange()){
  146. dispatch(billing());
  147. }
  148. },500);
  149. }
  150. }
  151. }
  152. const CurrentIllContainer = connect(
  153. mapStateToProps,
  154. mapDispatchToProps
  155. )(CurrentIll);
  156. export default CurrentIllContainer;