index.jsx 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  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 DetailsModal from './DetailsModal';
  11. import PushDiag from "./PushDiag";
  12. import DiagnosticItem from "@containers/DiagnosticItem";
  13. import store from "@store";
  14. import { getWindowInnerHeight } from "@common/js/func";
  15. import {addLabel} from '@store/actions/inspect';
  16. import {addAssistLabel} from '@store/actions/assistCheck';
  17. import {windowEventHandler} from '@utils/tools'
  18. class PushItems extends Component {
  19. constructor(props) {
  20. super(props);
  21. this.state = {
  22. moreAssay: false,
  23. moreCheck: false
  24. };
  25. this.showMore = this.showMore.bind(this);
  26. this.closeMore = this.closeMore.bind(this);
  27. this.billing = this.billing.bind(this);
  28. this.changeAssay = this.changeAssay.bind(this);
  29. this.changeCheck = this.changeCheck.bind(this);
  30. this.showTips = this.showTips.bind(this);
  31. this.hideTips = this.hideTips.bind(this)
  32. this.$cont = React.createRef();
  33. }
  34. showMore(type) {
  35. this.setState({ [type]: true });
  36. }
  37. closeMore(type) {
  38. this.setState({ [type]: false });
  39. }
  40. getCurrentDate(){
  41. let myDate = new Date();
  42. let year = myDate.getFullYear(); //获取完整的年份(4位,1970-????)
  43. let mon = myDate.getMonth()-0+1; //获取当前月份(0-11,0代表1月)
  44. let day = myDate.getDate(); //获取当前日(1-31)
  45. let date = year+'-'+(mon<10?'0'+mon:mon)+'-'+(day<10?'0'+day:day);
  46. return date;
  47. }
  48. billing() {
  49. const { assay, check } = this.props.pushMessage;
  50. const checkedAssay = assay.filter(item => item.checked);
  51. const checkedCheck = check.filter(item => item.checked);
  52. this.props.billing(checkedAssay, checkedCheck);
  53. // if(checkedAssay.length > 0 || checkedCheck.length > 0) {
  54. // const Height = $(".src-components-BodyContainer-2SgEx").height();
  55. // const adviceHeight = $(".src-common-components-ItemBox-1Bpz3").height();
  56. // const winHeight = window.innerHeight;
  57. // const scrollTop = Height;
  58. // $('#addScrollEvent').scrollTop(100000)
  59. // }
  60. let obj = { //添加化验
  61. details: [],
  62. name: '',
  63. questionId: '',
  64. showType: 1,
  65. }
  66. let obj1 = { //添加辅检
  67. name: '',
  68. questionId: '',
  69. showType: 1,
  70. time:this.getCurrentDate(),
  71. value:''
  72. }
  73. if(checkedAssay.length > 0){
  74. let assayArr = []
  75. for(let i = 0;i < checkedAssay.length;i++){
  76. let tmpObj = JSON.parse(JSON.stringify(obj));
  77. tmpObj.questionId = checkedAssay[i].id
  78. tmpObj.name = checkedAssay[i].name
  79. tmpObj.details = checkedAssay[i].questionMapping
  80. assayArr.push(tmpObj)
  81. }
  82. store.dispatch(addLabel(assayArr))
  83. }
  84. if(checkedCheck.length > 0){
  85. let checkArr = []
  86. for(let i = 0;i < checkedCheck.length;i++){
  87. let tmpObj = JSON.parse(JSON.stringify(obj1));
  88. tmpObj.questionId = checkedCheck[i].id
  89. tmpObj.name = checkedCheck[i].name
  90. checkArr.push(tmpObj)
  91. }
  92. store.dispatch(addAssistLabel(checkArr))
  93. }
  94. }
  95. changeAssay(item) {
  96. this.props.changeAssay(item);
  97. }
  98. changeCheck(item) {
  99. this.props.changeCheck(item);
  100. }
  101. showTips(tips) {
  102. const { getTipsDetails, showTipsDetailsModal } = this.props;
  103. getTipsDetails && getTipsDetails();
  104. showTipsDetailsModal && showTipsDetailsModal()
  105. }
  106. hideTips() {
  107. const { hideTipsDetailsModal } = this.props;
  108. hideTipsDetailsModal && hideTipsDetailsModal()
  109. }
  110. componentDidMount() {
  111. const height = getWindowInnerHeight() - 200;
  112. this.$cont.current.style.height = height + "px";
  113. windowEventHandler('resize', ()=>{
  114. const height = getWindowInnerHeight() - 200;
  115. this.$cont.current.style.height = height + "px";
  116. });
  117. }
  118. render() {
  119. const {
  120. vigilant,
  121. determine,
  122. doubt,
  123. possible,
  124. assay,
  125. check,
  126. tips,
  127. showTipsDetails,
  128. tipsDetails
  129. } = this.props.pushMessage;
  130. const { tipsDiscalimer } = this.props;
  131. const { moreAssay, moreCheck } = this.state;
  132. const {
  133. showMore,
  134. closeMore,
  135. billing,
  136. changeCheck,
  137. changeAssay,
  138. showAdd,
  139. showTips
  140. } = this;
  141. let assayNum = 0;
  142. let assayNum2 = 0;
  143. let assayHide = assay.map((item, index) => {
  144. assayNum = assayNum + item.name.length + 2;
  145. if (assayNum > 28) {
  146. assayNum2 = assayNum2 + item.name.length + 2;
  147. if(assayNum2 > 23) {
  148. return;
  149. } else {
  150. return (
  151. <span>
  152. <input
  153. id={item.id + item.name}
  154. onChange={() => changeAssay(item)}
  155. type="checkbox"
  156. checked={item.checked}
  157. />
  158. <label for={item.id + item.name}>{item.name}</label>
  159. </span>
  160. );
  161. }
  162. } else {
  163. return (
  164. <span>
  165. <input
  166. id={item.id + item.name}
  167. onChange={() => changeAssay(item)}
  168. type="checkbox"
  169. checked={item.checked}
  170. />
  171. <label for={item.id + item.name}>{item.name}</label>
  172. </span>
  173. );
  174. }
  175. });
  176. const assays = assay.map(item => {
  177. return (
  178. <span>
  179. <input
  180. id={item.id + item.name}
  181. onChange={() => changeAssay(item)}
  182. type="checkbox"
  183. checked={item.checked}
  184. />
  185. <label for={item.id + item.name}>{item.name}</label>
  186. </span>
  187. );
  188. });
  189. let checkNum = 0;
  190. let checkNum2 = 0;
  191. let checkHide = check.map((item, index) => {
  192. checkNum = checkNum + item.name.length + 2;
  193. if (checkNum > 28) {
  194. checkNum2 = checkNum2 + item.name.length + 2;
  195. if(checkNum2 > 23) {
  196. return;
  197. }else {
  198. return (
  199. <span>
  200. <input
  201. id={item.id + item.name}
  202. onChange={() => changeCheck(item)}
  203. type="checkbox"
  204. checked={item.checked}
  205. />
  206. <label for={item.id + item.name}>{item.name}</label>
  207. </span>
  208. );
  209. }
  210. } else {
  211. return (
  212. <span>
  213. <input
  214. id={item.id + item.name}
  215. onChange={() => changeCheck(item)}
  216. type="checkbox"
  217. checked={item.checked}
  218. />
  219. <label for={item.id + item.name}>{item.name}</label>
  220. </span>
  221. );
  222. }
  223. });
  224. const checks = check.map(item => {
  225. return (
  226. <span>
  227. <input
  228. id={item.id + item.name}
  229. onChange={() => changeCheck(item)}
  230. type="checkbox"
  231. checked={item.checked}
  232. />
  233. <label for={item.id + item.name}>{item.name}</label>
  234. </span>
  235. );
  236. });
  237. const vigilants = vigilant.map((item, index) => {
  238. return <div key={item.id} className={style['push-diag-item']}><DiagnosticItem item={item}/></div>;
  239. });
  240. return (
  241. <div className={style["push-content-wrapper"]}>
  242. <div className={style["push-content"]} ref={this.$cont}>
  243. <div style = {{width: '420px'}}>
  244. {vigilant && vigilant.length > 0 && (
  245. <div className={style["vigilant"]}>
  246. <div className={style["title"]}>
  247. <img src={vigilantImg} />
  248. 警惕
  249. </div>
  250. <div className={style["vigilantContent"]}>{vigilants}</div>
  251. </div>
  252. )}
  253. {/* 不展示确诊 */}
  254. {/* {determine && determine.length>0 && <PushDiag titleBg='#FAEBEC' icon={possibleImg} title='确诊' diagList={determine} maxShowNum={28}/>} */}
  255. {doubt && doubt.length > 0 && (
  256. <PushDiag
  257. titleBg="#FAEBEC"
  258. icon={doubtImg}
  259. title="疑似诊断"
  260. diagList={doubt}
  261. maxShowNum={26}
  262. />
  263. )}
  264. {possible && possible.length > 0 && (
  265. <PushDiag
  266. titleBg="#FAEBEC"
  267. icon={possibleImg}
  268. title="可能诊断"
  269. diagList={possible}
  270. maxShowNum={26}
  271. />
  272. )}
  273. <div className={style["diagnose"]}>
  274. {vigilant.length === 0 &&
  275. determine.length === 0 &&
  276. doubt.length === 0 &&
  277. possible.length === 0 && (
  278. <div className={style["doubt"]}>
  279. <h1>
  280. <img src={doubtImg} />
  281. 疑似诊断
  282. </h1>
  283. <div className={style["no-push"]}>无</div>
  284. </div>
  285. )}
  286. </div>
  287. <div className={style["recommend"]}>
  288. <h1>
  289. <img src={recommendImg} />
  290. 推荐检验检查
  291. <div className={style["billing"]}
  292. style={assay.length === 0 && check.length === 0 ? {color: 'gray', border: '1px solid gray'} : ''}
  293. onClick={assay.length === 0 && check.length === 0 ? '' : billing}>
  294. 开单
  295. </div>
  296. </h1>
  297. <div>
  298. {assay.length === 0 && check.length === 0 ? (
  299. <span>无</span>
  300. ) : (
  301. <ul>
  302. <li className={style["firstLi"]}>
  303. <div className={style["title"]}>化验:</div>
  304. <div className={style["content"]}>
  305. {assay.length === 0
  306. ?<span >无</span>
  307. : moreAssay
  308. ? assays
  309. : assayHide}
  310. {assayNum2 > 23 ? (
  311. <span
  312. style={
  313. moreAssay
  314. ? { display: "none" }
  315. : { display: "inline-block" }
  316. }
  317. className={style["show"]}
  318. onClick={() => showMore("moreAssay")}
  319. >
  320. 更多
  321. <img src={showImg} />
  322. </span>
  323. ) : (
  324. ""
  325. )}
  326. <span
  327. style={
  328. moreAssay
  329. ? { display: "inline-block" }
  330. : { display: "none" }
  331. }
  332. className={style["close"]}
  333. onClick={() => closeMore("moreAssay")}
  334. >
  335. 收起
  336. <img src={hideImg} />
  337. </span>
  338. </div>
  339. </li>
  340. <li className={style["lastLi"]}>
  341. <div className={style["title"]}>检查:</div>
  342. <div className={style["content"]}>
  343. {check.length === 0
  344. ? "无"
  345. : moreCheck
  346. ? checks
  347. : checkHide}
  348. {checkNum2 > 23 ? (
  349. <span
  350. style={
  351. moreCheck
  352. ? { display: "none" }
  353. : { display: "inline-block" }
  354. }
  355. className={style["show"]}
  356. onClick={() => showMore("moreCheck")}
  357. >
  358. 更多
  359. <img src={showImg} />
  360. </span>
  361. ) : (
  362. ""
  363. )}
  364. <span
  365. style={
  366. moreCheck
  367. ? { display: "inline-block" }
  368. : { display: "none" }
  369. }
  370. className={style["close"]}
  371. onClick={() => closeMore("moreCheck")}
  372. >
  373. 收起
  374. <img src={hideImg} />
  375. </span>
  376. </div>
  377. </li>
  378. </ul>
  379. )}
  380. </div>
  381. </div>
  382. <div className={style["tips"]}>
  383. <h1>
  384. <img src={tipsImg} />
  385. 提示信息
  386. </h1>
  387. <div className={style["content"]}>
  388. {tips && tips.introduceDetailList ? (
  389. <div>
  390. <div className={style["title"]}>
  391. {tips.tagName}
  392. <span
  393. className={style["tips-details"]}
  394. onClick={() => showTips(tips)}
  395. >
  396. 详情
  397. </span>
  398. </div>
  399. {tips.introduceDetailList &&
  400. tips.introduceDetailList.map((item, index) => {
  401. return (
  402. item.position.indexOf("1") > -1 && (
  403. <div>
  404. <div
  405. dangerouslySetInnerHTML={{
  406. __html: item.title
  407. }}
  408. />
  409. <div
  410. dangerouslySetInnerHTML={{
  411. __html: item.content
  412. }}
  413. />
  414. {item.isReason === 1 && (
  415. <div className={style["warn"]}>
  416. {tipsDiscalimer.data.data[0].description}
  417. </div>
  418. )}
  419. </div>
  420. )
  421. );
  422. })}
  423. </div>
  424. ) : (
  425. "无"
  426. )}
  427. </div>
  428. </div>
  429. </div>
  430. </div>
  431. {tipsDiscalimer.data && <div className={style['disTips']} dangerouslySetInnerHTML={{__html: tipsDiscalimer.data.data[1].description}}></div>}
  432. {showTipsDetails && <DetailsModal
  433. showTipsDetails = {showTipsDetails}
  434. hideTips = {this.hideTips}
  435. tipsDetails = {tipsDetails}/>}
  436. </div>
  437. );
  438. }
  439. }
  440. export default PushItems;