index.jsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. import React, { Component } from "react";
  2. import style from "./index.less";
  3. import possibleImg from "../../common/images/possible.png";
  4. import doubtImg from "../../common/images/doubt.png";
  5. import recommendImg from "../../common/images/recommend.png";
  6. import tipsImg from "../../common/images/tips.png";
  7. import vigilantImg from "../../common/images/vigilant.png";
  8. import showImg from "../../common/images/show.png";
  9. import hideImg from "../../common/images/close.png";
  10. import PushDiag from "./PushDiag";
  11. import DiagnosticItem from "@containers/DiagnosticItem";
  12. import $ from "jquery";
  13. import { getWindowInnerHeight } from "@common/js/func";
  14. import {windowEventHandler} from '@utils/tools'
  15. class PushItems extends Component {
  16. constructor(props) {
  17. super(props);
  18. this.state = {
  19. moreAssay: false,
  20. moreCheck: false
  21. };
  22. this.showMore = this.showMore.bind(this);
  23. this.closeMore = this.closeMore.bind(this);
  24. this.billing = this.billing.bind(this);
  25. this.changeAssay = this.changeAssay.bind(this);
  26. this.changeCheck = this.changeCheck.bind(this);
  27. this.showTips = this.showTips.bind(this);
  28. this.$cont = React.createRef();
  29. }
  30. showMore(type) {
  31. this.setState({ [type]: true });
  32. }
  33. closeMore(type) {
  34. this.setState({ [type]: false });
  35. }
  36. billing() {
  37. const { assay, check } = this.props.pushMessage;
  38. const checkedAssay = assay.filter(item => item.checked);
  39. const checkedCheck = check.filter(item => item.checked);
  40. this.props.billing(checkedAssay, checkedCheck);
  41. const Height = $(".src-components-BodyContainer-2SgEx").height();
  42. const adviceHeight = $(".src-common-components-ItemBox-1Bpz3").height();
  43. const winHeight = window.innerHeight;
  44. const scrollTop = Height;
  45. document.documentElement.scrollTop = 10000;
  46. }
  47. changeAssay(item) {
  48. this.props.changeAssay(item);
  49. }
  50. changeCheck(item) {
  51. this.props.changeCheck(item);
  52. }
  53. showTips(tips) {
  54. const { getTipsDetails } = this.props;
  55. getTipsDetails && getTipsDetails();
  56. }
  57. componentDidMount() {
  58. const height = getWindowInnerHeight() - 200;
  59. this.$cont.current.style.height = height + "px";
  60. windowEventHandler('resize', ()=>{
  61. const height = getWindowInnerHeight() - 200;
  62. this.$cont.current.style.height = height + "px";
  63. });
  64. }
  65. render() {
  66. const {
  67. vigilant,
  68. determine,
  69. doubt,
  70. possible,
  71. assay,
  72. check,
  73. tips
  74. } = this.props.pushMessage;
  75. const { tipsDiscalimer } = this.props;
  76. const { moreAssay, moreCheck } = this.state;
  77. const {
  78. showMore,
  79. closeMore,
  80. billing,
  81. changeCheck,
  82. changeAssay,
  83. showAdd,
  84. showTips
  85. } = this;
  86. // console.log('tipsDiscalimer', tipsDiscalimer)
  87. let assayNum = 0;
  88. let assayHide = assay.map((item, index) => {
  89. assayNum = assayNum + item.name.length + 2;
  90. if (assayNum > 22) {
  91. return;
  92. } else {
  93. return (
  94. <span>
  95. <input
  96. id={item.id + item.name}
  97. onChange={() => changeAssay(item)}
  98. type="checkbox"
  99. checked={item.checked}
  100. />
  101. <label for={item.id + item.name}>{item.name}</label>
  102. </span>
  103. );
  104. }
  105. });
  106. const assays = assay.map(item => {
  107. return (
  108. <span>
  109. <input
  110. id={item.id + item.name}
  111. onChange={() => changeAssay(item)}
  112. type="checkbox"
  113. checked={item.checked}
  114. />
  115. <label for={item.id + item.name}>{item.name}</label>
  116. </span>
  117. );
  118. });
  119. let checkNum = 0;
  120. let checkHide = check.map((item, index) => {
  121. checkNum = checkNum + item.name.length + 2;
  122. if (checkNum > 22) {
  123. return;
  124. } else {
  125. return (
  126. <span>
  127. <input
  128. id={item.id + item.name}
  129. onChange={() => changeCheck(item)}
  130. type="checkbox"
  131. checked={item.checked}
  132. />
  133. <label for={item.id + item.name}>{item.name}</label>
  134. </span>
  135. );
  136. }
  137. });
  138. const checks = check.map(item => {
  139. return (
  140. <span>
  141. <input
  142. id={item.id + item.name}
  143. onChange={() => changeCheck(item)}
  144. type="checkbox"
  145. checked={item.checked}
  146. />
  147. <label for={item.id + item.name}>{item.name}</label>
  148. </span>
  149. );
  150. });
  151. const vigilants = vigilant.map((item, index) => {
  152. return <DiagnosticItem item={item} />;
  153. });
  154. return (
  155. <div className={style["push-content-wrapper"]}>
  156. <div className={style["push-content"]} ref={this.$cont}>
  157. <div style = {{width: '420px'}}>
  158. {vigilant && vigilant.length > 0 && (
  159. <div className={style["vigilant"]}>
  160. <div className={style["title"]}>
  161. <img src={vigilantImg} />
  162. 警惕
  163. </div>
  164. <div className={style["vigilantContent"]}>{vigilants}</div>
  165. </div>
  166. )}
  167. {/* 不展示确诊 */}
  168. {/* {determine && determine.length>0 && <PushDiag titleBg='#FAEBEC' icon={possibleImg} title='确诊' diagList={determine} maxShowNum={28}/>} */}
  169. {doubt && doubt.length > 0 && (
  170. <PushDiag
  171. titleBg="#FAEBEC"
  172. icon={doubtImg}
  173. title="疑似诊断"
  174. diagList={doubt}
  175. maxShowNum={28}
  176. />
  177. )}
  178. {possible && possible.length > 0 && (
  179. <PushDiag
  180. titleBg="#FAEBEC"
  181. icon={possibleImg}
  182. title="可能诊断"
  183. diagList={possible}
  184. maxShowNum={28}
  185. />
  186. )}
  187. <div className={style["diagnose"]}>
  188. {vigilant.length === 0 &&
  189. determine.length === 0 &&
  190. doubt.length === 0 &&
  191. possible.length === 0 && (
  192. <div className={style["doubt"]}>
  193. <h1>
  194. <img src={doubtImg} />
  195. 疑似诊断
  196. </h1>
  197. <div className={style["no-push"]}>无</div>
  198. </div>
  199. )}
  200. </div>
  201. <div className={style["recommend"]}>
  202. <h1>
  203. <img src={recommendImg} />
  204. 推荐检验检查<div className={style["billing"]} onClick={billing}>开单</div>
  205. </h1>
  206. <div>
  207. {assay.length === 0 && check.length === 0 ? (
  208. "无"
  209. ) : (
  210. <ul>
  211. <li className={style["firstLi"]}>
  212. <div className={style["title"]}>化验:</div>
  213. <div className={style["content"]}>
  214. {assay.length === 0
  215. ? "无"
  216. : moreAssay
  217. ? assays
  218. : assayHide}
  219. {assayNum > 28 ? (
  220. <span
  221. style={
  222. moreAssay
  223. ? { display: "none" }
  224. : { display: "inline-block" }
  225. }
  226. className={style["show"]}
  227. onClick={() => showMore("moreAssay")}
  228. >
  229. 更多
  230. <img src={showImg} />
  231. </span>
  232. ) : (
  233. ""
  234. )}
  235. <span
  236. style={
  237. moreAssay
  238. ? { display: "inline-block" }
  239. : { display: "none" }
  240. }
  241. className={style["close"]}
  242. onClick={() => closeMore("moreAssay")}
  243. >
  244. 收起
  245. <img src={hideImg} />
  246. </span>
  247. </div>
  248. </li>
  249. <li className={style["lastLi"]}>
  250. <div className={style["title"]}>检查:</div>
  251. <div className={style["content"]}>
  252. {check.length === 0
  253. ? "无"
  254. : moreCheck
  255. ? checks
  256. : checkHide}
  257. {checkNum > 28 ? (
  258. <span
  259. style={
  260. moreCheck
  261. ? { display: "none" }
  262. : { display: "inline-block" }
  263. }
  264. className={style["show"]}
  265. onClick={() => showMore("moreCheck")}
  266. >
  267. 更多
  268. <img src={showImg} />
  269. </span>
  270. ) : (
  271. ""
  272. )}
  273. <span
  274. style={
  275. moreCheck
  276. ? { display: "inline-block" }
  277. : { display: "none" }
  278. }
  279. className={style["close"]}
  280. onClick={() => closeMore("moreCheck")}
  281. >
  282. 收起
  283. <img src={hideImg} />
  284. </span>
  285. </div>
  286. </li>
  287. </ul>
  288. )}
  289. </div>
  290. </div>
  291. <div className={style["tips"]}>
  292. <h1>
  293. <img src={tipsImg} />
  294. 提示信息
  295. </h1>
  296. <div className={style["content"]}>
  297. {tips && tips.introduceDetailList ? (
  298. <div>
  299. <div className={style["title"]}>
  300. {tips.tagName}
  301. <span
  302. className={style["tips-details"]}
  303. onClick={() => showTips(tips)}
  304. >
  305. 详情
  306. </span>
  307. </div>
  308. {tips.introduceDetailList &&
  309. tips.introduceDetailList.map((item, index) => {
  310. return (
  311. item.position.indexOf("1") > -1 && (
  312. <div>
  313. <div
  314. dangerouslySetInnerHTML={{
  315. __html: item.title
  316. }}
  317. />
  318. <div
  319. dangerouslySetInnerHTML={{
  320. __html: item.content
  321. }}
  322. />
  323. {item.isReason === 1 && (
  324. <div className={style["warn"]}>
  325. {tipsDiscalimer.data.data[0].description}
  326. </div>
  327. )}
  328. </div>
  329. )
  330. );
  331. })}
  332. </div>
  333. ) : (
  334. "无"
  335. )}
  336. </div>
  337. </div>
  338. </div>
  339. </div>
  340. {tipsDiscalimer.data && <div className={style['disTips']} dangerouslySetInnerHTML={{__html: tipsDiscalimer.data.data[1].description}}></div>}
  341. </div>
  342. );
  343. }
  344. }
  345. export default PushItems;