treat.js 9.5 KB

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