index.jsx 15 KB

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