index.jsx 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  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 = [],tmpDetail=[]
  75. for(let i = 0;i < checkedAssay.length;i++){
  76. let tmpObj = JSON.parse(JSON.stringify(obj));
  77. if (checkedAssay[i].controlType == 0) {
  78. tmpDetail = checkedAssay[i].questionMapping
  79. }else if(checkedAssay[i].controlType == 1 || checkedAssay[i].controlType == 6){
  80. tmpDetail.push(checkedAssay[i])
  81. }
  82. tmpObj.questionId = checkedAssay[i].id
  83. tmpObj.name = checkedAssay[i].name
  84. tmpObj.details = tmpDetail
  85. assayArr.push(tmpObj)
  86. }
  87. store.dispatch(addLabel(assayArr))
  88. }
  89. if(checkedCheck.length > 0){
  90. let checkArr = []
  91. for(let i = 0;i < checkedCheck.length;i++){
  92. let tmpObj = JSON.parse(JSON.stringify(obj1));
  93. tmpObj.questionId = checkedCheck[i].id
  94. tmpObj.name = checkedCheck[i].name
  95. checkArr.push(tmpObj)
  96. }
  97. store.dispatch(addAssistLabel(checkArr))
  98. }
  99. if(checkedAssay.length > 0){
  100. document.getElementById("inspectResultData").scrollIntoView(true)
  101. }else{
  102. if(checkedCheck.length > 0){
  103. document.getElementById("assistResultData").scrollIntoView(true)
  104. }else{
  105. return;
  106. }
  107. }
  108. }
  109. changeAssay(item) {
  110. this.props.changeAssay(item);
  111. }
  112. changeCheck(item) {
  113. this.props.changeCheck(item);
  114. }
  115. showTips(tips) {
  116. const { getTipsDetails, showTipsDetailsModal } = this.props;
  117. getTipsDetails && getTipsDetails();
  118. showTipsDetailsModal && showTipsDetailsModal()
  119. }
  120. hideTips() {
  121. const { hideTipsDetailsModal } = this.props;
  122. hideTipsDetailsModal && hideTipsDetailsModal()
  123. }
  124. componentDidMount() {
  125. const height = getWindowInnerHeight() - 200;
  126. this.$cont.current.style.height = height + "px";
  127. windowEventHandler('resize', ()=>{
  128. const height = getWindowInnerHeight() - 200;
  129. this.$cont.current.style.height = height + "px";
  130. });
  131. }
  132. render() {
  133. const {
  134. vigilant,
  135. determine,
  136. doubt,
  137. possible,
  138. assay,
  139. check,
  140. tips,
  141. showTipsDetails,
  142. tipsDetails
  143. } = this.props.pushMessage;
  144. const { tipsDiscalimer } = this.props;
  145. const { moreAssay, moreCheck } = this.state;
  146. const {
  147. showMore,
  148. closeMore,
  149. billing,
  150. changeCheck,
  151. changeAssay,
  152. showAdd,
  153. showTips
  154. } = this;
  155. let assayNum = 0;
  156. let assayNum2 = 0;
  157. let assayHide = assay.map((item, index) => {
  158. assayNum = assayNum + item.name.length + 2;
  159. if (assayNum > 28) {
  160. assayNum2 = assayNum2 + item.name.length + 2;
  161. if(assayNum2 > 23) {
  162. return;
  163. } else {
  164. return (
  165. <span>
  166. <input
  167. id={item.id + item.name}
  168. onChange={() => changeAssay(item)}
  169. type="checkbox"
  170. checked={item.checked}
  171. />
  172. <label for={item.id + item.name}>{item.name}</label>
  173. </span>
  174. );
  175. }
  176. } else {
  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. });
  190. const assays = assay.map(item => {
  191. return (
  192. <span>
  193. <input
  194. id={item.id + item.name}
  195. onChange={() => changeAssay(item)}
  196. type="checkbox"
  197. checked={item.checked}
  198. />
  199. <label for={item.id + item.name}>{item.name}</label>
  200. </span>
  201. );
  202. });
  203. let checkNum = 0;
  204. let checkNum2 = 0;
  205. let checkHide = check.map((item, index) => {
  206. checkNum = checkNum + item.name.length + 2;
  207. if (checkNum > 28) {
  208. checkNum2 = checkNum2 + item.name.length + 2;
  209. if(checkNum2 > 23) {
  210. return;
  211. }else {
  212. return (
  213. <span>
  214. <input
  215. id={item.id + item.name}
  216. onChange={() => changeCheck(item)}
  217. type="checkbox"
  218. checked={item.checked}
  219. />
  220. <label for={item.id + item.name}>{item.name}</label>
  221. </span>
  222. );
  223. }
  224. } else {
  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. });
  238. const checks = check.map(item => {
  239. return (
  240. <span>
  241. <input
  242. id={item.id + item.name}
  243. onChange={() => changeCheck(item)}
  244. type="checkbox"
  245. checked={item.checked}
  246. />
  247. <label for={item.id + item.name}>{item.name}</label>
  248. </span>
  249. );
  250. });
  251. const vigilants = vigilant.map((item, index) => {
  252. return <div key={item.id} className={style['push-diag-item']}><DiagnosticItem item={item}/></div>;
  253. });
  254. return (
  255. <div className={style["push-content-wrapper"]}>
  256. <div className={style["push-content"]} ref={this.$cont}>
  257. <div style = {{width: '420px'}}>
  258. {vigilant && vigilant.length > 0 && (
  259. <div className={style["vigilant"]}>
  260. <div className={style["title"]}>
  261. <img src={vigilantImg} />
  262. 警惕
  263. </div>
  264. <div className={style["vigilantContent"]}>{vigilants}</div>
  265. </div>
  266. )}
  267. {/* 不展示确诊 */}
  268. {/* {determine && determine.length>0 && <PushDiag titleBg='#FAEBEC' icon={possibleImg} title='确诊' diagList={determine} maxShowNum={28}/>} */}
  269. {doubt && doubt.length > 0 && (
  270. <PushDiag
  271. titleBg="#FAEBEC"
  272. icon={doubtImg}
  273. title="疑似诊断"
  274. diagList={doubt}
  275. maxShowNum={26}
  276. />
  277. )}
  278. {possible && possible.length > 0 && (
  279. <PushDiag
  280. titleBg="#FAEBEC"
  281. icon={possibleImg}
  282. title="可能诊断"
  283. diagList={possible}
  284. maxShowNum={26}
  285. />
  286. )}
  287. <div className={style["diagnose"]}>
  288. {vigilant.length === 0 &&
  289. determine.length === 0 &&
  290. doubt.length === 0 &&
  291. possible.length === 0 && (
  292. <div className={style["doubt"]}>
  293. <h1>
  294. <img src={doubtImg} />
  295. 疑似诊断
  296. </h1>
  297. <div className={style["no-push"]}>无</div>
  298. </div>
  299. )}
  300. </div>
  301. <div className={style["recommend"]}>
  302. <h1>
  303. <img src={recommendImg} />
  304. 推荐检验检查
  305. <div className={style["billing"]}
  306. style={assay.length === 0 && check.length === 0 ? {color: 'gray', border: '1px solid gray'} : ''}
  307. onClick={assay.length === 0 && check.length === 0 ? '' : billing}>
  308. 开单
  309. </div>
  310. </h1>
  311. <div>
  312. {assay.length === 0 && check.length === 0 ? (
  313. <span>无</span>
  314. ) : (
  315. <ul>
  316. <li className={style["firstLi"]}>
  317. <div className={style["title"]}>化验:</div>
  318. <div className={style["content"]}>
  319. {assay.length === 0
  320. ?<span >无</span>
  321. : moreAssay
  322. ? assays
  323. : assayHide}
  324. {assayNum2 > 23 ? (
  325. <span
  326. style={
  327. moreAssay
  328. ? { display: "none" }
  329. : { display: "inline-block" }
  330. }
  331. className={style["show"]}
  332. onClick={() => showMore("moreAssay")}
  333. >
  334. 更多
  335. <img src={showImg} />
  336. </span>
  337. ) : (
  338. ""
  339. )}
  340. <span
  341. style={
  342. moreAssay
  343. ? { display: "inline-block" }
  344. : { display: "none" }
  345. }
  346. className={style["close"]}
  347. onClick={() => closeMore("moreAssay")}
  348. >
  349. 收起
  350. <img src={hideImg} />
  351. </span>
  352. </div>
  353. </li>
  354. <li className={style["lastLi"]}>
  355. <div className={style["title"]}>检查:</div>
  356. <div className={style["content"]}>
  357. {check.length === 0
  358. ? "无"
  359. : moreCheck
  360. ? checks
  361. : checkHide}
  362. {checkNum2 > 23 ? (
  363. <span
  364. style={
  365. moreCheck
  366. ? { display: "none" }
  367. : { display: "inline-block" }
  368. }
  369. className={style["show"]}
  370. onClick={() => showMore("moreCheck")}
  371. >
  372. 更多
  373. <img src={showImg} />
  374. </span>
  375. ) : (
  376. ""
  377. )}
  378. <span
  379. style={
  380. moreCheck
  381. ? { display: "inline-block" }
  382. : { display: "none" }
  383. }
  384. className={style["close"]}
  385. onClick={() => closeMore("moreCheck")}
  386. >
  387. 收起
  388. <img src={hideImg} />
  389. </span>
  390. </div>
  391. </li>
  392. </ul>
  393. )}
  394. </div>
  395. </div>
  396. <div className={style["tips"]}>
  397. <h1>
  398. <img src={tipsImg} />
  399. 提示信息
  400. </h1>
  401. <div className={style["content"]}>
  402. {tips && tips.introduceDetailList ? (
  403. <div>
  404. <div className={style["title"]}>
  405. {tips.tagName}
  406. <span
  407. className={style["tips-details"]}
  408. onClick={() => showTips(tips)}
  409. >
  410. 详情
  411. </span>
  412. </div>
  413. {tips.introduceDetailList &&
  414. tips.introduceDetailList.map((item, index) => {
  415. return (
  416. item.position.indexOf("1") > -1 && (
  417. <div>
  418. <div
  419. dangerouslySetInnerHTML={{
  420. __html: item.title
  421. }}
  422. />
  423. <div
  424. dangerouslySetInnerHTML={{
  425. __html: item.content
  426. }}
  427. />
  428. {item.isReason === 1 && (
  429. <div className={style["warn"]}>
  430. {tipsDiscalimer.data.data[0].description}
  431. </div>
  432. )}
  433. </div>
  434. )
  435. );
  436. })}
  437. </div>
  438. ) : (
  439. "无"
  440. )}
  441. </div>
  442. </div>
  443. </div>
  444. </div>
  445. {tipsDiscalimer.data && <div className={style['disTips']} dangerouslySetInnerHTML={{__html: tipsDiscalimer.data.data[1].description}}></div>}
  446. {showTipsDetails && <DetailsModal
  447. showTipsDetails = {showTipsDetails}
  448. hideTips = {this.hideTips}
  449. tipsDetails = {tipsDetails}/>}
  450. </div>
  451. );
  452. }
  453. }
  454. export default PushItems;