treat.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. import { json } from "@utils/ajax";
  2. import { SET_TREAT } from '@store/types/diagnosticList';
  3. import { ADD_DIAGNOSTIC} from '@store/types/diagnosticList';
  4. import { SET_DRUG_INFO, SET_TREATMENT, SET_RECOMMEND_BASIC } from '@store/types/treat';
  5. import {getEMRParams} from '@store/async-actions/fetchModules';
  6. const api={
  7. push:'/api/icss/push/pushInner',
  8. textPush:'/api/icss/push/pushText'
  9. }
  10. export const addDiagnostic = (item) => {
  11. return (dispatch, getState) => {
  12. const state = getState();
  13. let url = api.push;
  14. if(+state.typeConfig.confirmType===1){
  15. url=api.textPush;
  16. }
  17. const emrData = getEMRParams();
  18. const diagnosticList = state.diagnosticList.diagnosticList;
  19. let diag = '';
  20. if(diagnosticList) {
  21. for (let i = 0; i < diagnosticList.length; i++ ) {
  22. if(i ===0 ) {
  23. diag = diag + diagnosticList[i].name;
  24. } else {
  25. diag = diag + ',' + diagnosticList[i].name;
  26. }
  27. }
  28. }
  29. if (item.type === 1) {
  30. diag = diag + ',' + item.name
  31. } else {
  32. diag = diag + ',' + item.name
  33. }
  34. const params = {
  35. "age": emrData.age,
  36. "featureType": "8",
  37. "diag": diag,
  38. "diseaseId": item.id,
  39. "lis": emrData.lis,
  40. "other": emrData.other,
  41. "pacs": emrData.pacs,
  42. "sex": emrData.sex,
  43. "symptom": emrData.current + emrData.main,
  44. "vital": emrData.vital
  45. };
  46. json(url, params).then((data) =>{
  47. item.treat = data.data.data.treat
  48. return dispatch({
  49. type: ADD_DIAGNOSTIC,
  50. item: item
  51. })
  52. }).catch((e) =>{
  53. console.log(e)
  54. })
  55. }
  56. }
  57. export const getTreatResult = (item) =>{
  58. return (dispatch, getState) => {
  59. const state = getState();
  60. let url = api.push;
  61. if(+state.typeConfig.confirmType===1){
  62. url=api.textPush;
  63. }
  64. const emrData = getEMRParams();
  65. // const params = {
  66. // "age": emrData.age,
  67. // "featureType": "8",
  68. // "dis": emrData.dis,
  69. // "diseaseId": emrData.diseaeId,
  70. // "lis": emrData.lis,
  71. // "other": emrData.other,
  72. // "pacs": emrData.pacs,
  73. // "sex": emrData.sex,
  74. // "symptom": emrData.current||emrData.main,
  75. // "vital": emrData.vital
  76. // };
  77. const diagnosticList = state.diagnosticList.diagnosticList;
  78. let diag = '';
  79. if(diagnosticList) {
  80. for (let i = 0; i < diagnosticList.length; i++ ) {
  81. if(i ===0 ) {
  82. diag = diag + diagnosticList[i].name;
  83. } else {
  84. diag = diag + ',' + diagnosticList[i].name;
  85. }
  86. }
  87. }
  88. const params = {
  89. "age": emrData.age,
  90. "featureType": "8",
  91. "diag": diag,
  92. "diseaseId": item.id,
  93. "lis": emrData.lis,
  94. "other": emrData.other,
  95. "pacs": emrData.pacs,
  96. "sex": emrData.sex,
  97. "symptom": emrData.current + emrData.main,
  98. "vital": emrData.vital
  99. };
  100. json(url, params).then((data) =>{
  101. let treat;
  102. if(data.data.data) {
  103. treat = data.data.data.treat || {}
  104. }
  105. if(treat) {
  106. return dispatch({
  107. type: SET_TREATMENT,
  108. treatment: treat.treatment,
  109. generalTreat: treat.commonTreatment,
  110. surgeryTreat: treat.surgeryTreatment,
  111. })
  112. }
  113. return
  114. }).catch((e) =>{
  115. console.log(e)
  116. })
  117. // const treatment = [
  118. // {
  119. // id:132,
  120. // drugsName:"支气管扩张剂",
  121. // showInfo:"1",
  122. // medicitionsList:[
  123. // {
  124. // id:137,
  125. // medicitionName:"多索茶碱",
  126. // rate:"0.94",
  127. // isShow:"1", //1展示,0不展示
  128. // forbidden:"0", //0:正常,1:慎用,2:禁忌
  129. // showInfo: "1",
  130. // selected: false
  131. // },
  132. // {
  133. // id:138,
  134. // medicitionName:"二羟丙茶碱",
  135. // rate:"0.92",
  136. // isShow:"1",
  137. // forbidden:"1",
  138. // showInfo:"0",
  139. // selected: false
  140. // },
  141. // {
  142. // id:4,
  143. // medicitionName:"二羟丙茶碱11",
  144. // rate:"0.50",
  145. // isShow:"0",
  146. // forbidden:"2",
  147. // showInfo:false,
  148. // selected: false
  149. // }
  150. // ]
  151. // },
  152. // {
  153. // id:133,
  154. // drugsName:"抗生素类(喹诺酮类)",
  155. // showInfo: '0',
  156. // medicitionsList:[
  157. // {
  158. // id:139,
  159. // medicitionName:"左氧氟沙星",
  160. // rate:"0.50",
  161. // isShow:"1", //1展示,0不展示
  162. // forbidden:"0",
  163. // showInfo:'0',
  164. // selected: false
  165. // },
  166. // {
  167. // id:140,
  168. // medicitionName:"莫西沙星",
  169. // rate:"0.82",
  170. // isShow:"0",
  171. // forbidden:"2",
  172. // showInfo:"0",
  173. // selected: false
  174. // }
  175. // ]
  176. // }
  177. // ];
  178. // const generalTreat = '<p style=\"box-sizing: border-box; margin-top: 0px; margin-bottom: 10px; line-height: 25px; padding: 10px; border: 0px !important;\">风湿性心脏病通常侵犯二尖瓣,其次是主动脉瓣。风湿性主动脉瓣关闭不全也常合并二尖瓣病变,临床称之为联合瓣膜病(combined valvular disease)。梅毒性主动脉炎可发展为梅毒性主动脉关闭不全或主动脉瘤。</p><p style=\"text-align: right;\">来源&nbsp;&nbsp;:&nbsp;&nbsp;中华眼科学:全3册(下)</p><p><br/></p>';
  179. // const surgeryTreat = '<p style=\"box-sizing: border-box; margin-top: 0px; margin-bottom: 10px; line-height: 25px; padding: 10px; border: 0px !important;\">风湿性心脏病通常侵犯二尖瓣,其次是主动脉瓣。风湿性主动脉瓣关闭不全也常合并二尖瓣病变,临床称之为联合瓣膜病(combined valvular disease)。梅毒性主动脉炎可发展为梅毒性主动脉关闭不全或主动脉瘤。</p><p style=\"text-align: right;\">来源&nbsp;&nbsp;:&nbsp;&nbsp;中华眼科学:全3册(下)</p><p><br/></p>';
  180. // return dispatch({
  181. // type: SET_TREATMENT,
  182. // treatment: treatment,
  183. // generalTreat: generalTreat,
  184. // surgeryTreat: surgeryTreat,
  185. // })
  186. }
  187. }
  188. export const getInstroduce = (item)=>{
  189. return (dispatch, getState) =>{
  190. const url = '/api/icss/introduceInfo/getByQuestionId';
  191. const params = {
  192. questionId: item.id,
  193. type: 8,
  194. position: 5
  195. }
  196. json(url, params)
  197. .then((data)=>{
  198. if(data.data.data) {
  199. dispatch({
  200. type: SET_DRUG_INFO,
  201. instroduce: data.data.data.introduceDetailList,
  202. name: item.medicitionName
  203. })
  204. } else {
  205. dispatch({
  206. type: SET_DRUG_INFO,
  207. instroduce: [],
  208. name: item.medicitionName
  209. })
  210. }
  211. }).catch((e) => {
  212. console.log(e)
  213. })
  214. }
  215. }
  216. //其他推荐推荐依据不用展示
  217. // export const getRecommendBasic = (item)=>{
  218. // return (dispatch, getState) =>{
  219. // const url = '/api/icss/introduceInfo/getByQuestionId';
  220. // const params = {
  221. // questionId: item.id,
  222. // type: 9,
  223. // position: 2
  224. // }
  225. // json(url, params)
  226. // .then((data)=>{
  227. // if (data.status === 200) {
  228. // if(data.data.data) {
  229. // dispatch({
  230. // type: SET_RECOMMEND_BASIC,
  231. // recommendBasic: data.data.data.introduceDetailList,
  232. // })
  233. // } else {
  234. // dispatch({
  235. // type: SET_RECOMMEND_BASIC,
  236. // recommendBasic: [],
  237. // })
  238. // }
  239. // }
  240. // }).catch((e) => {
  241. // console.log(e)
  242. // })
  243. // }
  244. // }