specimen-room-view.component.ts 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. import { Component, OnInit, ViewChild, OnDestroy } from "@angular/core";
  2. import { MainService } from "../../services/main.service";
  3. import { Router } from "@angular/router";
  4. import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
  5. import { startOfDay, format, endOfDay } from "date-fns";
  6. import { ToolService } from 'src/app/services/tool.service';
  7. import { NzMessageService } from "ng-zorro-antd";
  8. import { debounceTime } from 'rxjs/operators';
  9. import { Subject } from 'rxjs';
  10. import {
  11. FormBuilder,
  12. Validators,
  13. FormGroup,
  14. FormControl,
  15. } from "@angular/forms";
  16. @Component({
  17. selector: "app-specimen-room-view",
  18. templateUrl: "./specimen-room-view.component.html",
  19. styleUrls: ["./specimen-room-view.component.less"],
  20. })
  21. export class SpecimenRoomViewComponent implements OnInit, OnDestroy {
  22. @ViewChild("osComponentRef1", {
  23. read: OverlayScrollbarsComponent,
  24. static: false,
  25. })
  26. osComponentRef1: OverlayScrollbarsComponent;
  27. @ViewChild("osComponentRef2", {
  28. read: OverlayScrollbarsComponent,
  29. static: false,
  30. })
  31. osComponentRef2: OverlayScrollbarsComponent;
  32. @ViewChild("osComponentRef3", {
  33. read: OverlayScrollbarsComponent,
  34. static: false,
  35. })
  36. osComponentRef3: OverlayScrollbarsComponent;
  37. @ViewChild("osComponentRef4", {
  38. read: OverlayScrollbarsComponent,
  39. static: false,
  40. })
  41. osComponentRef4: OverlayScrollbarsComponent;
  42. @ViewChild("osComponentRef5", {
  43. read: OverlayScrollbarsComponent,
  44. static: false,
  45. })
  46. osComponentRef5: OverlayScrollbarsComponent;
  47. constructor(
  48. private mainService: MainService,
  49. public router: Router,
  50. public tool: ToolService,
  51. private fb: FormBuilder,
  52. private message: NzMessageService,
  53. ) {}
  54. // 今日药单量
  55. todayTotal: undefined;
  56. // 今日已完成
  57. todayComplete: undefined;
  58. //手术间数据
  59. printPharmacyList = []; //数据列表
  60. printPharmacyIdx = 0; //页码
  61. printPharmacyTotal = 0; //总数
  62. printPharmacyFlag = false; //是否查看更多
  63. printPharmacySearchKey = ""; //搜索的内容
  64. printPharmacyLoad = false; //按钮的loading
  65. // 标本间列表
  66. waitPharmacyList = [];
  67. waitPharmacyIdx = 0;
  68. waitPharmacyTotal = 0;
  69. waitPharmacyFlag = false;
  70. waitPharmacySearchKey = "";
  71. waitPharmacyLoad = false;
  72. // 今日离科列表
  73. pharmacyList = [];
  74. pharmacyIdx = 0;
  75. pharmacyTotal = 0;
  76. pharmacyFlag = false;
  77. pharmacySearchKey = "";
  78. pharmacyLoad = false;
  79. // 配送中列表
  80. distributionList = [];
  81. distributionIdx = 0;
  82. distributionTotal = 0;
  83. distributionFlag = false;
  84. distributionSearchKey = "";
  85. distributionLoad = false;
  86. // 已完成列表
  87. completedList = [];
  88. completedIdx = 0;
  89. completedTotal = 0;
  90. completedFlag = false;
  91. completedSearchKey = "";
  92. completedLoad = false;
  93. barCode:any; //条码搜索
  94. // other
  95. loginUser: any = localStorage.getItem("user")
  96. ? JSON.parse(localStorage.getItem("user")).user
  97. : null; //登录人信息
  98. logTimer = null; //定时器
  99. logTime = 0; //自动刷新秒数
  100. logTimeConst = 60; //自动刷新秒数
  101. time = new Date().getTime(); // 时间戳
  102. timer = null; // 时间定时器
  103. relevanceModal:boolean = false //关联标本和手术室
  104. validateForm: FormGroup; //关联标本和手术室表单
  105. validateVerificationForm: FormGroup; //核验标本
  106. specimenData:any = []; //标本间数据
  107. operationData:any = []; //手术间数据
  108. fixationModal:boolean = false //标本接收固定
  109. verificationMoadl:boolean = false //标本核验
  110. specimenCode:any; //标本条码
  111. listOfData:any=[];
  112. fixativeData:any = []; //固体液类型
  113. hosId:any;
  114. userId:any;
  115. detailsData:any;
  116. isSpinning:boolean = false; //全屏加载状态
  117. codeData:any; //标本条码数据
  118. btnInfoLoading :boolean = false; //标本加固加载
  119. searchMsg:any = null;
  120. changeInpSubject = new Subject(); //防抖
  121. changeInpSubjectSpecimen = new Subject(); //防抖
  122. ngOnDestroy() {
  123. clearTimeout(this.timer);
  124. clearTimeout(this.logTimer);
  125. }
  126. ngOnInit() {
  127. this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  128. this.searchSpecimenData(v[0])
  129. });
  130. this.changeInpSubjectSpecimen.pipe(debounceTime(500)).subscribe((v) => {
  131. this.searchSpecimen(v[0])
  132. });
  133. this.hosId = this.tool.getCurrentHospital().id;
  134. this.userId = this.tool.getCurrentUserId()
  135. // 手术间列表
  136. this.getPharmacyList(this.printPharmacyIdx, 'surgeryDept', this.printPharmacySearchKey);
  137. // 标本间列表
  138. this.getPharmacyList(this.waitPharmacyIdx, 'specimenDept', this.waitPharmacySearchKey);
  139. // 今日离科标本列表
  140. this.getPharmacyList(this.pharmacyIdx, 'leavedDept', this.pharmacySearchKey);
  141. this.runTime();
  142. this.getDept()
  143. this.initRole();
  144. // 自动刷新倒计时 start
  145. this.autoUpdate();
  146. // 自动刷新倒计时 end
  147. setTimeout(_=>{
  148. document.getElementById('Binput').focus();
  149. },200)
  150. }
  151. // 当前时间日期
  152. runTime() {
  153. clearTimeout(this.timer);
  154. this.timer = setTimeout(() => {
  155. this.time = Date.now();
  156. this.runTime();
  157. }, 500);
  158. }
  159. // 标本核对
  160. batchNo:any = null;
  161. specimenCheck(){
  162. this.batchNo = localStorage.getItem("specimenBatchNo")
  163. if(this.batchNo){
  164. localStorage.setItem("checkType",'specimenDept')
  165. this.router.navigateByUrl(`/pathologyCheck?batchNo=${this.batchNo}`);
  166. }else{
  167. this.mainService.generateBatchNumber()
  168. .subscribe((res:any) =>{
  169. localStorage.setItem("specimenBatchNo",res.data)
  170. localStorage.setItem("checkType",'specimenDept')
  171. this.router.navigateByUrl(`/pathologyCheck?batchNo=${res.data}`);
  172. })
  173. }
  174. }
  175. // 标本条码搜索
  176. codeDataSpecimenList:any = null;
  177. fixType:any = false
  178. searchSpecimen(e){
  179. if(!this.barCode){
  180. return
  181. }
  182. if(this.barCode.length < 10) {
  183. return
  184. }
  185. let data={
  186. barcode:e
  187. }
  188. this.isSpinning = true
  189. clearInterval(this.logTimer);
  190. this.mainService.pathologyScanCode(data)
  191. .subscribe((res:any) => {
  192. this.isSpinning = false
  193. if(res.status==200){
  194. this.codeData = res.data[0]
  195. this.codeDataSpecimenList = this.codeData.pathologySpecimenDTOList
  196. // this.codeDataSpecimenList = this.codeData.pathologySpecimenDTOList.filter(i=>!i.fixationTime)
  197. let item = null
  198. let str = null
  199. if(e.indexOf(':')!=-1){
  200. str = e.split(':')
  201. item = this.codeData.pathologySpecimenDTOList.find(i=>i.specimenCode == str[1])
  202. }else{
  203. item = this.codeData.pathologySpecimenDTOList.find(i=>i.specimenCode == e)
  204. }
  205. if(!item.fixationTime && this.codeData.pathologyFormType==0){
  206. if(this.codeData.status.value==2 || this.codeData.status.value==3 ||
  207. this.codeData.status.value==4){
  208. // this.fixType = false
  209. if(this.codeData.pathologyInspectDTOS){
  210. this.project = this.codeData.pathologyInspectDTOS.map(i=>{
  211. return i.inspectProject.name
  212. })
  213. this.project = this.project.join('、')
  214. }
  215. this.getFixationNum(this.codeData.id)
  216. }else{
  217. this.viewDetail(this.codeData,'4')
  218. }
  219. this.fixationError = null
  220. this.searchMsg = null
  221. }else if(item.fixationTime && this.codeData.pathologyFormType==0){
  222. if(item.storageTime){
  223. this.viewDetail(this.codeData,'4')
  224. }else{
  225. if(this.codeData.pathologyInspectDTOS){
  226. this.project = this.codeData.pathologyInspectDTOS.map(i=>{
  227. return i.inspectProject.name
  228. })
  229. this.project = this.project.join('、')
  230. }
  231. this.getFixationNum(this.codeData.id)
  232. }
  233. // if(this.codeData.status.value==2 || this.codeData.status.value==3 || this.codeData.status.value==4){
  234. // if(this.codeData.pathologyInspectDTOS){
  235. // this.project = this.codeData.pathologyInspectDTOS.map(i=>{
  236. // return i.inspectProject.name
  237. // })
  238. // this.project = this.project.join('、')
  239. // }
  240. // this.getFixationNum(this.codeData.id)
  241. // }else{
  242. // this.viewDetail(this.codeData,'4')
  243. // }
  244. this.barCode = null
  245. this.fixationError = null
  246. this.searchMsg = null
  247. }else{
  248. this.barCode = null
  249. this.fixationError = null
  250. this.searchMsg = '该申请单类型不是病理检查申请单'
  251. }
  252. }else{
  253. this.barCode = null
  254. this.searchMsg = res.msg
  255. }
  256. })
  257. }
  258. // 获取申请单扫标本信息
  259. fixationNum:any;
  260. specimenNum:any;
  261. totalNum:any
  262. getFixationNum(id){
  263. this.mainService.pathologyCheckPrint('pathologyForm',id,{
  264. operationType:'fixation'
  265. }).subscribe((res:any)=>{
  266. this.fixationModal = true
  267. this.fixationNum = res.fixationNum
  268. this.specimenNum = res.specimenNum
  269. this.totalNum = res.totalNum
  270. setTimeout(_=>{
  271. document.getElementById('specimen').focus();
  272. },200)
  273. })
  274. }
  275. // 选择固定时间
  276. fixationTime:any;
  277. fixationData:any;
  278. fixationDateChange(result){
  279. this.fixationData = format(result, 'yyyy-MM-dd');
  280. console.log(this.fixationData)
  281. }
  282. fixationTimeSelect:any = null;
  283. fixationTimeChange(result){
  284. if(result){
  285. this.fixationTimeSelect = format(result, 'HH:mm');
  286. }else{
  287. this.fixationTimeSelect = null
  288. }
  289. console.log(this.fixationData + ' ' + this.fixationTimeSelect)
  290. }
  291. // 确定接受固定标本
  292. startDate:any;
  293. ifFixType:any = false;
  294. submitFixationForm(){
  295. let item = this.codeDataSpecimenList.filter(i=>!i.fixationTime)
  296. console.log(1111,item)
  297. this.validateVerificationForm = this.fb.group({
  298. fixationTimes: [null, [Validators.required]],
  299. fixationDate: [null, [Validators.required]],
  300. jobNumber: [null, [Validators.required]],
  301. name:[null, [Validators.required]],
  302. // nurseJobNumber: [null, [Validators.required]],
  303. // nurseName:[null, [Validators.required]],
  304. fixative:[null, [Validators.required]],
  305. });
  306. let date = new Date();
  307. let inVitroDate = format(date, "yyyy-MM-dd")
  308. if(item.length==0){
  309. this.ifFixType = true
  310. this.validateVerificationForm.removeControl('fixationTimes')
  311. this.validateVerificationForm.removeControl('fixationDate')
  312. this.validateVerificationForm.removeControl('fixative')
  313. }else{
  314. this.ifFixType = false
  315. this.validateVerificationForm.addControl(
  316. 'fixationTimes',
  317. new FormControl(null, Validators.required)
  318. );
  319. this.validateVerificationForm.addControl(
  320. 'fixationDate',
  321. new FormControl(null, Validators.required)
  322. );
  323. this.validateVerificationForm.addControl(
  324. 'fixative',
  325. new FormControl(null, Validators.required)
  326. );
  327. this.validateVerificationForm.controls.fixationDate.setValue(inVitroDate);
  328. this.validateVerificationForm.controls.fixationTimes.setValue(date);
  329. this.fixationData = inVitroDate;
  330. this.fixationTimeSelect = format(date, 'HH:mm');
  331. }
  332. this.btnLoading = true
  333. this.mainService.getDictionary("list", "fixing_liquid_type").subscribe((res) => {
  334. this.fixativeData = res
  335. if(!this.ifFixType){
  336. let item = this.fixativeData.find(i=>i.value==1)
  337. this.validateVerificationForm.controls.fixative.setValue(item.id);
  338. }
  339. this.btnLoading = false
  340. this.verificationMoadl = true
  341. });
  342. }
  343. // 关闭接受固定标本
  344. hideSpecimenModal(){
  345. this.autoUpdate()
  346. this.cancelSpecimenModal()
  347. this.barCode = null;
  348. this.specimenCode = null;
  349. this.fixationError = null
  350. this.fixationModal = false;
  351. setTimeout(_=>{
  352. document.getElementById('Binput').focus();
  353. },200)
  354. }
  355. cancelSpecimenModal(){
  356. let ids = []
  357. for(let i of this.codeDataSpecimenList){
  358. ids.push(i.id)
  359. }
  360. let data = {
  361. pathologySpecimenIds:ids.join(',')
  362. }
  363. this.mainService.pathologyOperation(data,'cancel').subscribe((res) =>{
  364. })
  365. }
  366. // 获取标本详情
  367. project:any = [];
  368. getSampleData(item){
  369. this.mainService.getFetchData("data", "pathologyForm", item.id)
  370. .subscribe((data) => {
  371. this.isSpinning = false
  372. this.detailsData = data.data
  373. this.specimenList = data.data.pathologySpecimenDTOList||[]
  374. this.pathologyLogs = data.data.formLogDTOS
  375. this.stepLength = this.pathologyLogs.length
  376. if(this.detailsData.pathologyInspectDTOS){
  377. this.project = this.detailsData.pathologyInspectDTOS.map(i=>{
  378. return i.inspectProject.name
  379. })
  380. this.project = this.project.join('、')
  381. }
  382. this.detailMoadl = true
  383. });
  384. }
  385. // 关闭查看标本
  386. closeSpecimenModal(){
  387. this.specimenViewDialog = false
  388. }
  389. // 查看标本
  390. specimenViewDialog:any = false;
  391. viewData:any = [];
  392. specimenItem:any;
  393. specimenView(item){
  394. this.viewData = []
  395. this.specimenViewDialog = true
  396. this.specimenItem = item;
  397. this.viewData.push(item)
  398. }
  399. // 获取科室
  400. getDept(){
  401. this.validateForm = this.fb.group({
  402. specimen: [null, [Validators.required]],
  403. operation: [null, [Validators.required]],
  404. generate:[null, [Validators.required]],
  405. showFrozen:[null, [Validators.required]],
  406. });
  407. var that = this;
  408. that.mainService.getDictionary("list", "dept_type").subscribe((res2) => {
  409. let item1 = res2.find(i=>i.name=='手术室科室')
  410. let item2 = res2.find(i=>i.name=='标本间科室')
  411. let data1 = {
  412. idx: 0,
  413. sum: 9999,
  414. department: {
  415. hospital: { id: that.hosId || "" },
  416. type: { id: item1.id || "" },
  417. },
  418. };
  419. let data2 = {
  420. idx: 0,
  421. sum: 9999,
  422. department: {
  423. hospital: { id: that.hosId || "" },
  424. type: { id: item2.id || "" },
  425. },
  426. };
  427. that.mainService
  428. .getFetchDataList("data", "department", data1)
  429. .subscribe((res) => {
  430. that.operationData = res.list;
  431. });
  432. that.mainService
  433. .getFetchDataList("data", "department", data2)
  434. .subscribe((res) => {
  435. that.specimenData = res.list
  436. this.getDeptDetail()
  437. });
  438. });
  439. }
  440. // 获取关联科室详情
  441. getDeptDetail(){
  442. this.mainService
  443. .transfusionPrint("user", this.userId)
  444. .subscribe((res) => {
  445. let data = res.data;
  446. if(data.surgeryDepts){
  447. let deptArr = []
  448. for(let i of data.surgeryDepts){
  449. deptArr.push(i.id)
  450. }
  451. this.validateForm.controls.operation.setValue(deptArr);
  452. }
  453. this.validateForm.controls.specimen.setValue(data.dept.id);
  454. if(data.showFrozen!=null){
  455. this.validateForm.controls.showFrozen.setValue(data.showFrozen);
  456. }else{
  457. this.validateForm.controls.showFrozen.setValue(0);
  458. }
  459. if(data.autoCreateOrder!=null){
  460. this.validateForm.controls.generate.setValue(data.autoCreateOrder);
  461. }else{
  462. this.validateForm.controls.generate.setValue(1);
  463. }
  464. });
  465. }
  466. // 获取是否关联标本间
  467. setSpecimen(){
  468. this.relevanceModal = true
  469. }
  470. hideModal(){
  471. this.relevanceModal = false
  472. }
  473. // 确定关联科室
  474. btnLoading:boolean = false;
  475. submitForm(){
  476. for (const i in this.validateForm.controls) {
  477. this.validateForm.controls[i].markAsDirty();
  478. this.validateForm.controls[i].updateValueAndValidity();
  479. }
  480. if (this.validateForm.invalid) return;
  481. let deptArr = this.validateForm.value.operation.join(',')
  482. let data = {
  483. user: {
  484. autoCreateOrder: this.validateForm.value.generate,
  485. showFrozen: this.validateForm.value.showFrozen,
  486. dept:{
  487. id:this.validateForm.value.specimen
  488. },
  489. surgeryDeptIds:deptArr,
  490. id:this.userId
  491. },
  492. };
  493. this.btnLoading = true
  494. this.mainService
  495. .coopData("updData", "user", data)
  496. .subscribe((data) => {
  497. this.getNewDept()
  498. // 手术间列表
  499. this.getPharmacyList(this.printPharmacyIdx, 'surgeryDept', this.printPharmacySearchKey);
  500. // 标本间列表
  501. this.getPharmacyList(this.waitPharmacyIdx, 'specimenDept', this.waitPharmacySearchKey);
  502. // 今日离科标本列表
  503. this.getPharmacyList(this.pharmacyIdx, 'leavedDept', this.pharmacySearchKey);
  504. this.btnLoading = false
  505. this.relevanceModal = false
  506. if (data.status == 200) {
  507. this.showPromptModal("操作", true, "");
  508. } else {
  509. this.showPromptModal("操作", false, data.msg);
  510. }
  511. });
  512. }
  513. getNewDept(){
  514. let postData = {
  515. currentHosId: this.hosId,
  516. loginType: "PC",
  517. };
  518. this.mainService.changeHospital(postData).subscribe((result) => {
  519. if (result.status == 200) {
  520. this.getCurrentUserNow();
  521. // let dataObj = {
  522. // user: {
  523. // dept: {
  524. // id: this.validateForm.value.specimen,
  525. // },
  526. // id: JSON.parse(localStorage.getItem("user")).user.id,
  527. // },
  528. // };
  529. // this.mainService
  530. // .coopData("updData", "user", dataObj)
  531. // .subscribe((data) => {
  532. // if (data.status == 200) {
  533. // }
  534. // });
  535. }
  536. });
  537. }
  538. // 获取当前用户信息
  539. getCurrentUserNow() {
  540. this.mainService.getCurrentUser1().subscribe((data:any) => {
  541. if (data["status"] == 200) {
  542. this.loginUser = data.data
  543. let user = JSON.parse(localStorage.getItem("user"));
  544. user.user.dept = data["data"].dept;
  545. user.user.autoCreateOrder = data["data"].autoCreateOrder;
  546. user.user.currentHospital = data["data"].currentHospital;
  547. localStorage.setItem("user", JSON.stringify(user));
  548. }
  549. });
  550. }
  551. // 输入工号查询姓名
  552. handoverUserId:any = null; //医生工号
  553. nurseId:any = null; //护士工号
  554. numberChange(e,type){
  555. if(e.length < 3) {
  556. this.validateVerificationForm.controls.name.setValue('');
  557. return
  558. }
  559. let query = {
  560. account: e
  561. };
  562. this.mainService
  563. .jobSearch(query)
  564. .subscribe((data:any) => {
  565. if(data.status==200){
  566. if(type==1){
  567. this.validateVerificationForm.controls.name.setValue(data.userName);
  568. this.handoverUserId = data.userId
  569. }else{
  570. // this.validateVerificationForm.controls.nurseName.setValue(data.userName);
  571. // this.nurseId = data.userId
  572. }
  573. }
  574. });
  575. }
  576. // 提交固定标本接收
  577. submitVerificationForm(){
  578. if(!this.ifFixType && !this.fixationTimeSelect && this.fixationTimeSelect == null){
  579. this.message.error('请选择固定时间')
  580. return
  581. }
  582. for (const i in this.validateVerificationForm.controls) {
  583. this.validateVerificationForm.controls[i].markAsDirty();
  584. this.validateVerificationForm.controls[i].updateValueAndValidity();
  585. }
  586. if (this.validateVerificationForm.invalid) return;
  587. let arr = []
  588. // if(!this.ifFixType){
  589. // arr = this.codeDataSpecimenList.filter(i=>!i.fixationTime)
  590. // }else{
  591. // arr = this.codeDataSpecimenList.filter(i=>i.fixationTime)
  592. // }
  593. let str = this.codeDataSpecimenList.map(i=>{
  594. return i.specimenCode
  595. })
  596. let data: any = {
  597. id:this.codeData.id,
  598. specimenDeptId:this.validateForm.value.specimen,
  599. specimenFixingLiquid:{
  600. id:''
  601. },
  602. specimenCodes:str.join(','),
  603. fixationTime:'',
  604. hosId: this.hosId || "" ,
  605. doctor:this.handoverUserId,
  606. nurse:this.nurseId
  607. };
  608. if(!this.ifFixType){
  609. data.specimenFixingLiquid.id = this.validateVerificationForm.value.fixative
  610. data.fixationTime = this.fixationData + ' ' + this.fixationTimeSelect+':00'
  611. }else{
  612. delete data.specimenFixingLiquid.id
  613. delete data.fixationTime
  614. }
  615. this.btnInfoLoading = true;
  616. this.mainService
  617. .simplePost("addData", "pathologyForm", data)
  618. .subscribe((res) => {
  619. this.autoUpdate(false)
  620. this.btnInfoLoading = false;
  621. this.barCode = null;
  622. // 手术间列表
  623. this.getPharmacyList(this.printPharmacyIdx, 'surgeryDept', this.printPharmacySearchKey);
  624. // 标本间列表
  625. this.getPharmacyList(this.waitPharmacyIdx, 'specimenDept', this.waitPharmacySearchKey);
  626. // 今日离科标本列表
  627. this.getPharmacyList(this.pharmacyIdx, 'leavedDept', this.pharmacySearchKey);
  628. if (res.status == 200) {
  629. this.message.success('操作成功')
  630. setTimeout(_=>{
  631. this.verificationMoadl = false
  632. this.fixationModal = false
  633. document.getElementById('Binput').focus();
  634. },200)
  635. // this.showPromptModal("操作", true, "");
  636. } else {
  637. this.message.error(res.msg)
  638. // this.showPromptModal("操作", false, res.msg);
  639. }
  640. });
  641. }
  642. closeModel(){
  643. this.verificationMoadl = false
  644. this.fixationModal = false
  645. setTimeout(_=>{
  646. document.getElementById('Binput').focus();
  647. },200)
  648. }
  649. // 关闭固定接受标本
  650. hideVerificationModal(){
  651. this.verificationMoadl = false
  652. setTimeout(_=>{
  653. document.getElementById('Binput').focus();
  654. },200)
  655. }
  656. // 监听标本条码
  657. specimenCodeChange(e){
  658. this.changeInpSubjectSpecimen.next([e]);
  659. }
  660. // 监听接受固定标本条码
  661. tableLoading:boolean = false;
  662. codeChange(e){
  663. this.changeInpSubject.next([e]);
  664. }
  665. fixationError:any;
  666. searchSpecimenData(e){
  667. if(!e){
  668. return
  669. }
  670. if(e.length < 10) {
  671. return
  672. }
  673. this.tableLoading = true
  674. this.mainService.pathologyScanCode({
  675. barcode:e,
  676. pathologyFormId:this.codeData.id
  677. })
  678. .subscribe((res:any) => {
  679. this.autoUpdate(false)
  680. this.tableLoading = false
  681. this.specimenCode = null
  682. if(res.status==200){
  683. let item = null
  684. let str = null
  685. if(e.indexOf(':')!=-1){
  686. str = e.split(':')
  687. item = res.data[0].pathologySpecimenDTOList.find(i=>i.specimenCode == str[1])
  688. }else{
  689. item = res.data[0].pathologySpecimenDTOList.find(i=>i.specimenCode == e)
  690. }
  691. // let item = res.data[0].pathologySpecimenDTOList.find(i=>i.specimenCode == e)
  692. if(item.fixationTime && item.storageTime){
  693. this.fixationError = '该标本已存放标本间'
  694. }else{
  695. this.getFixationNum(res.data[0].id)
  696. this.codeData = res.data[0]
  697. // this.codeDataSpecimenList = this.codeData.pathologySpecimenDTOList.filter(i=>!i.fixationTime)
  698. this.codeDataSpecimenList = this.codeData.pathologySpecimenDTOList
  699. this.fixationError = null
  700. }
  701. }else{
  702. this.fixationError = res.msg
  703. }
  704. })
  705. }
  706. // 查看详情
  707. detailMoadl:boolean = false;
  708. pathologyLogs:any=[];
  709. specimenList:any=[]
  710. stepLength:any = 0;
  711. viewDetail(item,type){
  712. this.isSpinning = true
  713. this.getSampleData(item)
  714. clearInterval(this.logTimer);
  715. }
  716. closeDetailMoadl(){
  717. setTimeout(_=>{
  718. document.getElementById('Binput').focus();
  719. },200)
  720. this.detailMoadl = false
  721. this.autoUpdate(false);
  722. }
  723. // 自动刷新倒计时
  724. autoUpdate(flag = true) {
  725. if (flag) {
  726. this.logTime = this.logTimeConst;
  727. }
  728. clearInterval(this.logTimer);
  729. this.logTimer = setInterval(() => {
  730. this.logTime--;
  731. if (this.logTime === 0) {
  732. this.logTime = this.logTimeConst;
  733. // 代收急查标本(标本信息)列表
  734. this.getPharmacyList(0, 'surgeryDept', this.printPharmacySearchKey);
  735. // 已收取(工单信息)列表
  736. this.getPharmacyList(0, 'specimenDept', this.waitPharmacySearchKey);
  737. // 中转标本(标本统计信息)列表
  738. this.getPharmacyList(0, 'leavedDept', this.pharmacySearchKey);
  739. }
  740. }, 1000);
  741. }
  742. // 药房端药房列表查询、搜索
  743. // 1为pc待打印状态、2为pc配药中、3为pc核对中、4为pc配送中
  744. // searchKey 为搜索的关键字,没有就不传
  745. loading1 = false;
  746. loading2 = false;
  747. loading3 = false;
  748. loading4 = false;
  749. loading5 = false;
  750. otherData1 = null;
  751. otherData2 = null;
  752. otherData3 = null;
  753. getPharmacyList(idx, type, searchKey) {
  754. let hosId = JSON.parse(localStorage.getItem("user")).user.currentHospital.id;
  755. switch (type) {
  756. case 'surgeryDept':
  757. this.loading1 = true;
  758. break;
  759. case 'specimenDept':
  760. this.loading2 = true;
  761. break;
  762. case 'leavedDept':
  763. this.loading3 = true;
  764. break;
  765. }
  766. let postData = {
  767. idx: 0,
  768. sum: 50,
  769. pathologyForm:{
  770. detailsType: type,
  771. keyWords:searchKey,
  772. hosId,
  773. }
  774. };
  775. this.mainService
  776. .getFetchDataList("data", "pathologyForm", postData)
  777. .subscribe((result) => {
  778. switch (type) {
  779. case 'surgeryDept':
  780. this.loading1 = false;
  781. break;
  782. case 'specimenDept':
  783. this.loading2 = false;
  784. break;
  785. case 'leavedDept':
  786. this.loading3 = false;
  787. break;
  788. }
  789. if (result["status"] == 200) {
  790. switch (type) {
  791. case 'surgeryDept':
  792. // 总数
  793. this.printPharmacyTotal = result.totalNum;
  794. // 隐藏按钮的loading
  795. this.printPharmacyLoad = false;
  796. // 查看更多,是否显示
  797. if (result["list"].length < 10) {
  798. this.printPharmacyFlag = false;
  799. } else if (result["list"].length === 0 && idx === 0) {
  800. this.printPharmacyFlag = false;
  801. } else {
  802. this.printPharmacyFlag = true;
  803. }
  804. this.otherData1 = result.otherData;
  805. // 列表数据合并
  806. if (idx === 0) {
  807. this.printPharmacyList = result["list"];
  808. } else {
  809. this.printPharmacyList = [
  810. ...this.printPharmacyList,
  811. ...result["list"],
  812. ];
  813. }
  814. break;
  815. case 'specimenDept':
  816. this.waitPharmacyTotal = result.totalNum;
  817. this.waitPharmacyLoad = false;
  818. if (result["list"].length < 10) {
  819. this.waitPharmacyFlag = false;
  820. } else if (result["list"].length === 0 && idx === 0) {
  821. this.waitPharmacyFlag = false;
  822. } else {
  823. this.waitPharmacyFlag = true;
  824. }
  825. this.otherData2 = result.otherData;
  826. if (idx === 0) {
  827. this.waitPharmacyList = result["list"];
  828. } else {
  829. this.waitPharmacyList = [
  830. ...this.waitPharmacyList,
  831. ...result["list"],
  832. ];
  833. }
  834. break;
  835. case 'leavedDept':
  836. this.pharmacyTotal = result.totalNum;
  837. this.pharmacyLoad = false;
  838. if (result["list"].length < 10) {
  839. this.pharmacyFlag = false;
  840. } else if (result["list"].length === 0 && idx === 0) {
  841. this.pharmacyFlag = false;
  842. } else {
  843. this.pharmacyFlag = true;
  844. }
  845. this.otherData3 = result.otherData;
  846. if (idx === 0) {
  847. this.pharmacyList = result["list"];
  848. } else {
  849. this.pharmacyList = [...this.pharmacyList, ...result["list"]];
  850. }
  851. break;
  852. }
  853. }
  854. });
  855. }
  856. // 加载更多
  857. // loadMore(type) {
  858. // switch (type) {
  859. // case 'surgeryDept':
  860. // this.printPharmacyIdx++;
  861. // this.printPharmacyLoad = true;
  862. // this.getPharmacyList(
  863. // this.printPharmacyIdx,
  864. // type,
  865. // this.printPharmacySearchKey
  866. // );
  867. // break;
  868. // case 'specimenDept':
  869. // this.waitPharmacyIdx++;
  870. // this.waitPharmacyLoad = true;
  871. // this.getPharmacyList(
  872. // this.waitPharmacyIdx,
  873. // type,
  874. // this.waitPharmacySearchKey
  875. // );
  876. // break;
  877. // case 'leavedDept':
  878. // this.pharmacyIdx++;
  879. // this.pharmacyLoad = true;
  880. // this.getPharmacyList(this.pharmacyIdx, type, this.pharmacySearchKey);
  881. // break;
  882. // }
  883. // }
  884. // 搜索关键词
  885. searchKeyHandle(type) {
  886. switch (type) {
  887. case 'surgeryDept':
  888. this.printPharmacyIdx = 0; //页码重置
  889. this.printPharmacyList = []; //列表重置
  890. this.getPharmacyList(
  891. this.printPharmacyIdx,
  892. type,
  893. this.printPharmacySearchKey
  894. );
  895. break;
  896. case 'specimenDept':
  897. this.waitPharmacyIdx = 0; //页码重置
  898. this.waitPharmacyList = []; //列表重置
  899. this.getPharmacyList(
  900. this.waitPharmacyIdx,
  901. type,
  902. this.waitPharmacySearchKey
  903. );
  904. break;
  905. case 'leavedDept':
  906. this.pharmacyIdx = 0; //页码重置
  907. this.pharmacyList = []; //列表重置
  908. this.getPharmacyList(this.pharmacyIdx, type, this.pharmacySearchKey);
  909. break;
  910. }
  911. }
  912. // 退出
  913. logOut(): void {
  914. // 假退出
  915. let hospital = this.tool.getCurrentHospital();
  916. if(hospital){
  917. this.router.navigate(["login", hospital.id]);
  918. }else{
  919. this.router.navigateByUrl("login");
  920. }
  921. localStorage.removeItem("user");
  922. localStorage.removeItem("menu");
  923. localStorage.removeItem("index");
  924. // 假退出
  925. this.mainService.logOut().subscribe((data) => {
  926. if (data.status == 200) {
  927. if(hospital){
  928. this.router.navigate(["login", hospital.id]);
  929. }else{
  930. this.router.navigateByUrl("login");
  931. }
  932. localStorage.removeItem("user");
  933. localStorage.removeItem("menu");
  934. localStorage.removeItem("index");
  935. }
  936. });
  937. }
  938. // 右侧菜单
  939. showLastItems: boolean = false;
  940. showDropdown:boolean = false;
  941. // 下拉
  942. fixedMenuXiala() {
  943. this.showLastItems = true;
  944. }
  945. // 上拉
  946. fixedMenuShangla() {
  947. this.showLastItems = false;
  948. }
  949. // 回到系统管理
  950. toMain() {
  951. this.router.navigateByUrl("main");
  952. }
  953. // 配送记录
  954. distributionRecord(){
  955. this.router.navigateByUrl("main/batchDistribution");
  956. }
  957. mainRole: boolean = false; //回到系统管理权限
  958. initRole() {
  959. let menus = JSON.parse(localStorage.getItem("menu"));
  960. console.log("菜单数量" + menus.length);
  961. if (menus.length >= 2) {
  962. this.mainRole = true;
  963. return;
  964. }
  965. }
  966. // 切换右侧菜单Tab
  967. fixedTab: string = "";
  968. checkFixedTab(type: string) {
  969. if (type == "toSystem") {
  970. this.router.navigateByUrl("main");
  971. }
  972. if (this.fixedTab == type) {
  973. this.fixedTab = "";
  974. } else {
  975. this.fixedTab = type;
  976. }
  977. }
  978. //药房端科室切换
  979. changeShow = true;
  980. closeTime = 3;
  981. closeTimeFlag = 0;
  982. hsPromptModalShow: boolean = false; //科室切换提示框是否展示
  983. timerCloseTime = null;
  984. deptDisplay = 1; //护士端是否显示可以别名,1是显示科室名称,2是显示科室别名
  985. //子传父接收
  986. closeModelHs(e) {
  987. this.hsPromptModalShow = JSON.parse(e).show;
  988. this.changeShow = JSON.parse(e).changeShow;
  989. }
  990. //子传父接收
  991. clearModelHs(e) {
  992. if (JSON.parse(e).clear === true) {
  993. clearInterval(this.timerCloseTime);
  994. }
  995. this.changeShow = JSON.parse(e).changeShow;
  996. }
  997. // 头部切换科室
  998. changeKsNow() {
  999. this.hsPromptModalShow = true;
  1000. clearInterval(this.timerCloseTime);
  1001. this.changeShow = false;
  1002. }
  1003. // 切换科室
  1004. changeKs() {
  1005. this.hsPromptModalShow = true;
  1006. // (1) 当用户设置为正数时,用户必须查看此窗体指定秒数。
  1007. // (2) 当用户设置为负数时,用户可点击知道了也可倒计时自动关闭。
  1008. // (3) 如果用户填写0则为无自动关闭和强制查看时间。
  1009. if (this.closeTimeFlag === 0) {
  1010. return;
  1011. }
  1012. this.closeTime = Math.abs(this.closeTimeFlag);
  1013. clearInterval(this.timerCloseTime);
  1014. this.timerCloseTime = setInterval(() => {
  1015. this.closeTime = Math.max(--this.closeTime, 0);
  1016. if (this.closeTime === 0) {
  1017. if (this.closeTimeFlag <= 0) {
  1018. this.hsPromptModalShow = false;
  1019. }
  1020. clearInterval(this.timerCloseTime);
  1021. }
  1022. }, 1000);
  1023. }
  1024. promptModalShow:boolean = false;
  1025. promptContent:any = null;
  1026. ifSuccess:any = null;
  1027. promptInfo:any = null;
  1028. // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
  1029. showPromptModal(con, success, promptInfo?) {
  1030. this.promptModalShow = false;
  1031. this.promptContent = con;
  1032. this.ifSuccess = success;
  1033. this.promptInfo = promptInfo;
  1034. setTimeout(() => {
  1035. this.promptModalShow = true;
  1036. }, 100);
  1037. }
  1038. }