hushijiandan.component.ts 184 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831
  1. import {
  2. Component,
  3. ElementRef,
  4. OnInit,
  5. TemplateRef,
  6. ViewChild,
  7. } from "@angular/core";
  8. import {
  9. FormBuilder,
  10. Validators,
  11. FormGroup,
  12. FormControl,
  13. } from "@angular/forms";
  14. import { Router, ActivatedRoute } from "@angular/router";
  15. import http from "../../../assets/js/http";
  16. import { MainService } from "../../services/main.service";
  17. import { WebsocketNurseService } from "../../services/websocket-nurse.service";
  18. import { NzMessageService, UploadFile } from "ng-zorro-antd";
  19. import { NzNotificationService } from "ng-zorro-antd/notification";
  20. import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
  21. import { ToolService } from "../../services/tool.service";
  22. import { Subject } from "rxjs";
  23. import { debounceTime, filter } from "rxjs/operators";
  24. import { HttpRequest, HttpResponse, HttpClient } from '@angular/common/http';
  25. import {
  26. format,
  27. getMinutes,
  28. setMinutes,
  29. addDays,
  30. differenceInCalendarDays,
  31. getHours,
  32. startOfDay,
  33. endOfDay,
  34. parse,
  35. subHours,
  36. startOfMinute,
  37. addMinutes
  38. } from "date-fns";
  39. import { SourceId } from "src/app/type/types";
  40. import cloneDeep from 'lodash-es/cloneDeep'
  41. // 日期禁用
  42. function range(start: number, end: number): number[] {
  43. const result: number[] = [];
  44. for (let i = start; i < end; i++) {
  45. result.push(i);
  46. }
  47. return result;
  48. }
  49. @Component({
  50. selector: "app-hushijiandan",
  51. templateUrl: "./hushijiandan.component.html",
  52. styleUrls: ["./hushijiandan.component.less"],
  53. })
  54. export class HushijiandanComponent implements OnInit {
  55. @ViewChild('printBtn', { static: false }) printBtn: ElementRef<HTMLElement>;
  56. @ViewChild("remarksEle", { static: false }) remarksEle: ElementRef;
  57. @ViewChild("remarksEle1", { static: false }) remarksEle1: ElementRef;
  58. @ViewChild("remarksEle2", { static: false }) remarksEle2: ElementRef;
  59. @ViewChild("osComponentRef1", {
  60. read: OverlayScrollbarsComponent,
  61. static: false,
  62. })
  63. osComponentRef1: OverlayScrollbarsComponent;
  64. @ViewChild("osComponentRef2", {
  65. read: OverlayScrollbarsComponent,
  66. static: false,
  67. })
  68. osComponentRef2: OverlayScrollbarsComponent;
  69. @ViewChild("osComponentRef3", {
  70. read: OverlayScrollbarsComponent,
  71. static: false,
  72. })
  73. osComponentRef3: OverlayScrollbarsComponent;
  74. @ViewChild("osComponentRef4", {
  75. read: OverlayScrollbarsComponent,
  76. static: false,
  77. })
  78. osComponentRef4: OverlayScrollbarsComponent;
  79. // @ViewChild("osComponentRef5", {
  80. // read: OverlayScrollbarsComponent,
  81. // static: false,
  82. // })
  83. // osComponentRef5: OverlayScrollbarsComponent;
  84. @ViewChild("osComponentRef6", {
  85. read: OverlayScrollbarsComponent,
  86. static: false,
  87. })
  88. osComponentRef6: OverlayScrollbarsComponent;
  89. @ViewChild("osComponentRef7", {
  90. read: OverlayScrollbarsComponent,
  91. static: false,
  92. })
  93. osComponentRef7: OverlayScrollbarsComponent;
  94. @ViewChild("osComponentRef8", {
  95. read: OverlayScrollbarsComponent,
  96. static: false,
  97. })
  98. osComponentRef8: OverlayScrollbarsComponent;
  99. @ViewChild("osComponentRef9", {
  100. read: OverlayScrollbarsComponent,
  101. static: false,
  102. })
  103. osComponentRef9: OverlayScrollbarsComponent;
  104. @ViewChild("osComponentRef10", {
  105. read: OverlayScrollbarsComponent,
  106. static: false,
  107. })
  108. osComponentRef10: OverlayScrollbarsComponent;
  109. @ViewChild("osComponentRef11", {
  110. read: OverlayScrollbarsComponent,
  111. static: false,
  112. })
  113. osComponentRef11: OverlayScrollbarsComponent;
  114. othersListOptions: any;
  115. sortableTimer = null;
  116. searchAccountSubject = new Subject(); //查工号防抖
  117. searchTabInpSubject = new Subject(); //左侧查患者信息和检查信息防抖
  118. otherSearchChangeSubject = new Subject(); //其他建单搜索防抖
  119. inspectSubject = new Subject();
  120. changeAssetInpSubject = new Subject();
  121. changeCommonInpSubject = new Subject();
  122. isYyInspect = false; //需要预约检查
  123. inspectAndPatientTransportConfig:any = {timeMod: 30};
  124. constructor(
  125. private message: NzMessageService,
  126. private fb: FormBuilder,
  127. public router: Router,
  128. private route: ActivatedRoute,
  129. private mainService: MainService,
  130. private notification: NzNotificationService,
  131. private webs: WebsocketNurseService,
  132. public tool: ToolService,
  133. public http: HttpClient
  134. ) {
  135. this.othersListOptions = {
  136. onUpdate: (event: any) => {
  137. // 触发一次排序
  138. clearTimeout(this.sortableTimer);
  139. this.sortableTimer = setTimeout(() => {
  140. let postData = {
  141. orders: [],
  142. tabId: this.checkedTableType == 'other' ? undefined : this.checkedTableType,
  143. };
  144. postData.orders = this.othersList[this.checkedTableType].map((item, i) => {
  145. return {
  146. id: item.id,
  147. orders: i,
  148. };
  149. });
  150. this.mainService
  151. .coopConfig("setOrders", postData)
  152. .subscribe((result) => {});
  153. }, 500);
  154. },
  155. };
  156. }
  157. // 下拉
  158. showDropdown:boolean = false;
  159. // 关闭倒计时
  160. closeTime = 3;
  161. closeTimeFlag;
  162. timerCloseTime = null;
  163. changeShow = true;
  164. currentHospital; //当前院区
  165. currentDept; //当前科室
  166. logTimer = null; //综合日志定时器
  167. logTime = 0; //综合日志自动刷新秒数
  168. logTimeConst = 60; //综合日志自动刷新秒数
  169. orderListTimer = null; //工单列表定时器
  170. orderListTime = 0; //工单列表自动刷新秒数
  171. orderListTimeConst = 60; //工单列表自动刷新秒数
  172. deptDisplay; //护士端是否显示可以别名,1是显示科室名称,2是显示科室别名
  173. pathologyModal:boolean = false; //病理申请单
  174. pathologyDetailModal:boolean = false; //病理详情
  175. // 初始化权限按钮
  176. coopBtns: any = {};
  177. surgeryDataId: any; //手术id
  178. patientDataId: any; //病人id
  179. smartShow:boolean = false; //智能客服弹框
  180. userId:any;
  181. ngOnInit() {
  182. this.getCoopBtns();
  183. this.currentHospital = this.tool.getCurrentHospital();
  184. this.userId = this.tool.getCurrentUserId();
  185. this.tool.getDeptDisplay().subscribe((result) => {
  186. if (result.status == 200) {
  187. this.deptDisplay = result.list[0].valueconfig;
  188. }
  189. });
  190. this.getItsmIncident();
  191. this.getPagePermissionConfigList();
  192. this.getInspectAndPatientTransportConfigTasktype();
  193. this.getUpdateTipsForNurses();
  194. this.getRefreshNurseWorkOrderTime();
  195. this.getCloseTimeFlag();
  196. this.getCmdbRepairFlag();
  197. this.currentDept = this.tool.getCurrentUserDept();
  198. console.log(this.currentDept, this.tabSearchCont);
  199. this.currentDept.typeValue == 'surgery' && !this.tabSearchCont && this.getSurgeryConfig();
  200. this.getSpecimenButton();
  201. //防抖
  202. this.getAccountList();
  203. this.searchAccountSubject.pipe(debounceTime(500)).subscribe((v:any) => {
  204. this.getAccountList(v);
  205. });
  206. this.searchTabInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  207. this.getPatient(v);
  208. });
  209. this.otherSearchChangeSubject.pipe(debounceTime(500)).subscribe((v) => {
  210. this.getDeptTaskType(v);
  211. });
  212. this.inspectSubject.pipe(debounceTime(500)).subscribe((v) => {
  213. this.refreshInspectList();
  214. });
  215. this.changeAssetInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  216. this.getAssetData(v);
  217. });
  218. this.changeCommonInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  219. this.searchApplicationCategory(v);
  220. });
  221. this.getTodayNum();
  222. this.initLogin();
  223. this.getDeptTaskType();
  224. this.getAdvice();
  225. this.getOrderSelectList();
  226. this.getCheckStatusLis();
  227. this.refreshSpecimenWorkOrderMsg();
  228. this.initRole();
  229. this.getWebsocket();
  230. this.getTaskTypesId();
  231. // 综合日志倒计时 start
  232. this.logTime = this.logTimeConst;
  233. clearInterval(this.logTimer);
  234. this.logTimer = setInterval(() => {
  235. this.logTime--;
  236. if (this.logTime === 0) {
  237. this.logTime = this.logTimeConst;
  238. if (this.smallTabId == 1) {
  239. this.listDeptOrderRecord();
  240. } else if (this.smallTabId == 2) {
  241. this.getQuickBxlb();
  242. }
  243. this.getTodayNum(); //当日工单数量
  244. }
  245. }, 1000);
  246. // 综合日志倒计时 end
  247. }
  248. ngOnDestroy() {
  249. clearInterval(this.moveId);
  250. clearInterval(this.moveId1);
  251. clearInterval(this.msgTimerId);
  252. clearInterval(this.logTimer);
  253. clearInterval(this.orderListTimer);
  254. this.webs.closeWs(true);
  255. }
  256. loginUser: any = localStorage.getItem("user")
  257. ? JSON.parse(localStorage.getItem("user")).user
  258. : null; //登录人信息
  259. loginUserDeptId: number = JSON.parse(localStorage.getItem("user")).user.dept
  260. .id; //登录人所属科室
  261. appointmentBuildFlag = "0"; //是否开启护士端预约建单-患者陪检
  262. appointmentZyBuildFlag = "0"; //是否开启护士端预约建单-患者其他
  263. leadTime = 0; //护士端预约建单生效时长
  264. followFlag = "0"; //是否开启护士端终点关注
  265. promptContent: string; //操作提示框提示信息
  266. ifSuccess: boolean; //操作成功/失败
  267. promptInfo: string; //操作结果提示信息
  268. back: string; //操作结果后回调标识
  269. promptModalShow: boolean; //操作提示框是否展示
  270. hsPromptModalShow: boolean = false; //护士端科室切换提示框是否展示
  271. deptTaskTypeRules: any = {}; //当前登录科室任务类型信息规则
  272. orderSelectList: any = []; //工单列表筛选选项
  273. orderSelected = "-1"; //工单列表下拉框选中
  274. orderStateSelected = "1"; //工单列表工单状态下拉框选中
  275. tabSearchCont: string = ""; //左侧tab搜索框内容
  276. pLoading: boolean = true; //患者信息loading
  277. patientList: any = []; //左侧tab患者信息list
  278. infoPageIdx: number = 1; //左侧tab页码
  279. infoLength: number = 5; //左侧tab信息总数
  280. specimenWorkOrderMsg: any = {}; //急标普标数量&信息
  281. jpDrugsWKOMsg: any = {}; //药品静配提示信息
  282. surgeryWKOMsg: any = {}; //手术提示信息
  283. detailId:any = null; //病理申请单详情id
  284. getCoopBtns(){
  285. let menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
  286. let coopBtns:any = {};
  287. let nurseMenu = menu.find(v => v.link === 'nurse');
  288. let nurseMenuChildren = nurseMenu.childrens || [];
  289. nurseMenuChildren.forEach((e) => {
  290. switch (e.link) {
  291. case "suggestionBox":
  292. coopBtns.suggestionBox = true; //意见箱
  293. break;
  294. case "surgery":
  295. coopBtns.surgery = true; //手术排程信息
  296. break;
  297. case "outpatientHelpAppointment":
  298. coopBtns.outpatientHelpAppointment = true; //门诊帮扶预约
  299. break;
  300. case "inquiryOfHistoricalSpecimens":
  301. coopBtns.inquiryOfHistoricalSpecimens = true; //历史标本查询
  302. break;
  303. case "historicalMedicineListInquiry":
  304. coopBtns.historicalMedicineListInquiry = true; //历史药单查询
  305. break;
  306. case "repairList":
  307. coopBtns.repairList = true; //报修列表
  308. break;
  309. case "buildOrdersForOtherTasks":
  310. coopBtns.buildOrdersForOtherTasks = true; //其他任务建单
  311. break;
  312. }
  313. });
  314. this.coopBtns = coopBtns;
  315. console.log(this.coopBtns);
  316. }
  317. // 关闭客服弹框
  318. smartClose(e){
  319. this.smartShow = false;
  320. }
  321. // 打开客服弹框
  322. smartOpen(e?){
  323. this.smartShow = true;
  324. }
  325. // 预览图片
  326. imgs = [];
  327. isPreview = false;
  328. initialViewIndex:number = 0;
  329. previewImageHandler(data = [], index = 0) {
  330. this.initialViewIndex = index;
  331. console.log(index)
  332. this.isPreview = false;
  333. data = data || [];
  334. this.imgs = data.map((v) => location.origin + '/file' + v.relativeFilePath);
  335. setTimeout(() => {
  336. this.isPreview = true;
  337. }, 0)
  338. }
  339. // 图片相关
  340. showUploadList = {
  341. showPreviewIcon: true,
  342. showRemoveIcon: true,
  343. hidePreviewIconInNonImage: true
  344. };
  345. fileList = [
  346. // {
  347. // uid: -1,
  348. // name: 'xxx.png',
  349. // status: '1',
  350. // url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
  351. // }
  352. ];
  353. previewImage: string | undefined = '';
  354. previewVisible = false;
  355. repairImgs:any[] = [];//报修图片
  356. handlePreview = (file: UploadFile) => {
  357. console.log('file1:', file)
  358. this.previewImage = file.url || file.thumbUrl;
  359. this.previewVisible = true;
  360. };
  361. beforeUpload = (file: UploadFile): boolean => {
  362. console.log('file2:', file)
  363. this.fileList = [...this.fileList, file];
  364. setTimeout(async () => {
  365. file.url = await this.getBase64(file);
  366. }, 0);
  367. console.log('this.fileList:', this.fileList)
  368. return true;
  369. };
  370. getBase64(file: any): Promise<any> {
  371. return new Promise((resolve, reject) => {
  372. const reader = new FileReader();
  373. reader.readAsDataURL(file);
  374. reader.onload = () => resolve(reader.result);
  375. reader.onerror = error => reject(error);
  376. });
  377. }
  378. // 临时上传图片
  379. temporarilyUrl = this.mainService.returnUploadUrl('wechatRequesterIncident', 0);
  380. // 图片上传
  381. uploadImages(file, id){
  382. const formData = new FormData();
  383. formData.append('file', file);
  384. formData.append('fileName', file.name);
  385. const req = new HttpRequest('Post', this.mainService.returnUploadUrl('wechatRequesterIncident', id), formData, {
  386. reportProgress: true
  387. });
  388. return this.http.request(req).pipe(filter(e => e instanceof HttpResponse)).toPromise();
  389. }
  390. // 获取任务类型(病理标本)
  391. taskTypeData:any;
  392. getTaskTypesId() {
  393. this.mainService.getDictionary("list", "ordinary_field").subscribe((data) => {
  394. this.taskTypeData = data.find(i=>i.value=='pathology')
  395. this.getPathologySys();
  396. });
  397. }
  398. // 获取标本配置
  399. autoCreate:any;
  400. pathologyFrozenSpecime:any;
  401. getPathologySys(){
  402. let postData = {
  403. idx: 0,
  404. sum: 10,
  405. taskTypeConfig: {
  406. hosId:this.currentHospital.id,
  407. taskType:this.taskTypeData.id
  408. }
  409. }
  410. this.mainService
  411. .getFetchDataList("simple/data", "taskTypeConfig", postData)
  412. .subscribe((result) => {
  413. if (result.status == 200) {
  414. if(Array.isArray(result.list) && result.list[0]){
  415. this.autoCreate = result.list[0].autoCreate;
  416. this.pathologyFrozenSpecime = result.list[0].pathologyFrozenSpecimenNum;
  417. }
  418. }
  419. });
  420. }
  421. // 新增申请单自选类型
  422. applicationType:any;
  423. isPathologyVisible:any = false;
  424. addPathologyType(type){
  425. this.applicationType = type
  426. if(type ==1 && this.pathologyFrozenSpecime == 1){
  427. this.submitPathlogyForm()
  428. }else{
  429. if(this.viewData.length>0){
  430. this.isPathologyVisible = true
  431. }else{
  432. this.submitPathlogyForm()
  433. }
  434. }
  435. }
  436. // 取消新增申请单自选类型
  437. handlePathologyCancel(){
  438. this.applicationType = null
  439. this.isPathologyVisible = false
  440. }
  441. // 确定新增申请单自选类型
  442. handlePathologyOk(){
  443. this.submitPathlogyForm()
  444. }
  445. // 新增申请单自选类型
  446. submitPathlogyForm(){
  447. if(this.openType=='btn'){
  448. this.surgeryDataId = this.surgeryWKOMsg.id
  449. this.patientDataId = this.surgeryWKOMsg.patientDTO.id
  450. }else{
  451. this.surgeryDataId = this.scheduleItem.id
  452. this.patientDataId = this.scheduleItem.patientDTO.id
  453. }
  454. let data = {
  455. idx: 0,
  456. sum: 9999,
  457. surgeryId: this.surgeryDataId || "",
  458. patientId: this.patientDataId || "",
  459. hosId: this.currentHospital.id || "" ,
  460. operationType: 'pathologyForm',
  461. pathologyFormType: this.applicationType
  462. };
  463. this.mainService
  464. .simplePost("addData", "pathologyForm", data)
  465. .subscribe((data) => {
  466. this.detailId = data.data.id
  467. this.isPathologyVisible = false
  468. this.multiDialog = false
  469. this.pathologyModal = true
  470. });
  471. }
  472. // 手术排程-病理申请单
  473. openType:any;
  474. scheduleItem:any;
  475. pathologyAddItem(e,item){
  476. this.openType = 'schedule'
  477. this.scheduleItem = item
  478. // this.surgeryDataId = item.id
  479. // this.patientDataId = item.patientDTO.id
  480. let data = {
  481. idx: 0,
  482. sum: 9999,
  483. pathologyForm: {
  484. surgeryId: item.id || "",
  485. patientId: item.patientDTO.id || "",
  486. surgeryDeptId:this.loginUser.dept.id,
  487. // hosId: this.currentHospital.id || "" ,
  488. operationType: 'pathologyForm',
  489. order:'createTime desc',
  490. },
  491. };
  492. this.isSpinning = true
  493. this.mainService
  494. .getFetchDataList("data", "pathologyForm", data)
  495. .subscribe((data) => {
  496. this.isSpinning = false
  497. this.viewData = data.list
  498. for(let i of this.viewData){
  499. if(i.pathologyInspectDTOS){
  500. i.arr = []
  501. for(let x of i.pathologyInspectDTOS){
  502. i.arr.push(x.inspectProject.name)
  503. }
  504. }
  505. }
  506. this.multiDialog = true
  507. });
  508. }
  509. // 病理申请单
  510. multiDialog:any = false;
  511. isSpinning:any = false;
  512. viewData:any = [];
  513. pathologyAdd(e){
  514. this.openType = 'btn'
  515. this.surgeryDataId = this.surgeryWKOMsg.id
  516. this.patientDataId = this.surgeryWKOMsg.patientDTO.id
  517. let data = {
  518. idx: 0,
  519. sum: 9999,
  520. pathologyForm: {
  521. surgeryId: this.surgeryWKOMsg.id || "",
  522. patientId: this.surgeryWKOMsg.patientDTO.id || "",
  523. surgeryDeptId:this.loginUser.dept.id,
  524. // hosId: this.currentHospital.id || "" ,
  525. operationType: 'pathologyForm',
  526. order:'createTime desc'
  527. },
  528. };
  529. this.isSpinning = true
  530. this.mainService
  531. .getFetchDataList("data", "pathologyForm", data)
  532. .subscribe((data) => {
  533. this.isSpinning = false
  534. this.viewData = data.list
  535. for(let i of this.viewData){
  536. if(i.pathologyInspectDTOS){
  537. i.arr = []
  538. for(let x of i.pathologyInspectDTOS){
  539. i.arr.push(x.inspectProject.name)
  540. }
  541. }
  542. }
  543. this.multiDialog = true
  544. });
  545. }
  546. // 获取病理申请单最新数据
  547. getPathologyData(){
  548. if(this.openType=='btn'){
  549. this.surgeryDataId = this.surgeryWKOMsg.id
  550. this.patientDataId = this.surgeryWKOMsg.patientDTO.id
  551. }else{
  552. this.surgeryDataId = this.scheduleItem.id
  553. this.patientDataId = this.scheduleItem.patientDTO.id
  554. }
  555. let data = {
  556. idx: 0,
  557. sum: 9999,
  558. pathologyForm: {
  559. surgeryId: this.surgeryDataId || "",
  560. patientId: this.patientDataId || "",
  561. hosId: this.currentHospital.id || "" ,
  562. surgeryDeptId:this.loginUser.dept.id,
  563. operationType: 'pathologyForm',
  564. order:'createTime desc'
  565. },
  566. };
  567. this.isSpinning = true
  568. this.mainService
  569. .getFetchDataList("data", "pathologyForm", data)
  570. .subscribe((data) => {
  571. this.isSpinning = false
  572. this.viewData = data.list
  573. for(let i of this.viewData){
  574. if(i.pathologyInspectDTOS){
  575. i.arr = []
  576. for(let x of i.pathologyInspectDTOS){
  577. i.arr.push(x.inspectProject.name)
  578. }
  579. }
  580. }
  581. })
  582. }
  583. // 申请单号点击
  584. itemClick(item){
  585. this.detailId = item.id
  586. this.multiDialog = false
  587. setTimeout(_=>{
  588. if(!item.status){
  589. this.pathologyModal = true
  590. return
  591. }
  592. if(item.status && (item.status.value==1 || item.status.value==2 ||
  593. item.status.value==3 || item.status.value==4)){
  594. this.pathologyModal = true
  595. }else{
  596. this.pathologyDetailModal = true
  597. }
  598. },200)
  599. }
  600. // 申请单作废
  601. cancellationLoading:any = false;
  602. cancellationModal:any = false;
  603. cancellation(data){
  604. this.coopId = data.id
  605. this.cancellationModal = true
  606. }
  607. // 确定作废
  608. confirmCancellation(){
  609. this.cancellationLoading = true;
  610. this.mainService
  611. .coopTypeConfig('rmvData', 'pathologyForm', [this.coopId])
  612. .subscribe((data) => {
  613. this.cancellationLoading = false;
  614. this.cancelCancellation();
  615. if (data["status"] == 200) {
  616. this.showPromptModal("作废", true, "", "application");
  617. } else {
  618. this.showPromptModal("作废", false, data["msg"]);
  619. }
  620. });
  621. }
  622. // 取消作废
  623. cancelCancellation(){
  624. this.cancellationModal = false
  625. }
  626. hideModal(){
  627. this.multiDialog = false
  628. }
  629. pathologyDetailCancel(){
  630. this.pathologyDetailModal = false
  631. }
  632. pathologyCancel(){
  633. this.pathologyModal = false
  634. }
  635. // 切换综合日志和一键报修
  636. smallTabs = [];
  637. smallTabId = 2; //默认显示一键报修
  638. changeSmallTab(id) {
  639. this.smallTabId = id;
  640. if (id == 1) {
  641. this.listDeptOrderRecord();
  642. } else if (id == 2) {
  643. this.getQuickBxlb();
  644. }
  645. }
  646. // 获取当日建单总数
  647. todayNum = ""; //当日建单总数
  648. getTodayNum() {
  649. this.mainService
  650. .getFetchDataList("nurse", "workOrder", {
  651. idx: 0,
  652. sum: 1,
  653. workOrder: {
  654. createDept: this.loginUser.dept.id,
  655. startTime1: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  656. endTime1: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  657. },
  658. })
  659. .subscribe((data) => {
  660. if (data.status == 200) {
  661. this.todayNum = data.totalNum || 0;
  662. }
  663. });
  664. }
  665. // 获取报修区域(所属院区)
  666. // areas: any = []; //区域(所属院区)列表
  667. // getArea() {
  668. // this.areas = [];
  669. // this.mainService
  670. // .fetchListBx("area", { idx: 0, sum: 1000 })
  671. // .subscribe((result: any) => {
  672. // if (result.status == 200) {
  673. // this.areas = result.list;
  674. // if (this.areas.length) {
  675. // this.bxForm.controls.hospital.setValue(this.areas[0].id);
  676. // } else {
  677. // this.bxForm.controls.hospital.setValue(null);
  678. // }
  679. // }
  680. // });
  681. // }
  682. //根据区域(所属院区)获取地点(楼栋)
  683. places: any = []; //地点(楼栋)列表
  684. getPlace(buildingId) {
  685. this.places = [];
  686. this.mainService
  687. .fetchListBx("place", {
  688. idx: 0,
  689. sum: 1000,
  690. place: { area: { id: buildingId } },
  691. })
  692. .subscribe((result: any) => {
  693. if (result.status == 200) {
  694. this.places = result.list;
  695. if (this.places.length) {
  696. this.bxForm.controls.building.setValue(this.places[0].id);
  697. } else {
  698. this.bxForm.controls.building.setValue(null);
  699. }
  700. }
  701. });
  702. }
  703. btnLoading: boolean = false; //确认按钮loading状态
  704. workOrderRemark = ""; //备注
  705. workOrderRemark1 = ""; //备注
  706. workOrderRemark2 = ""; //备注
  707. workOrderRemarkTips = ""; //备注提示
  708. workOrderRemarkTips1 = ""; //备注提示
  709. workOrderRemarkTips2 = ""; //备注提示
  710. customRemarks = []; //备注快速输入
  711. customRemarks1 = []; //备注快速输入
  712. customRemarks2 = []; //备注快速输入
  713. // 添加备注
  714. addRemarks(item) {
  715. this.remarksEle.nativeElement.focus();
  716. this.workOrderRemark += item;
  717. }
  718. // 添加备注
  719. addRemarks1(item) {
  720. this.remarksEle1.nativeElement.focus();
  721. this.workOrderRemark1 += item;
  722. }
  723. // 添加备注
  724. addRemarks2(item) {
  725. this.remarksEle2.nativeElement.focus();
  726. this.workOrderRemark2 += item;
  727. }
  728. // 立即执行
  729. coopItem: any = {};
  730. execModal: boolean = false;
  731. // 打开立即执行模态框
  732. openExecModal(item) {
  733. this.coopItem = item;
  734. // 是否允许提前执行
  735. if(item.taskType.executeSwitch == 1){
  736. this.execModal = true;
  737. }else{
  738. this.showPromptModal("操作", false, "相关任务会到点执行,无需立即执行。有问题请联系相关科室!");
  739. }
  740. }
  741. // 确认立即执行
  742. confirmExec() {
  743. this.btnLoading = true;
  744. this.mainService.executeNow(this.coopItem.id, {userId: this.userId}).subscribe((result: any) => {
  745. this.closeExecModal();
  746. if (result.status == 200) {
  747. this.showPromptModal("立即执行", true, "");
  748. this.getOrderList();
  749. } else {
  750. this.showPromptModal("立即执行", false, result.msg);
  751. }
  752. });
  753. }
  754. // 关闭立即执行模态框
  755. closeExecModal() {
  756. this.execModal = false;
  757. }
  758. // 快捷配置背景色
  759. backColorComputed(icon){
  760. if(icon === 'transport-biaobenxinxi'){
  761. return 'specimen';
  762. }else if(icon === 'transport-shuyeguanli'){
  763. return 'blood';
  764. }else if(icon === 'transport-yaopinshuju'){
  765. return 'drugbag';
  766. }else if(icon === 'transport-baoxiu'){
  767. return 'incident';
  768. }else if(icon === 'transport-peihuguanli'){
  769. return 'inspect';
  770. }else if(icon === 'transport-dabao'){
  771. return 'specimenPackage';
  772. }else{
  773. return '';
  774. }
  775. }
  776. // 获取快捷配置列表
  777. pagePermissionConfigList: any[] = []; //表格数据
  778. getPagePermissionConfigList() {
  779. let data = {
  780. idx: 0,
  781. sum: 99999,
  782. pagePermissionConfig: {
  783. hosId: this.currentHospital.id,
  784. active: 1,
  785. taskTypeDeptId: this.loginUser.dept.id,
  786. },
  787. };
  788. this.mainService
  789. .getFetchDataList("simple/data", "pagePermissionConfig", data)
  790. .subscribe((data) => {
  791. let pagePermissionConfigList = data.list || [];
  792. pagePermissionConfigList.forEach(v => {
  793. if(v.urgentIds){
  794. let urgentIds = v.urgentIds.split(',');
  795. v.urgentFlag = urgentIds.some(v => v == 1);
  796. v.ordinaryFlag = urgentIds.some(v => v == 2);
  797. }
  798. })
  799. this.pagePermissionConfigList = pagePermissionConfigList;
  800. });
  801. }
  802. // 获取系统配置
  803. isShowBx = false;// 护士端是否显示报修
  804. isAssign = false;// 是否护士指定人员
  805. getItsmIncident() {
  806. let postData = { idx: 0, sum: 100, hospitalConfig: { hosId: this.currentHospital.id } };
  807. this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe((result) => {
  808. if (result.status == 200) {
  809. this.isShowBx = result.list.find(v => v.key == 'hos_itsmIncident').value == 1;
  810. this.isAssign = result.list.find(v => v.key == 'nurseSendOrder').value == 1;
  811. if (this.isShowBx && this.coopBtns.repairList && !this.checkedTableType) {
  812. // 初始化默认显示第一个
  813. console.log(this.tabPermission)
  814. // if(this.tabPermission.length){
  815. // this.checkedTableType = (this.tabPermission[0] && this.tabPermission[0].system) ? 'other' : this.tabPermission[0].id;
  816. // }else if(this.coopBtns.suggestionBox){
  817. // this.checkedTableType = 'advice';
  818. // this.checkTable(this.checkedTableType);
  819. // }else if(this.coopBtns.surgery){
  820. // this.checkedTableType = 'surgery';
  821. // this.checkTable(this.checkedTableType);
  822. // }else if(this.coopBtns.outpatientHelpAppointment){
  823. // this.checkedTableType = 'outpatientHelpAppointment';
  824. // this.checkTable(this.checkedTableType);
  825. // }else if(this.coopBtns.inquiryOfHistoricalSpecimens){
  826. // this.checkedTableType = 'historySpecimen';
  827. // this.checkTable(this.checkedTableType);
  828. // }else if(this.coopBtns.historicalMedicineListInquiry){
  829. // this.checkedTableType = 'historyDrugsbag';
  830. // this.checkTable(this.checkedTableType);
  831. // }else if(this.coopBtns.repairList && this.isShowBx){
  832. // this.checkedTableType = 'bxlb';
  833. // this.checkTable(this.checkedTableType);
  834. // }
  835. this.smallTabs = [
  836. { id: 1, name: "综合日志" },
  837. { id: 2, name: "一键报修" },
  838. ];
  839. this.smallTabId = 2;
  840. this.getQuickBxlb();
  841. this.getBxlb(this.bxlbPageIndex, true);
  842. } else {
  843. this.smallTabs = [{ id: 1, name: "综合日志" }];
  844. this.smallTabId = 1;
  845. this.listDeptOrderRecord();
  846. }
  847. }
  848. });
  849. }
  850. // 派单,flag 0是待抢单指派,1是待到达指派
  851. allotWorker(id, stateId, flag?) {
  852. if (flag == 1) {
  853. this.router.navigateByUrl("nurse/allotWorker/" + id + "/" + stateId + "/1/" + this.currentHospital.id);
  854. } else {
  855. this.router.navigateByUrl("nurse/allotWorker/" + id + "/" + stateId + "/0/" + this.currentHospital.id);
  856. }
  857. }
  858. //获取检查页面任务类型
  859. getInspectAndPatientTransportConfigTasktype() {
  860. let postData = {
  861. idx: 0,
  862. sum: 10,
  863. taskType: {
  864. simpleQuery: true,
  865. hosId: {
  866. id: this.currentHospital.id
  867. },
  868. associationType: {
  869. key:"association_types",
  870. value: 'inspect'
  871. }
  872. }
  873. };
  874. this.mainService
  875. .getFetchDataList("simple/data", "taskType", postData)
  876. .subscribe((result) => {
  877. if (result.status == 200) {
  878. let tasktype:any = result.list[0] || {};
  879. this.getInspectAndPatientTransportConfig(tasktype);
  880. }
  881. });
  882. }
  883. // 获取检查页面信息配置
  884. getInspectAndPatientTransportConfig(tasktype) {
  885. let postData = {
  886. idx: 0,
  887. sum: 10,
  888. taskTypeConfig: {
  889. taskTypeDTO: {
  890. hosId: {
  891. id: this.currentHospital.id
  892. },
  893. associationType: tasktype.associationType
  894. }
  895. }
  896. };
  897. this.mainService
  898. .getFetchDataList("simple/data", "taskTypeConfig", postData)
  899. .subscribe((result) => {
  900. if (result.status == 200) {
  901. let inspectAndPatientTransportConfig = result.list[0] || {};
  902. this.inspectAndPatientTransportConfig = {...this.inspectAndPatientTransportConfig, ...inspectAndPatientTransportConfig};
  903. // 是否显示排队信息
  904. if(this.inspectAndPatientTransportConfig.queuingInformation == 1){
  905. this.getQueuingInformation();
  906. }
  907. this.initForm();
  908. }
  909. });
  910. }
  911. // 获取排队信息
  912. queuingInformationList:any[] = [];
  913. getQueuingInformation() {
  914. this.mainService
  915. .coopWorkerOrder("queuingInformation", {})
  916. .subscribe((result) => {
  917. if(result.status == 200){
  918. this.queuingInformationList = result.datalist || [];
  919. }
  920. });
  921. }
  922. // 获取护士端更新提示
  923. updateTipsForNurses = "";
  924. getUpdateTipsForNurses() {
  925. let postData = {
  926. idx: 0,
  927. sum: 1,
  928. systemConfiguration: { keyconfig: "updateTipsForNurses" },
  929. };
  930. this.mainService
  931. .getFetchDataList("simple/data", "systemConfiguration", postData)
  932. .subscribe((result) => {
  933. if (result.status == 200) {
  934. this.updateTipsForNurses = result.list[0].valueconfig;
  935. }
  936. });
  937. }
  938. // 获取护士工单列表刷新速度
  939. getRefreshNurseWorkOrderTime() {
  940. let postData = {
  941. idx: 0,
  942. sum: 1,
  943. systemConfiguration: { keyconfig: "refreshNurseWorkOrderTime" },
  944. };
  945. this.mainService
  946. .getFetchDataList("simple/data", "systemConfiguration", postData)
  947. .subscribe((result) => {
  948. if (result.status == 200) {
  949. this.orderListTimeConst = result.list[0].valueconfig;
  950. // 工单列表倒计时 start
  951. this.orderListTime = this.orderListTimeConst;
  952. clearInterval(this.orderListTimer);
  953. this.orderListTimer = setInterval(() => {
  954. this.orderListTime--;
  955. if (this.orderListTime === 0) {
  956. this.orderListTime = this.orderListTimeConst;
  957. this.getOrderList();
  958. }
  959. }, 1000);
  960. // 工单列表倒计时 end
  961. }
  962. });
  963. }
  964. // 获取标本按钮
  965. specimenButton = "";
  966. getSpecimenButton() {
  967. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  968. return;
  969. }
  970. let postData = {
  971. idx: 0,
  972. sum: 1,
  973. systemConfiguration: { keyconfig: "specimenButton" },
  974. };
  975. this.mainService
  976. .getFetchDataList("simple/data", "systemConfiguration", postData)
  977. .subscribe((result) => {
  978. if (result.status == 200) {
  979. this.specimenButton = result.list[0].valueconfig;
  980. }
  981. });
  982. }
  983. // 获取护士端弹窗的配置
  984. // (1) 当用户设置为正数时,用户必须查看此窗体指定秒数。
  985. // (2) 当用户设置为负数时,用户可点击知道了也可倒计时自动关闭。
  986. // (3) 如果用户填写0则为无自动关闭和强制查看时间。
  987. getCloseTimeFlag() {
  988. let postData = {
  989. idx: 0,
  990. sum: 1,
  991. systemConfiguration: { keyconfig: "nurseDeptSwitchTip" },
  992. };
  993. this.mainService
  994. .getFetchDataList("simple/data", "systemConfiguration", postData)
  995. .subscribe((result) => {
  996. if (result.status == 200) {
  997. this.closeTimeFlag = result.list[0].valueconfig - 0;
  998. this.changeKs();
  999. }
  1000. });
  1001. }
  1002. // 获取资产报修是否开启
  1003. cmdbRepair:Boolean = false;
  1004. getCmdbRepairFlag() {
  1005. let postData = {
  1006. idx: 0,
  1007. sum: 1,
  1008. systemConfiguration: { keyconfig: "cmdbRepair" },
  1009. };
  1010. this.mainService
  1011. .getFetchDataList("simple/data", "systemConfiguration", postData)
  1012. .subscribe((result) => {
  1013. if (result.status == 200) {
  1014. if(result.list[0].valueconfig==1){
  1015. this.cmdbRepair = true
  1016. this.getAssetData();
  1017. }else{
  1018. this.cmdbRepair = false
  1019. }
  1020. }
  1021. });
  1022. }
  1023. changeCommonInp(e) {
  1024. return
  1025. this.changeCommonInpSubject.next(e);
  1026. }
  1027. changeApplyCategory(e){
  1028. console.log(111, e)
  1029. if(e){
  1030. // 根据故障现象带出故障描述
  1031. if(this.validateBxForm.value.description){
  1032. this.validateBxForm.controls.description.setValue(this.validateBxForm.value.description +';'+this.applicationCategoryList.find(v => v.id == e).mutiCategory)
  1033. }else{
  1034. this.validateBxForm.controls.description.setValue(this.applicationCategoryList.find(v => v.id == e).mutiCategory)
  1035. }
  1036. }
  1037. }
  1038. // 故障现象列表
  1039. applicationCategoryList:any[] = [];
  1040. searchApplicationCategory(keyWord?) {
  1041. let item = this.assetData.find(i=> i.id == this.validateBxForm.value.assetId)
  1042. if(!item.assetProductDTO.incidentCategoryIds){
  1043. return
  1044. }
  1045. let postData = {
  1046. incidentCategoryIds: item.assetProductDTO.incidentCategoryIds,
  1047. // category: {
  1048. // category: keyWord,
  1049. // selectType: 'mutlQuery',
  1050. // hierarchy: 3,//只差有三级的故障现象列表
  1051. // },
  1052. };
  1053. console.log(postData);
  1054. this.isLoading = true;
  1055. this.mainService
  1056. .incidentPost("listIncidentCategory", postData)
  1057. .subscribe((data) => {
  1058. this.isLoading = false;
  1059. if (data.status == 200) {
  1060. this.applicationCategoryList = data.data;
  1061. }
  1062. });
  1063. }
  1064. changeAsset(e){
  1065. this.changeAssetInpSubject.next(e);
  1066. }
  1067. // 选择资产
  1068. changeAssetData(e){
  1069. this.validateBxForm.controls.category.setValue(null)
  1070. this.searchApplicationCategory();
  1071. }
  1072. // 获取资产列表
  1073. assetData:any = [];
  1074. getAssetData(name?){
  1075. let data = {
  1076. idx: 0,
  1077. sum: 20,
  1078. asset: {
  1079. downHosId: this.currentHospital.id,
  1080. name: name
  1081. },
  1082. };
  1083. this.mainService
  1084. .getFetchDataList("simple/data", "asset", data)
  1085. .subscribe((data) => {
  1086. if (data.status == 200) {
  1087. this.assetData = data.list;
  1088. }
  1089. });
  1090. }
  1091. //获取综合日志
  1092. rLoading = false;
  1093. listDeptOrderRecords: any = [];
  1094. listDeptOrderRecord() {
  1095. this.rLoading = true;
  1096. this.mainService
  1097. .listMsgByMain("listDeptOrderRecord", { deptId: this.loginUserDeptId })
  1098. .subscribe((result) => {
  1099. this.rLoading = false;
  1100. if (result["status"] == 200) {
  1101. this.listDeptOrderRecords = result["data"].slice(0, 15);
  1102. }
  1103. });
  1104. }
  1105. // 查看标本历史记录
  1106. historyPromptModalShow = false; //标本历史记录弹窗开关
  1107. scode = ""; //查看历史记录携带
  1108. viewSpecimenHistory(data) {
  1109. this.scode = data.scode;
  1110. this.historyPromptModalShow = true;
  1111. }
  1112. // 关闭标本历史记录弹窗
  1113. closeModelHistory(e) {
  1114. this.historyPromptModalShow = JSON.parse(e).show;
  1115. }
  1116. // 查看药单历史记录
  1117. historyDPromptModalShow = false; //药单历史记录弹窗开关
  1118. drugsBagId = ""; //查看历史记录携带
  1119. viewDrugsbagHistory(data) {
  1120. this.drugsBagId = data.id;
  1121. this.historyDPromptModalShow = true;
  1122. }
  1123. // 关闭药单历史记录弹窗
  1124. closeModelHistoryDrugsbag(e) {
  1125. this.historyDPromptModalShow = JSON.parse(e).show;
  1126. }
  1127. // 查看报修信息
  1128. detailBx(data){
  1129. this.router.navigateByUrl("nurse/detailBx/" + data.id);
  1130. }
  1131. // 查看报修信息弹窗
  1132. bxPromptModalShow = false; //弹窗开关
  1133. bData = ""; //查看详情携带所有数据
  1134. viewBx(data) {
  1135. this.bData = data;
  1136. this.bxPromptModalShow = true;
  1137. }
  1138. // 关闭报修信息弹窗
  1139. closeModelBx(e) {
  1140. this.bxPromptModalShow = JSON.parse(e).show;
  1141. }
  1142. // 护士端患者信息列表,鼠标移入姓名展示最近一条检查信息
  1143. recentInfo = "";
  1144. recentInfoTimer = null;
  1145. recentInfoNum = 0;
  1146. isRemand = true; //自动送回
  1147. yyTime = null; //预约时间-患者列表
  1148. yyTimeZy = null; //预约时间-患者列表-患者其他服务
  1149. yyDate = null; //预约日期-陪检
  1150. yyDateZy = null; //预约日期-转运
  1151. getRecentInfo(patientCode) {
  1152. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1153. return;
  1154. }
  1155. this.recentInfo = "";
  1156. clearTimeout(this.recentInfoTimer);
  1157. this.recentInfoTimer = setTimeout(() => {
  1158. this.recentInfoNum++;
  1159. this.mainService
  1160. .listMsgByMain("workOrder/findInspectRecently", { patientCode })
  1161. .subscribe((result) => {
  1162. this.recentInfoNum--;
  1163. if (result["status"] == 200 && this.recentInfoNum === 0) {
  1164. this.recentInfo = result["data"]["info"];
  1165. } else {
  1166. this.recentInfo = "";
  1167. }
  1168. });
  1169. }, 500);
  1170. }
  1171. // 获取患者陪检任务类型(只有一个)的信息
  1172. getTaskTypeByInspection() {
  1173. const list = {
  1174. idx: 0,
  1175. sum: 1,
  1176. taskType: {
  1177. patientInspectQuery: true,
  1178. hosIds: this.currentHospital.id + "",
  1179. associationType: {
  1180. id: 260,
  1181. },
  1182. },
  1183. };
  1184. return this.mainService.getFetchDataList("configuration", "taskType", list);
  1185. }
  1186. //修改预约建单时间的日期
  1187. yyDateChange(e) {
  1188. // 获取年月日
  1189. let yyDate = new Date(e);
  1190. let year = yyDate.getFullYear();
  1191. let month = yyDate.getMonth();
  1192. let date = yyDate.getDate();
  1193. // 获取当前时间的年月日
  1194. let now = new Date();
  1195. let nYear = now.getFullYear();
  1196. let nMonth = now.getMonth();
  1197. let nDate = now.getDate();
  1198. if (year != nYear || month != nMonth || date != nDate) {
  1199. this.disabledHours = () => [];
  1200. this.disabledMinutes = (hour) => [];
  1201. } else {
  1202. // 禁用小时
  1203. this.disabledHours = () => {
  1204. let now = new Date();
  1205. let nHour = now.getHours();
  1206. let nMinute = now.getMinutes();
  1207. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  1208. return range(0, nHour + 1);
  1209. } else {
  1210. return range(0, nHour);
  1211. }
  1212. };
  1213. // 禁用分钟
  1214. this.disabledMinutes = (hour) => {
  1215. let now = new Date();
  1216. let nHour = now.getHours();
  1217. let nMinute = now.getMinutes();
  1218. if (hour === nHour || hour === undefined) {
  1219. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  1220. } else {
  1221. return [];
  1222. }
  1223. };
  1224. }
  1225. }
  1226. // 关闭其他建单保存结果
  1227. closeModel(e) {
  1228. console.log(e);
  1229. if (e === "other" || e === "ordinary") {
  1230. this.osComponentRef2.osInstance().scroll({ x: 0, y: this.positionY });
  1231. this.getOrderList();
  1232. } else if (e === "bb") {
  1233. this.getOrderList();
  1234. this.getSpecimenWorkOrderMsg();
  1235. } else if (e === "application"){
  1236. this.getPathologyData()
  1237. }
  1238. }
  1239. // 其他建单
  1240. selectOtherId; //选中的id
  1241. otherSearch = ""; //搜索的关键词
  1242. oLoading = false;
  1243. nLoading = false;
  1244. positionY = 0; //记录其他建单Y轴滚动距离
  1245. otherClick(item) {
  1246. this.osComponentRef2 && (this.positionY = this.osComponentRef2.osInstance().scroll().position.y); //内容滚动的距离
  1247. this.selectOtherId = item.id;
  1248. this.newShortcutOrder(item, "other");
  1249. this.account = null;
  1250. this.userAccount = null;
  1251. }
  1252. selectIncidentId; //选中的id
  1253. incidentClick(item) {
  1254. this.positionY = this.osComponentRef10.osInstance().scroll().position.y; //内容滚动的距离
  1255. this.selectIncidentId = item.id;
  1256. this.bxForm.controls.content.setValue(item.mutiCategory);
  1257. }
  1258. //搜索
  1259. otherNum = 0;
  1260. otherSearchChange() {
  1261. this.otherSearchChangeSubject.next(this.otherSearch);
  1262. }
  1263. // 切换科室
  1264. changeKs() {
  1265. this.hsPromptModalShow = true;
  1266. // (1) 当用户设置为正数时,用户必须查看此窗体指定秒数。
  1267. // (2) 当用户设置为负数时,用户可点击知道了也可倒计时自动关闭。
  1268. // (3) 如果用户填写0则为无自动关闭和强制查看时间。
  1269. if (this.closeTimeFlag === 0) {
  1270. return;
  1271. }
  1272. this.closeTime = Math.abs(this.closeTimeFlag);
  1273. clearInterval(this.timerCloseTime);
  1274. this.timerCloseTime = setInterval(() => {
  1275. this.closeTime = Math.max(--this.closeTime, 0);
  1276. if (this.closeTime === 0) {
  1277. if (this.closeTimeFlag <= 0) {
  1278. this.hsPromptModalShow = false;
  1279. }
  1280. clearInterval(this.timerCloseTime);
  1281. }
  1282. }, 1000);
  1283. }
  1284. // 判断登录是否已失效
  1285. initLogin() {
  1286. let that = this;
  1287. if (!localStorage.getItem("user")) {
  1288. that.message.error("您的登录已失效,请重新登录!", {
  1289. nzDuration: 3000,
  1290. });
  1291. setTimeout(() => {
  1292. that.router.navigateByUrl("login");
  1293. }, 2000);
  1294. return;
  1295. }
  1296. }
  1297. // 连接websocket
  1298. getWebsocket() {
  1299. let that = this;
  1300. this.webs
  1301. .connectWs(http.nurseWs, { userCount: that.loginUser.account })
  1302. .subscribe((data) => {
  1303. if (data && data.content) {
  1304. that.createBasicNotification(data);
  1305. }
  1306. });
  1307. }
  1308. // 每隔一分钟刷新标本信息
  1309. msgTimerId: any;
  1310. refreshSpecimenWorkOrderMsg() {
  1311. this.msgTimerId = setInterval(() => {
  1312. this.getSpecimenWorkOrderMsg();
  1313. this.getPatientInspectCountMsg();
  1314. this.getSpePackageCountMsg();
  1315. }, 60000);
  1316. }
  1317. // 工单列表筛选
  1318. getOrderSelectList() {
  1319. let that = this;
  1320. that.mainService
  1321. .getDictionary("list", "association_types")
  1322. .subscribe((data) => {
  1323. that.orderSelectList = data || [];
  1324. });
  1325. }
  1326. // 急标普标数量
  1327. getSpecimenWorkOrderMsg() {
  1328. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1329. return;
  1330. }
  1331. let that = this;
  1332. that.mainService
  1333. .postCustom("nurse", "getSpecimenWorkOrderMsg", {
  1334. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  1335. })
  1336. .subscribe((data) => {
  1337. that.specimenWorkOrderMsg = data;
  1338. });
  1339. }
  1340. // 护士端-批量陪检图标下两个数字
  1341. patientInspectCountMsg: any = {};
  1342. getPatientInspectCountMsg() {
  1343. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1344. return;
  1345. }
  1346. let that = this;
  1347. that.mainService
  1348. .getPatientInspectCount({
  1349. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  1350. })
  1351. .subscribe((data) => {
  1352. that.patientInspectCountMsg = data;
  1353. });
  1354. }
  1355. // 护士端-标本打包图标下两个数字
  1356. specimenPackageCountMsg: any = {};
  1357. getSpePackageCountMsg() {
  1358. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1359. return;
  1360. }
  1361. let that = this;
  1362. that.mainService
  1363. .getSpePackageCount({
  1364. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  1365. })
  1366. .subscribe((data) => {
  1367. that.specimenPackageCountMsg = data;
  1368. });
  1369. }
  1370. // 手术提示信息
  1371. surgeryLoading = false;
  1372. now:any = new Date();
  1373. getSurgeryWKOMsg() {
  1374. if(this.currentDept.typeValue != 'surgery'){
  1375. return;
  1376. }
  1377. let postData = {
  1378. idx: 0,
  1379. sum: 1,
  1380. surgery: {
  1381. applyDateStart: format(subHours(new Date(),12), "yyyy-MM-dd HH:mm:ss"),
  1382. applyDateEnd: format(endOfDay(new Date()), "yyyy-MM-dd")+' '+'23:59:59',
  1383. // hosId: this.currentHospital.id,
  1384. surgeryDept: this.loginUserDeptId,
  1385. state: {
  1386. key: 'surgery_trans_state',
  1387. value: 8
  1388. }
  1389. }
  1390. }
  1391. this.surgeryLoading = true;
  1392. this.mainService
  1393. .getFetchDataList("simple/data", "surgery", postData)
  1394. .subscribe((data) => {
  1395. data.list = Array.isArray(data.list) ? data.list : [];
  1396. this.surgeryLoading = false;
  1397. this.surgeryWKOMsg = data.list[0] || {};
  1398. });
  1399. }
  1400. // 获取手术配置信息
  1401. surgeryField = null; //手术关联业务
  1402. surgeryConfigs:any = {};
  1403. // 送回苏醒室的运输过程终点科室信息
  1404. surgeryCarryingCourse:any = null;
  1405. surgeryCarryingCourseDepts: any[] = [];
  1406. getSurgeryConfig() {
  1407. this.mainService
  1408. .getDictionary("list", "ordinary_field")
  1409. .subscribe((data) => {
  1410. this.surgeryField = data.find(v => v.value == 'surgery');
  1411. if(this.surgeryField){
  1412. let postData = {
  1413. idx: 0,
  1414. sum: 10,
  1415. taskTypeConfig: {
  1416. hosId: this.currentHospital.id,
  1417. ordinaryField: this.surgeryField
  1418. }
  1419. };
  1420. this.mainService
  1421. .getFetchDataList("simple/data", "taskTypeConfig", postData)
  1422. .subscribe((result) => {
  1423. if (result.status == 200) {
  1424. this.surgeryConfigs = result.list[0] || {};
  1425. // 送回苏醒室开关开启 并且 有对应的任务类型
  1426. if(this.surgeryConfigs.remandRecovery == 1 && this.surgeryConfigs.recoveryType){
  1427. this.surgeryCarryingCourse = this.surgeryConfigs.recoveryType.carryingCourses ? this.surgeryConfigs.recoveryType.carryingCourses.find(v => v.nodeId ? v.nodeId.value == 'finish' : false) : null;
  1428. // 运输过程终点科室配置是固定科室或者固定科室范围-苏醒室
  1429. if(this.surgeryCarryingCourse && (this.surgeryCarryingCourse.departmentStrategy.value == 2 || this.surgeryCarryingCourse.departmentStrategy.value == 3)){
  1430. this.surgeryCarryingCourseDepts = this.surgeryCarryingCourse.departmentDTOS || [];
  1431. }
  1432. }
  1433. }
  1434. });
  1435. }
  1436. });
  1437. }
  1438. // 药品静配提示信息
  1439. drugJpLoading = false;
  1440. getJpDrugsWKOMsg() {
  1441. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1442. return;
  1443. }
  1444. let that = this;
  1445. this.drugJpLoading = true;
  1446. that.mainService
  1447. .postCustom("nurse", "getJpDrugsWKOMsg", {})
  1448. .subscribe((data) => {
  1449. this.drugJpLoading = false;
  1450. that.jpDrugsWKOMsg = data.data ? data.data : {};
  1451. console.log(that.jpDrugsWKOMsg);
  1452. if (
  1453. that.jpDrugsWKOMsg.drugsInfoList &&
  1454. that.jpDrugsWKOMsg.drugsInfoList.length
  1455. ) {
  1456. that.startSwiper(that.jpDrugsWKOMsg.drugsInfoList.length);
  1457. }
  1458. if (
  1459. that.jpDrugsWKOMsg.jpInfoList &&
  1460. that.jpDrugsWKOMsg.jpInfoList.length
  1461. ) {
  1462. that.startSwiper1(that.jpDrugsWKOMsg.jpInfoList.length);
  1463. }
  1464. });
  1465. }
  1466. // swiper 轮播图
  1467. swiperTop: number = 0;
  1468. moveId: any;
  1469. index: number = 0;
  1470. startSwiper(length) {
  1471. let that = this;
  1472. clearInterval(that.moveId);
  1473. setInterval(() => {
  1474. that.index++;
  1475. clearInterval(that.moveId);
  1476. that.moveId = setInterval(() => {
  1477. if (that.swiperTop > -44 * that.index) {
  1478. that.swiperTop--;
  1479. }
  1480. if (that.swiperTop <= length * -44) {
  1481. that.swiperTop = 0;
  1482. that.index = 0;
  1483. clearInterval(that.moveId);
  1484. }
  1485. }, 20);
  1486. }, 2000);
  1487. }
  1488. swiperTop1: number = 0;
  1489. moveId1: any;
  1490. index1: number = 0;
  1491. startSwiper1(length) {
  1492. let that = this;
  1493. clearInterval(that.moveId1);
  1494. setInterval(() => {
  1495. that.index1++;
  1496. clearInterval(that.moveId1);
  1497. that.moveId1 = setInterval(() => {
  1498. if (that.swiperTop1 > -44 * that.index1) {
  1499. that.swiperTop1--;
  1500. }
  1501. if (that.swiperTop1 <= length * -44) {
  1502. that.swiperTop1 = 0;
  1503. that.index1 = 0;
  1504. clearInterval(that.moveId1);
  1505. }
  1506. }, 20);
  1507. }, 2000);
  1508. }
  1509. // 关注患者
  1510. follow(data) {
  1511. this.showCommonModal(
  1512. data,
  1513. data.focusPatient === 0
  1514. ? "您将设置患者【" +
  1515. data.patientName +
  1516. "】为重点关注,后期此患者的相关检查将会自动建单通知支助中心"
  1517. : "您将取消设置患者【" +
  1518. data.patientName +
  1519. "】为重点关注,后期此患者的相关检查将不会自动建单通知支助中心"
  1520. );
  1521. }
  1522. // 通用提示模态框
  1523. commonModal: boolean = false; //模态框
  1524. loading4 = false;
  1525. tipsMsg1: string; //提示框信息
  1526. coop: any; //当前操作列
  1527. showCommonModal(data: any, tipsMsg1: string) {
  1528. this.commonModal = true;
  1529. this.coop = data;
  1530. this.tipsMsg1 = tipsMsg1;
  1531. }
  1532. // 隐藏模态框
  1533. hideCommonModal() {
  1534. this.commonModal = false;
  1535. }
  1536. // 确认
  1537. confirmCommon() {
  1538. this.commonModal = false;
  1539. let postData = {
  1540. patient: {
  1541. id: this.coop.id,
  1542. focusPatient: this.coop.focusPatient === 0 ? 1 : 0,
  1543. },
  1544. };
  1545. this.loading4 = true;
  1546. this.mainService.listMsgByMain("updData/patient", postData).subscribe(
  1547. (result) => {
  1548. this.loading4 = false;
  1549. if (result["status"] == 200) {
  1550. this.showPromptModal(
  1551. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  1552. true,
  1553. ""
  1554. );
  1555. this.getPatient(this.tabSearchCont);
  1556. } else {
  1557. this.showPromptModal(
  1558. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  1559. false,
  1560. ""
  1561. );
  1562. }
  1563. },
  1564. (err) => {
  1565. this.loading4 = false;
  1566. this.showPromptModal("操作", false, "");
  1567. }
  1568. );
  1569. }
  1570. // 初始化新增form表单
  1571. initBxForm(content) {
  1572. this.validateBxForm = this.fb.group({
  1573. description: [content || null, [Validators.required]],
  1574. building: [null, [Validators.required]],
  1575. floor: [null, [Validators.required]],
  1576. officeAddress: [null, [Validators.required]],
  1577. contacts: [this.loginUser.name, [Validators.required]],
  1578. contactsInformation: [this.loginUser.phone, [Validators.required]],
  1579. assetId: [null, []],
  1580. // category: [null, []],
  1581. });
  1582. if(this.cmdbRepair){
  1583. this.validateBxForm.addControl(
  1584. 'assetId',
  1585. new FormControl(null, [])
  1586. );
  1587. // this.validateBxForm.addControl(
  1588. // 'category',
  1589. // new FormControl(null, [])
  1590. // );
  1591. }else{
  1592. this.validateBxForm.removeControl('assetId');
  1593. // this.validateBxForm.removeControl('category');
  1594. }
  1595. this.getDeptById(this.currentDept.id);
  1596. }
  1597. // 根据科室ID获取详情
  1598. deptDto:any = {};
  1599. getDeptById(id){
  1600. this.mainService
  1601. .getFetchDataList("simple/data", "department", {
  1602. idx: 0,
  1603. sum: 1,
  1604. department: {
  1605. id,
  1606. }
  1607. })
  1608. .subscribe((data:any) => {
  1609. let list = data.list || [];
  1610. this.deptDto = list.length > 0 ? list[0] : {};
  1611. console.log(this.deptDto);
  1612. this.changeHosp();
  1613. // 回显楼栋
  1614. if(this.deptDto.building){
  1615. this.validateBxForm.controls.building.setValue(this.deptDto.building.id);
  1616. }
  1617. // 回显楼层
  1618. if(this.deptDto.floor){
  1619. this.validateBxForm.controls.floor.setValue(this.deptDto.floor.id);
  1620. }
  1621. });
  1622. }
  1623. // 切换院区选项
  1624. buildings: any = []; //楼栋
  1625. changeHosp() {
  1626. this.validateBxForm.controls.building.setValue(null);
  1627. this.buildings = [];
  1628. let data = {
  1629. idx: 0,
  1630. sum: 9999,
  1631. building: {
  1632. hosId: this.deptDto.hospital.id,
  1633. }
  1634. };
  1635. this.mainService
  1636. .getFetchDataList("simple/data", "building", data)
  1637. .subscribe((data:any) => {
  1638. this.buildings = data.list || [];
  1639. this.floors = [];
  1640. this.message.remove(this.maskFlag);
  1641. this.maskFlag = false;
  1642. });
  1643. }
  1644. // 切换楼栋信息
  1645. floors: Array<any> = []; //楼层
  1646. floorLoading: boolean = false;
  1647. changeBuilding(buildingId) {
  1648. if(!buildingId){
  1649. return;
  1650. }
  1651. this.validateBxForm.controls.floor.setValue(null);
  1652. this.validateBxForm.controls.officeAddress.setValue(null);
  1653. this.floors = [];
  1654. let data = {
  1655. idx: 0,
  1656. sum: 9999,
  1657. floor: {
  1658. buildId: buildingId,
  1659. }
  1660. };
  1661. this.floorLoading = true;
  1662. this.mainService
  1663. .getFetchDataList("simple/data", "floor", data)
  1664. .subscribe((data:any) => {
  1665. this.floorLoading = false;
  1666. this.message.remove(this.maskFlag);
  1667. this.maskFlag = false;
  1668. this.floors = data.list || [];
  1669. });
  1670. }
  1671. // 是否确定报修模态框
  1672. bxModal: boolean = false; //模态框
  1673. loading6 = false;
  1674. coopBx: any; //当前操作列
  1675. validateBxForm: FormGroup; //新增/编辑表单
  1676. showBxModal(data?) {
  1677. this.maskFlag = this.message.loading("正在加载中..", {
  1678. nzDuration: 0,
  1679. }).messageId;
  1680. this.bxModal = true;
  1681. this.coopBx = data || {};
  1682. this.fileList = [];
  1683. this.initBxForm(this.coopBx.content);
  1684. }
  1685. // 隐藏模态框
  1686. hideBxModal() {
  1687. this.bxModal = false;
  1688. this.fileList = [];
  1689. }
  1690. // 确认
  1691. confirmBx() {
  1692. for (const i in this.validateBxForm.controls) {
  1693. this.validateBxForm.controls[i].markAsDirty();
  1694. this.validateBxForm.controls[i].updateValueAndValidity();
  1695. }
  1696. if (this.validateBxForm.invalid){
  1697. this.message.error('请填写必填字段!');
  1698. return;
  1699. };
  1700. if (!this.deptDto.id){
  1701. this.message.error('数据异常,无法建单!');
  1702. return;
  1703. };
  1704. this.showReqModal();
  1705. }
  1706. // 报修
  1707. // type, 1是,0否
  1708. async confirmBxNext(type){
  1709. this.maskFlag = this.message.loading("正在加载中..", {
  1710. nzDuration: 0,
  1711. }).messageId;
  1712. if(type == 1){
  1713. this.btnLoading = true;
  1714. let loginUser:any = cloneDeep(this.loginUser);
  1715. // loginUser.upType = "changeDept";
  1716. if(this.deptDto.hospital){
  1717. loginUser.hospital = { id: this.deptDto.hospital.id };
  1718. }
  1719. if(this.deptDto){
  1720. loginUser.dept = {id: this.deptDto.id};
  1721. }
  1722. if(this.validateBxForm.value.contacts){
  1723. loginUser.name = this.validateBxForm.value.contacts;
  1724. }
  1725. // if(this.validateBxForm.value.floor){
  1726. // loginUser.place = {id: this.validateBxForm.value.floor, area: { id: this.validateBxForm.value.building }};
  1727. // }
  1728. // if(this.validateBxForm.value.officeAddress){
  1729. // loginUser.houseNumber = this.validateBxForm.value.officeAddress;
  1730. // }
  1731. if(this.validateBxForm.value.contactsInformation){
  1732. loginUser.phone = this.validateBxForm.value.contactsInformation;
  1733. }
  1734. let result:any = await this.mainService.coopData("updData", "user", { user: loginUser }).toPromise();
  1735. console.log(result);
  1736. if(result.status != 200){
  1737. this.hideReqModal();
  1738. this.btnLoading = false;
  1739. this.message.remove(this.maskFlag);
  1740. this.maskFlag = false;
  1741. this.message.error(result.msg);
  1742. return;
  1743. }
  1744. }else{
  1745. this.cancenlLoading = true;
  1746. }
  1747. this.mainService.getDictionary("list", "incident_source").subscribe((source:any) => {
  1748. let incidentSourceList = source || [];
  1749. let pc = incidentSourceList.find(v => v.value === 'pc');
  1750. this.mainService.getDictionary("list", "repair_incident_type").subscribe((result) => {
  1751. let repairIncidentTypeList = result || [];
  1752. let repairIncidentType = repairIncidentTypeList.find(v => v.value === 'dept');
  1753. if (repairIncidentType) {
  1754. let postData: any = {
  1755. incident: {
  1756. repairIncidentType,
  1757. place: this.validateBxForm.value.floor ? { id: this.validateBxForm.value.floor } : undefined,
  1758. department: { id: this.deptDto.id},
  1759. description: this.validateBxForm.value.description,
  1760. houseNumber: this.validateBxForm.value.officeAddress,
  1761. contacts: this.validateBxForm.value.contacts,
  1762. contactsInformation: this.validateBxForm.value.contactsInformation,
  1763. hosId: this.deptDto.hospital.id,
  1764. source: pc,
  1765. fromWx: true,
  1766. requester: this.loginUser,
  1767. acceptUser: this.loginUser,
  1768. deleteFlag: 0,
  1769. assetId: this.validateBxForm.value.assetId || undefined,
  1770. // category: this.validateBxForm.value.category ? { id: this.validateBxForm.value.category } : undefined,
  1771. },
  1772. };
  1773. // if (this.coopBx.category) {
  1774. // postData.incident.category = this.coopBx.categoryDTO;
  1775. // }
  1776. this.mainService.flowPost("incident/task/request", postData).subscribe((res) => {
  1777. this.btnLoading = false;
  1778. this.cancenlLoading = false;
  1779. this.message.remove(this.maskFlag);
  1780. this.maskFlag = false;
  1781. this.bxModal = false;
  1782. this.hideReqModal();
  1783. if ((res as any).state == 200) {
  1784. // 图片上传
  1785. if(this.fileList.length){
  1786. console.log(this.fileList.map(v => v.originFileObj));
  1787. this.fileList.map(v => v.originFileObj).forEach(async file => {
  1788. await this.uploadImages(file, res.data.id);
  1789. })
  1790. }
  1791. this.showPromptModal("提交", true, "");
  1792. this.checkTable("bxlb");
  1793. } else {
  1794. this.showPromptModal("提交", false, (res as any).msg);
  1795. }
  1796. });
  1797. } else {
  1798. this.btnLoading = false;
  1799. this.showPromptModal("提交", false, "缺少【科室内报修】数据字典");
  1800. }
  1801. });
  1802. })
  1803. }
  1804. // 获取星级
  1805. degrees = [];
  1806. getDegrees() {
  1807. this.iLoading = true;
  1808. this.mainService.getDictionary("list", "incident_degree").subscribe((data: any) => {
  1809. this.iLoading = false;
  1810. this.degrees = data || [];
  1811. });
  1812. }
  1813. iLoading = false;
  1814. // 获取当前登录人科室任务类型信息
  1815. othersList: any = []; // 其他一键建单列表
  1816. bbMsg: any = {}; //标本一键建单
  1817. patientMsgList: any = []; // 患者转运,患者陪检一键建单
  1818. tabFlag = true; //页面初始化获取一次患者陪检的任务类型信息
  1819. allowUrgentFlag = false; //检查列表的患者陪检类型是否允许加急
  1820. tabPermission:any = []; //tab自定义
  1821. tabPermissionTpl:any = []; //tab自定义模板
  1822. getDeptTaskType(search?, clear?) {
  1823. let that = this;
  1824. this.otherNum++;
  1825. this.oLoading = true;
  1826. let postData = {
  1827. deptId: that.loginUserDeptId,
  1828. };
  1829. if (search !== undefined) {
  1830. postData["taskName"] = search;
  1831. postData["tabId"] = this.checkedTableType == 'other' ? undefined : this.checkedTableType;
  1832. }
  1833. that.mainService
  1834. .postCustom("nurse", "getDeptTaskType", postData)
  1835. .subscribe((data) => {
  1836. this.otherNum--;
  1837. if (this.otherNum === 0) {
  1838. this.oLoading = false;
  1839. }
  1840. if (search === undefined) {
  1841. that.deptTaskTypeRules = data.data;
  1842. that.getOrderList();
  1843. if(that.deptTaskTypeRules.openPatientTransport){
  1844. // 手术权限
  1845. that.getSurgeryWKOMsg();
  1846. }
  1847. if (
  1848. that.deptTaskTypeRules.openInspection ||
  1849. that.deptTaskTypeRules.openPatientTransport
  1850. ) {
  1851. this.getPatientInspectCountMsg();
  1852. // 陪检权限或转科权限
  1853. if (this.tabFlag) {
  1854. this.tabFlag = false;
  1855. this.getTaskTypeByInspection().subscribe((result) => {
  1856. console.log(result);
  1857. if (result.list && result.list.length > 0) {
  1858. this.appointmentBuildFlag =
  1859. result.list[0].appointmentSwitch + ""; //是否开启护士端预约建单
  1860. // this.leadTime = result.list[0].appointmentTime; //生效时长
  1861. this.leadTime = 0; //生效时长
  1862. this.followFlag = result.list[0].focusSwitch + ""; //是否开启护士端重点关注
  1863. this.allowUrgentFlag =
  1864. result.list[0].allowUrgent == 1 ? true : false; //是否允许加急(检查列表)
  1865. } else {
  1866. this.appointmentBuildFlag = "0"; //是否开启护士端预约建单
  1867. this.leadTime = 0; //生效时长
  1868. this.followFlag = "0"; //是否开启护士端重点关注
  1869. this.allowUrgentFlag = false; //是否允许加急(检查列表)
  1870. }
  1871. this.pLoading = true;
  1872. that.getPatient();
  1873. });
  1874. } else {
  1875. that.getPatient();
  1876. }
  1877. }
  1878. if (that.deptTaskTypeRules.openSpecimen) {
  1879. // 标本权限
  1880. that.getSpecimenWorkOrderMsg();
  1881. }
  1882. if (
  1883. that.deptTaskTypeRules.openStaticDistribution ||
  1884. that.deptTaskTypeRules.openDrugsBag
  1885. ) {
  1886. // 药品静配权限
  1887. that.getJpDrugsWKOMsg();
  1888. }
  1889. that.getSpePackageCountMsg();
  1890. }
  1891. if(data.data.tabPermission && Array.isArray(data.data.tabPermission.data)){
  1892. if (search !== undefined) {
  1893. let tabPermission = [];
  1894. tabPermission = this.tabPermissionTpl.map(v => {
  1895. let obj = data.data.tabPermission.data.find(vv => vv.id == v.id);
  1896. if(obj){
  1897. return obj;
  1898. }else{
  1899. return v;
  1900. }
  1901. })
  1902. this.tabPermission = tabPermission.sort((a,b) => a.orders - b.orders);
  1903. }else{
  1904. this.tabPermission = data.data.tabPermission.data.sort((a,b) => a.orders - b.orders);
  1905. this.tabPermissionTpl = data.data.tabPermission.data.sort((a,b) => a.orders - b.orders).map(v => ({...v, taskTypeList: []}));
  1906. }
  1907. }else{
  1908. this.tabPermission = this.tabPermissionTpl.length ? cloneDeep(this.tabPermissionTpl) : [];
  1909. }
  1910. if(!this.coopBtns.buildOrdersForOtherTasks){
  1911. this.tabPermission = this.tabPermission.filter(v => !v.system);
  1912. }
  1913. // 初始化默认显示第一个
  1914. if(search === undefined && !this.checkedTableType){
  1915. console.log(this.tabPermission)
  1916. if(this.tabPermission.length){
  1917. this.checkedTableType = (this.tabPermission[0] && this.tabPermission[0].system) ? 'other' : this.tabPermission[0].id;
  1918. }else if(this.coopBtns.suggestionBox){
  1919. this.checkedTableType = 'advice';
  1920. this.checkTable(this.checkedTableType);
  1921. }else if(this.coopBtns.surgery){
  1922. this.checkedTableType = 'surgery';
  1923. this.checkTable(this.checkedTableType);
  1924. }else if(this.coopBtns.outpatientHelpAppointment){
  1925. this.checkedTableType = 'outpatientHelpAppointment';
  1926. this.checkTable(this.checkedTableType);
  1927. }else if(this.coopBtns.inquiryOfHistoricalSpecimens){
  1928. this.checkedTableType = 'historySpecimen';
  1929. this.checkTable(this.checkedTableType);
  1930. }else if(this.coopBtns.historicalMedicineListInquiry){
  1931. this.checkedTableType = 'historyDrugsbag';
  1932. this.checkTable(this.checkedTableType);
  1933. }else if(this.coopBtns.repairList && this.isShowBx){
  1934. this.checkedTableType = 'bxlb';
  1935. this.checkTable(this.checkedTableType);
  1936. }
  1937. }else{
  1938. console.log('this.checkedTableType', this.checkedTableType);
  1939. this.checkTable(this.checkedTableType);
  1940. }
  1941. this.othersList = {};
  1942. this.tabPermission.forEach(v => {
  1943. if(v.system){
  1944. that.othersList['other'] = [];
  1945. }else{
  1946. that.othersList[v.id] = v.taskTypeList || [];
  1947. }
  1948. })
  1949. if (data.data.allTaskTypes) {
  1950. that.patientMsgList = [];
  1951. data.data.allTaskTypes.forEach((e) => {
  1952. if (e.associationType.value == "other") {
  1953. if(that.othersList['other']){
  1954. that.othersList['other'].push(e);
  1955. }else{
  1956. that.othersList['other'] = [e];
  1957. }
  1958. } else if (e.associationType.value == "specimen") {
  1959. that.bbMsg = e;
  1960. } else if (
  1961. e.associationType.value == "patientTransport" ||
  1962. e.associationType.value == "inspect"
  1963. ) {
  1964. that.patientMsgList.push(e);
  1965. }
  1966. });
  1967. // if (clear === "clear") {
  1968. // this.otherSearch = "";
  1969. // this.workOrderRemark = "";
  1970. // this.customRemarks = [];
  1971. // this.historyCustomRemarks = [];
  1972. // let obj = that.othersList.find(
  1973. // (item) => item.id == this.selectOtherId
  1974. // );
  1975. // obj && this.otherClick(obj);
  1976. // }
  1977. console.log(this.selectOtherId);
  1978. if (!this.selectOtherId) {
  1979. if (that.othersList[that.checkedTableType] && that.othersList[that.checkedTableType].length) {
  1980. this.selectOtherId = that.othersList[that.checkedTableType][0].id;
  1981. let obj = that.othersList[that.checkedTableType].find(
  1982. (item) => item.id == this.selectOtherId
  1983. );
  1984. obj && this.otherClick(obj);
  1985. } else {
  1986. this.selectOtherId = null;
  1987. }
  1988. }
  1989. }
  1990. });
  1991. }
  1992. // 工号输入搜索
  1993. searchAccount(e) {
  1994. this.searchAccountSubject.next(e);
  1995. }
  1996. // 根据工号获取用户
  1997. account = null;
  1998. accountList = [];
  1999. isLoading:boolean = false;
  2000. getAccountList(key = ''): void {
  2001. let postData = {
  2002. idx: 0,
  2003. sum: 10,
  2004. user: {
  2005. account: key,
  2006. hospital: {
  2007. id: this.currentHospital.id
  2008. }
  2009. }
  2010. };
  2011. this.isLoading = true;
  2012. this.mainService
  2013. .getFetchDataList("data", "user", postData)
  2014. .subscribe((data) => {
  2015. this.isLoading = false;
  2016. this.accountList = data.list || [];
  2017. });
  2018. }
  2019. // 目标科室输入搜索
  2020. searchDept(type, msg, e) {
  2021. this.getDeptList(type, msg, e)
  2022. }
  2023. // 获取科室
  2024. getDeptList(type, msg, key?): void {
  2025. // 返回值的status是201 则是默认发起科室
  2026. // 返回值的status是202 则是固定科室范围
  2027. // 返回值的status是203 则是固定科室
  2028. // 返回值的status是204 则是自主填写
  2029. // 返回值的status是205 则是固定科室类型
  2030. key = key.toUpperCase()
  2031. console.log('hahhah =======', key)
  2032. if (
  2033. (type == "start" && msg.start.start.departmentStrategy == 202) ||
  2034. (type == "target" && msg.end.end.departmentStrategy == 202)
  2035. ) {
  2036. let data = [];
  2037. let postData = null
  2038. if(this.patientModal){
  2039. postData = this.patientQuery
  2040. }else{
  2041. postData = {
  2042. taskTypeId: this.msgId
  2043. };
  2044. }
  2045. if(type == "start"){
  2046. this.mainService
  2047. .postCustom("nurse", "workOrder/buildTrip", postData)
  2048. .subscribe((result) => {
  2049. let arr = result.start.start.list;
  2050. arr.forEach(i=>{
  2051. if(i.inputcode){
  2052. i.inputcode = i.inputcode.toUpperCase()
  2053. if(this.deptDisplay == 2){
  2054. i.deptalias = i.deptalias + '('+i.inputcode+')'
  2055. }else{
  2056. i.dept = i.dept + '('+i.inputcode+')'
  2057. }
  2058. }
  2059. })
  2060. if(key!=''){
  2061. if(this.deptDisplay ==2){
  2062. data = arr.filter(i=>i.deptalias.indexOf(key) !=-1)
  2063. }else{
  2064. data = arr.filter(i=>i.dept.indexOf(key) !=-1)
  2065. }
  2066. msg.start.start.list = data
  2067. }else{
  2068. msg.start.start.list = arr
  2069. }
  2070. });
  2071. }else{
  2072. this.mainService
  2073. .postCustom("nurse", "workOrder/buildTrip", postData)
  2074. .subscribe((result) => {
  2075. let arr = result.end.end.list;
  2076. arr.forEach(i=>{
  2077. if(i.inputcode){
  2078. i.inputcode = i.inputcode.toUpperCase()
  2079. if(this.deptDisplay == 2){
  2080. i.deptalias = i.deptalias + '('+i.inputcode+')'
  2081. }else{
  2082. i.dept = i.dept + '('+i.inputcode+')'
  2083. }
  2084. }
  2085. })
  2086. if(key!=''){
  2087. if(this.deptDisplay ==2){
  2088. data = arr.filter(i=>i.deptalias.indexOf(key) !=-1)
  2089. }else{
  2090. data = arr.filter(i=>i.dept.indexOf(key) !=-1)
  2091. }
  2092. msg.end.end.list = data
  2093. }else{
  2094. msg.end.end.list = arr
  2095. }
  2096. });
  2097. }
  2098. return; //固定科室范围禁用搜索
  2099. }
  2100. let postData: any = {
  2101. idx: 0,
  2102. sum: 20,
  2103. department: {
  2104. searchType: 1,
  2105. cascadeHosId: this.currentHospital.id
  2106. },
  2107. };
  2108. if (key) {
  2109. postData.department["keyWord"] = key;
  2110. }
  2111. if (type == "start" && msg.start.start.departmentStrategy == 205) {
  2112. postData.department["type"] = { id: msg.start.start.startTypeId };
  2113. } else if (type == "target" && msg.end.end.departmentStrategy == 205) {
  2114. postData.department["type"] = { id: msg.end.end.endTypeId };
  2115. }
  2116. if (type == "start") {
  2117. postData.department["ids"] = msg.start.deptIds || "";
  2118. } else if (type == "target") {
  2119. postData.department["ids"] = msg.end.deptIds || "";
  2120. }
  2121. postData.department.nurseSign = 1;
  2122. this.mainService
  2123. .getFetchDataList("data", "department", postData)
  2124. .subscribe((data) => {
  2125. if (type == "target") {
  2126. data.list.forEach(i=>{
  2127. if(i.inputcode){
  2128. i.inputcode = i.inputcode.toUpperCase()
  2129. if(this.deptDisplay == 2){
  2130. i.deptalias = i.deptalias + '('+i.inputcode+')'
  2131. }else{
  2132. i.dept = i.dept + '('+i.inputcode+')'
  2133. }
  2134. }
  2135. })
  2136. msg.end.end.list = data.list;
  2137. } else if (type == "start") {
  2138. data.list.forEach(i=>{
  2139. if(i.inputcode){
  2140. i.inputcode = i.inputcode.toUpperCase()
  2141. if(this.deptDisplay == 2){
  2142. i.deptalias = i.deptalias + '('+i.inputcode+')'
  2143. }else{
  2144. i.dept = i.dept + '('+i.inputcode+')'
  2145. }
  2146. }
  2147. })
  2148. msg.start.start.list = data.list;
  2149. }
  2150. });
  2151. }
  2152. // 切换左侧tab
  2153. changeInfo() {
  2154. if (
  2155. !this.deptTaskTypeRules.openInspection &&
  2156. !this.deptTaskTypeRules.openPatientTransport
  2157. ) {
  2158. return;
  2159. }
  2160. this.infoPageIdx = 1;
  2161. this.getPatient();
  2162. }
  2163. // 获取患者信息
  2164. snum = 0;
  2165. getPatient(e?) {
  2166. if ((this.currentDept.typeValue == "outpatientDept" || this.currentDept.typeValue == "checkRoom" || this.currentDept.typeValue == "outpatientService") && !this.tabSearchCont) {
  2167. this.pLoading = false;
  2168. this.patientList = [];
  2169. this.infoLength = 0;
  2170. return; //护士端如果登录后如果科室类型为“门诊科室”、“检验科室”、“门诊服务点”,默认不显示患者信息
  2171. }
  2172. this.pLoading = true;
  2173. let postData = {
  2174. idx: this.infoPageIdx - 1,
  2175. sum: 10,
  2176. };
  2177. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  2178. // 手术安排信息-手术室类型
  2179. postData["surgery"] = {
  2180. searchKey: e ? e : this.tabSearchCont,
  2181. applyDateStart: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  2182. applyDateEnd: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  2183. hosId: this.currentHospital.id,
  2184. surgeryDept: this.loginUserDeptId,
  2185. state: {
  2186. key: 'surgery_trans_state',
  2187. value: 3
  2188. }
  2189. };
  2190. }else if(this.currentDept.typeValue == 'recovery'){
  2191. // 患者信息-复苏室类型
  2192. postData["patient"] = {
  2193. keyWord: e ? e : this.tabSearchCont,
  2194. };
  2195. // 查询父级科室患者
  2196. postData["patient"]["parentIdOnly"] = true;
  2197. postData["patient"]["recoveryDept"] = this.loginUserDeptId;
  2198. postData["patient"]["recoveryDeptDTO"] = {keyWord: '1'};
  2199. }else if(this.currentDept.typeValue == "checkRoom2"){
  2200. // 患者信息
  2201. postData["patient"] = {
  2202. keyWord: e ? e : this.tabSearchCont,
  2203. };
  2204. // 查询父级科室患者
  2205. postData["patient"]["parentIdOnly"] = true;
  2206. if (this.tabSearchCont) {
  2207. delete postData["patient"]["department"]; //搜索范围为全院在院患者
  2208. delete postData["patient"]["checkTempDept"];
  2209. } else {
  2210. postData["patient"]["checkTempDept"] = { id: this.loginUserDeptId };
  2211. }
  2212. }else{
  2213. // 患者信息
  2214. postData["patient"] = {
  2215. keyWord: e ? e : this.tabSearchCont,
  2216. };
  2217. // 查询父级科室患者
  2218. postData["patient"]["parentIdOnly"] = true;
  2219. if (
  2220. this.currentDept.typeValue == "checkRoom2" ||
  2221. this.currentDept.typeValue == "outpatientDept" ||
  2222. this.currentDept.typeValue == "checkRoom" ||
  2223. (this.currentDept.typeValue == 'surgery' && this.tabSearchCont)
  2224. ) {
  2225. delete postData["patient"]["department"]; //搜索范围为全院在院患者
  2226. } else {
  2227. postData["patient"]["department"] = { id: this.loginUserDeptId };
  2228. }
  2229. }
  2230. this.snum++;
  2231. this.mainService
  2232. .getFetchDataList((this.currentDept.typeValue == 'surgery' && !this.tabSearchCont) ? "simple/data" : 'nurse', (this.currentDept.typeValue == 'surgery' && !this.tabSearchCont) ? "surgery" : 'patient', postData)
  2233. .subscribe((data) => {
  2234. this.snum--;
  2235. if (data.list.length > 0) {
  2236. data.list.forEach((item) => {
  2237. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  2238. if (item.patientDTO && item.patientDTO.focusPatient === undefined) {
  2239. item.patientDTO.focusPatient = 0;
  2240. }
  2241. }else{
  2242. if (item.focusPatient === undefined) {
  2243. item.focusPatient = 0;
  2244. }
  2245. }
  2246. });
  2247. }
  2248. this.patientList = data.list || [];
  2249. if (this.snum === 0) {
  2250. this.pLoading = false;
  2251. }
  2252. this.infoLength = data.totalNum || 0;
  2253. });
  2254. }
  2255. // tab输入搜索节流阀
  2256. searchTabInp(e) {
  2257. if (
  2258. !this.deptTaskTypeRules.openInspection &&
  2259. !this.deptTaskTypeRules.openPatientTransport
  2260. ) {
  2261. return;
  2262. }
  2263. this.searchTabInpSubject.next(e);
  2264. }
  2265. // 下一日(陪检)
  2266. nextDay() {
  2267. this.yyDate = addDays(this.yyDate, 1);
  2268. this.yyDateChange(this.yyDate);
  2269. }
  2270. // 下一日(转运)
  2271. nextDayZy() {
  2272. this.yyDateZy = addDays(this.yyDateZy, 1);
  2273. this.yyDateChange(this.yyDateZy);
  2274. }
  2275. // 禁用日期(陪检)
  2276. disabledyyDate = (current: Date): boolean => {
  2277. return differenceInCalendarDays(current, new Date()) < 0;
  2278. };
  2279. // 禁用日期(转运)
  2280. disabledyyDateZy = (current: Date): boolean => {
  2281. return differenceInCalendarDays(current, new Date()) < 0;
  2282. };
  2283. // 一键建单确认弹框
  2284. confirmSub: boolean = false;
  2285. confirmPostData: any = {}; //确认提交数据
  2286. confirmYuyue: boolean = false; //确认预约
  2287. confirmInfo: string = "";
  2288. btnLoading3 = false;
  2289. confirm() {
  2290. if (this.confirmYuyue) {
  2291. this.confirmPostData.workOrder.yyTime =
  2292. format(parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()), "yyyy-MM-dd HH:mm") + ":00";
  2293. }
  2294. if (!this.confirmYuyue) {
  2295. this.confirmPostData.workOrder.platform = 2;
  2296. } else {
  2297. delete this.confirmPostData.workOrder.platform;
  2298. }
  2299. //是否需要医护陪同检查
  2300. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  2301. //特级护理或一级护理
  2302. if (
  2303. this.patientMsg.careLevel.value === "0" ||
  2304. this.patientMsg.careLevel.value === "1"
  2305. ) {
  2306. this.btnLoading = false;
  2307. this.btnLoading1 = false;
  2308. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  2309. return;
  2310. }
  2311. }
  2312. if (this.patientMsg.illnessState && this.currentTasktype.isAccompany == 1) {
  2313. //病危或病重
  2314. if (
  2315. this.patientMsg.illnessState.value === "2" ||
  2316. this.patientMsg.illnessState.value === "3"
  2317. ) {
  2318. this.btnLoading = false;
  2319. this.btnLoading1 = false;
  2320. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  2321. return;
  2322. }
  2323. }
  2324. this.btnLoading3 = true;
  2325. this.confirmPostData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  2326. this.newOrderTimeFun(this.confirmPostData.workOrder, () => {
  2327. this.btnLoading3 = false;
  2328. this.cancel();
  2329. }, () => {
  2330. this.mainService
  2331. .postCustom(
  2332. "api",
  2333. this.confirmYuyue ? "appointmentOrder" : "startOrder",
  2334. this.confirmPostData
  2335. )
  2336. .subscribe((data) => {
  2337. this.message.remove(this.jdFlagId);
  2338. this.btnLoading3 = false;
  2339. this.cancel();
  2340. if (data.status == 200) {
  2341. if(this.currentDept.typeValue == 'recovery'){
  2342. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.confirmPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2343. this.showPromptModal("创建", true, "");
  2344. this.goodsLis = [];
  2345. // this.workOrderInspectScore = undefined;
  2346. this.getOrderList();
  2347. this.getDeptTaskType();
  2348. this.getTodayNum();
  2349. });
  2350. }else{
  2351. this.showPromptModal("创建", true, "");
  2352. this.goodsLis = [];
  2353. // this.workOrderInspectScore = undefined;
  2354. this.getOrderList();
  2355. this.getDeptTaskType();
  2356. this.getTodayNum();
  2357. }
  2358. } else if (data.status == 100042) {
  2359. this.showPromptModal("创建", false, data.msg);
  2360. this.getPatient(this.tabSearchCont);
  2361. } else if (data.status == 1000033) {
  2362. //重复建单那策略
  2363. this.repeatMsg = data.msg;
  2364. this.showDelModal(
  2365. this.confirmPostData,
  2366. "accompany5",
  2367. this.confirmYuyue
  2368. );
  2369. } else {
  2370. this.showPromptModal("创建", false, data.msg);
  2371. }
  2372. });
  2373. })
  2374. }
  2375. cancel() {
  2376. this.confirmSub = false;
  2377. // this.confirmPostData = {};
  2378. // this.confirmYuyue = false;
  2379. this.btnLoading = false;
  2380. }
  2381. patientForm: FormGroup; //患者信息一键建单表单
  2382. //患者送检检查项目
  2383. checkTypeLis: any = [];
  2384. // 患者信息一键建单关联检查
  2385. linkCheckLis: any = [];
  2386. isRemarks: boolean = false; //是否开启备注信息
  2387. allowUrgent: any = "0"; //加急
  2388. urgentReason: any = ""; //加急原因
  2389. // 初始化form表单
  2390. initForm() {
  2391. // 初始化患者信息一键建单表单
  2392. this.patientForm = this.fb.group({
  2393. checkedType: [null, [Validators.required]],
  2394. goods: [null],
  2395. inspectScore: this.inspectAndPatientTransportConfig.enableTripType == 1 ? [null, [Validators.required]] : [null],
  2396. workOrderRemark2: [null],
  2397. linkCheck: [null, []],
  2398. targetOffice: [null, [this.targetOfficeValidator]],
  2399. originOffice: [null, [this.originOfficeValidator]],
  2400. allowUrgent: [null], //加急
  2401. urgentReason: [null, [this.urgentReasonValidator]], //加急原因
  2402. });
  2403. // 初始化一键发起建单表单
  2404. this.shortcutForm = this.fb.group({
  2405. targetOffice: [null, [this.targetOfficeShortCutValidator]],
  2406. originOffice: [null, [this.originOfficeShortCutValidator]],
  2407. });
  2408. // 初始化一键发起建单表单
  2409. this.shortcutForm1 = this.fb.group({
  2410. targetOffice: [null, [this.targetOfficeShortCutValidator1]],
  2411. originOffice: [null, [this.originOfficeShortCutValidator1]],
  2412. });
  2413. //新增报修
  2414. this.bxForm = this.fb.group({
  2415. // name: [null, [Validators.required]],
  2416. // phone: [null, [Validators.required]],
  2417. // hospital: [null, [Validators.required]],
  2418. // building: [null, [Validators.required]],
  2419. // address: [null, [Validators.required]],
  2420. content: [null, [Validators.required]],
  2421. });
  2422. }
  2423. //创建自定义校验规则dateValidator,用于复选框组校验时调用。
  2424. // 起点科室校验
  2425. originOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  2426. if (
  2427. this.patientForm &&
  2428. this.patientForm.value &&
  2429. this.checkedShowMsg.status != 200 &&
  2430. !control.value &&
  2431. (this.checkedShowMsg.status == 100015 ||
  2432. this.checkedShowMsg.status == 100013)
  2433. ) {
  2434. return { required: true };
  2435. }
  2436. };
  2437. // 目标科室校验
  2438. targetOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  2439. if (
  2440. this.patientForm &&
  2441. this.patientForm.value &&
  2442. this.checkedShowMsg.status != 200 &&
  2443. !control.value &&
  2444. (this.checkedShowMsg.status == 100015 ||
  2445. this.checkedShowMsg.status == 100014)
  2446. ) {
  2447. return { required: true };
  2448. }
  2449. };
  2450. // 加急原因校验
  2451. urgentReasonValidator = (control: FormControl): { [s: string]: boolean } => {
  2452. if (this.allowUrgent == 1) {
  2453. return { required: true };
  2454. }
  2455. };
  2456. surgeryModal: boolean = false; //模态框
  2457. surgeryInfo:string = '';
  2458. surgeryItem: any = {};
  2459. hideSurgeryModal() {
  2460. this.surgeryModal = false;
  2461. }
  2462. // 确认
  2463. confirmSurgery(surgeryItem) {
  2464. console.log(surgeryItem);
  2465. this.btnLoading = true;
  2466. this.mainService
  2467. .listMsgByMain('surgeryMsg', {
  2468. surgeryId: surgeryItem.id,
  2469. code: 'surgery_begin',
  2470. })
  2471. .subscribe((result:any) => {
  2472. this.btnLoading = false;
  2473. this.surgeryModal = false;
  2474. if(result.state == 200){
  2475. this.showPromptModal("操作", true, "");
  2476. }else{
  2477. this.showPromptModal("操作", false, result.msg);
  2478. }
  2479. });
  2480. }
  2481. // 手术安排信息-即将开始
  2482. surgeryBegin(e, item){
  2483. e.stopPropagation();
  2484. let maskFlag = this.message.loading("正在加载中..", {
  2485. nzDuration: 0,
  2486. }).messageId;
  2487. let postData = {
  2488. idx: 0,
  2489. sum: 9999,
  2490. transportMessage: {
  2491. hosId: this.currentHospital.id,
  2492. code: 'surgery_begin',
  2493. },
  2494. };
  2495. this.mainService
  2496. .getFetchDataList("simple/data", "transportMessage", postData)
  2497. .subscribe((result:any) => {
  2498. this.message.remove(maskFlag);
  2499. if (result.status == 200) {
  2500. result.list = result.list || [];
  2501. if(result.list.length){
  2502. let resultObj:any = {};
  2503. result.list.forEach(v => {
  2504. resultObj[v.role] = v;
  2505. })
  2506. item.doctorNameFlag = resultObj.doctor.phoneFlag == 1 || resultObj.doctor.wechatFlag == 1;
  2507. item.docAssistantInfosFlag = resultObj.docAssistant.phoneFlag == 1 || resultObj.docAssistant.wechatFlag == 1;
  2508. item.anesthetistNameFlag = resultObj.anesthetist.phoneFlag == 1 || resultObj.anesthetist.wechatFlag == 1;
  2509. item.patientNameFlag = resultObj.patient.phoneFlag == 1 || resultObj.patient.wechatFlag == 1;
  2510. if(item.docAssistantInfosFlag && item.docAssistantInfos){
  2511. item.docAssistantInfos = item.docAssistantInfos.split('|').map(v => v.split(',')[0]).join(' / ');
  2512. }
  2513. this.surgeryModal = true;
  2514. this.surgeryItem = item;
  2515. this.surgeryInfo = `提示:您即将给以下工作人员发送短信/微信提醒,请确认以下信息`;
  2516. }else{
  2517. this.showPromptModal("【手术即将开始通知】未配置", false, "失败");
  2518. }
  2519. }else{
  2520. this.showPromptModal("接口获取数据", false, "失败");
  2521. }
  2522. });
  2523. }
  2524. // -----------------
  2525. // --------------------------------------------------------start
  2526. otherDataModal: boolean = false; //模态框
  2527. otherDataInfo:string = '';
  2528. otherDataItem: any = {};
  2529. hideOtherDataModal() {
  2530. this.otherDataModal = false;
  2531. }
  2532. // 确认
  2533. confirmOtherData() {
  2534. console.log(this.otherDataItem);
  2535. this.otherBuildOrder(JSON.parse(this.otherDataItem).otherList);
  2536. this.otherDataModal = false;
  2537. this.relationTransModalShow = JSON.parse(this.otherDataItem).show;
  2538. }
  2539. otherDataConfirm(e){
  2540. this.otherDataModal = true;
  2541. this.otherDataItem = e;
  2542. this.otherDataInfo = `您本次送${this.otherBindConfigDto.relationTrans.name}选择了${JSON.parse(this.otherDataItem).otherList.length}本${this.otherBindConfigDto.relationTrans.name},您确认要建单配送吗?`;
  2543. }
  2544. // --------------------------------------------------------end
  2545. pickUpModal: boolean = false; //模态框
  2546. pickUpInfo:string = '';
  2547. pickUpItem: any = {};
  2548. hidePickUpModal() {
  2549. this.pickUpModal = false;
  2550. }
  2551. // 确认
  2552. confirmPickUp() {
  2553. console.log(this.pickUpItem);
  2554. this.btnLoading = true;
  2555. this.mainService
  2556. .createOrTakeOrder({
  2557. type: 'surgery',
  2558. id: this.pickUpItem.id,
  2559. workOrder: {
  2560. sourceld: 2,
  2561. createDept: this.loginUser.dept.id,
  2562. platform: 2
  2563. }
  2564. })
  2565. .subscribe((result:any) => {
  2566. this.btnLoading = false;
  2567. this.pickUpModal = false;
  2568. if(result.state == 200){
  2569. this.showPromptModal("创建", true, "");
  2570. this.getOrderList();
  2571. this.getDeptTaskType();
  2572. this.getTodayNum();
  2573. }else{
  2574. this.showPromptModal("创建", false, result.msg);
  2575. }
  2576. });
  2577. }
  2578. // 手术安排信息-一键接患者
  2579. pickUpPatient(e, item){
  2580. e.stopPropagation();
  2581. this.pickUpModal = true;
  2582. this.pickUpItem = item;
  2583. this.pickUpInfo = `您本次需要从<span style="color:red;">${item.areaDeptDTO ? (this.deptDisplay == 2 ? item.areaDeptDTO.deptalias : item.areaDeptDTO.dept) : ''}</span>科室接<span style="color:red;">${item.patientDTO ? item.patientDTO.patientName : ''}</span>患者到<span style="color:red;">${item.surgeryDeptDTO ? (this.deptDisplay == 2 ? item.surgeryDeptDTO.deptalias : item.surgeryDeptDTO.dept) : ''}</span>手术间进行手术,您确认接患者吗?`
  2584. }
  2585. sendWardModal: boolean = false; //模态框
  2586. sendWardInfo:string = '';
  2587. sendWardItem: any = {};
  2588. hideSendWardModal() {
  2589. this.sendWardModal = false;
  2590. }
  2591. // 确认
  2592. sLoading1 = false;
  2593. confirmSendWard(data) {
  2594. console.log(this.sendWardItem);
  2595. this.sLoading1 = true;
  2596. this.mainService
  2597. .createRemandOrder({
  2598. type: 'surgery',
  2599. surgeryId: this.sendWardItem.id,
  2600. orderId: this.sendWardItem.gdid,
  2601. configId: this.surgeryConfigs.id,
  2602. remandType: 'clinical',
  2603. remandClean: data.isRemandClean ? 1 : 0,
  2604. })
  2605. .subscribe((result:any) => {
  2606. this.sLoading1 = false;
  2607. this.sendWardModal = false;
  2608. if(result.state == 200){
  2609. this.showPromptModal("创建", true, "");
  2610. this.getOrderList();
  2611. this.getDeptTaskType();
  2612. this.getTodayNum();
  2613. }else{
  2614. this.showPromptModal("创建", false, result.msg);
  2615. }
  2616. });
  2617. }
  2618. // 手术中患者-送回病房
  2619. sendWard(e, item){
  2620. e.stopPropagation();
  2621. this.sendWardModal = true;
  2622. this.sendWardItem = item;
  2623. this.sendWardInfo = `您是否确认将<span style="color:red;">${item.patientDTO ? item.patientDTO.patientName : ''}</span>患者送往<span style="color:red;">${item.areaDeptDTO ? (this.deptDisplay == 2 ? item.areaDeptDTO.deptalias : item.areaDeptDTO.dept) : ''}</span>科室吗?`
  2624. }
  2625. sendAwakeningRoomModal: boolean = false; //模态框
  2626. sendAwakeningRoomInfo:string = '';
  2627. sendAwakeningRoomItem: any = {};
  2628. hideSendAwakeningRoomModal() {
  2629. this.sendAwakeningRoomModal = false;
  2630. }
  2631. // 确认
  2632. sLoading2 = false;
  2633. confirmSendAwakeningRoom(data) {
  2634. console.log(this.sendAwakeningRoomItem);
  2635. console.log(this.surgeryConfigs);
  2636. if(!data.recoveryRoom){
  2637. this.message.info(`<span class="red">${this.surgeryConfigs.recoveryType.taskName}</span>任务类型-运输过程-终点科室-默认科室配置错误!`);
  2638. return;
  2639. }
  2640. this.sLoading2 = true;
  2641. this.mainService
  2642. .createRemandOrder({
  2643. type: 'surgery',
  2644. surgeryId: this.sendAwakeningRoomItem.id,
  2645. orderId: this.sendAwakeningRoomItem.gdid,
  2646. configId: this.surgeryConfigs.id,
  2647. remandType: 'recovery',
  2648. remandClean: data.isRemandClean ? 1 : 0,
  2649. endDept: data.recoveryRoom || undefined,
  2650. })
  2651. .subscribe((result:any) => {
  2652. this.sLoading2 = false;
  2653. this.sendAwakeningRoomModal = false;
  2654. if(result.state == 200){
  2655. this.showPromptModal("创建", true, "");
  2656. this.getOrderList();
  2657. this.getDeptTaskType();
  2658. this.getTodayNum();
  2659. }else{
  2660. this.showPromptModal("创建", false, result.msg);
  2661. }
  2662. });
  2663. }
  2664. // 手术中患者-送回苏醒区
  2665. sendAwakeningRoom(e, item){
  2666. e.stopPropagation();
  2667. this.sendAwakeningRoomModal = true;
  2668. this.sendAwakeningRoomItem = item;
  2669. this.sendAwakeningRoomInfo = `您是否确定将<span style="color:red;">${item.patientDTO ? item.patientDTO.patientName : ''}</span>患者送往<span style="color:red;">${this.surgeryConfigs.recoveryDeptDTO ? (this.deptDisplay == 2 ? this.surgeryConfigs.recoveryDeptDTO.deptalias : this.surgeryConfigs.recoveryDeptDTO.dept) : ''}</span>科室吗?`
  2670. }
  2671. // 手术排程信息-一键建单
  2672. createOrder(e, item){
  2673. e.stopPropagation();
  2674. this.newPatientOrder(item.patientDTO);
  2675. }
  2676. // 患者信息一键建单
  2677. patientModal: boolean = false; //患者信息一键建单模态框
  2678. patientMsg; //患者信息
  2679. // 打开患者信息一键建单模态框
  2680. maskFlag: any = false;
  2681. newPatientOrder(msg) {
  2682. this.yyTime = null;
  2683. this.yyTimeZy = null;
  2684. this.btnLoading = false;
  2685. this.btnLoading1 = false;
  2686. let that = this;
  2687. that.initForm();
  2688. that.checkedShowMsg = {};
  2689. that.patientMsg = msg;
  2690. this.workOrderInspectScore = msg.tripType;
  2691. this.workOrderRemark2 = msg.remark || '';
  2692. this.maskFlag = this.message.loading("正在加载中..", {
  2693. nzDuration: 0,
  2694. }).messageId;
  2695. that.mainService
  2696. .postCustom("configuration", "deptTSPTaskType", {})
  2697. .subscribe((data) => {
  2698. that.checkTypeLis = data.data;
  2699. // 默认选中患者陪检,没有患者陪检,则选择第一个患者其他服务的任务类型
  2700. let id;
  2701. for (let i = that.checkTypeLis.length - 1; i >= 0; i--) {
  2702. if (that.checkTypeLis[i].associationType.value == "inspect") {
  2703. id = that.checkTypeLis[i].id;
  2704. break;
  2705. } else if (
  2706. that.checkTypeLis[i].associationType.value == "patientTransport"
  2707. ) {
  2708. id = that.checkTypeLis[i].id;
  2709. }
  2710. }
  2711. that.patientForm.controls.checkedType.setValue(id);
  2712. this.changeCheckedType(true);
  2713. });
  2714. }
  2715. yyTimeChange(e) {
  2716. if (this.yyTime) {
  2717. let now = new Date();
  2718. // 禁用日期(陪检)
  2719. if (getHours(this.yyTime) < getHours(now)) {
  2720. this.disabledyyDate = (current: Date): boolean => {
  2721. return differenceInCalendarDays(current, new Date()) < 1;
  2722. };
  2723. } else {
  2724. this.disabledyyDate = (current: Date): boolean => {
  2725. return differenceInCalendarDays(current, new Date()) < 0;
  2726. };
  2727. }
  2728. let end = this.getLgNumber(getMinutes(this.yyTime), this.inspectAndPatientTransportConfig.timeMod);
  2729. this.yyTime = setMinutes(this.yyTime, end);
  2730. }
  2731. this.clickYYFlag = false;
  2732. }
  2733. yyTimeZyChange(e) {
  2734. if (this.yyTimeZy) {
  2735. let now = new Date();
  2736. // 禁用日期(转运)
  2737. if (getHours(this.yyTimeZy) < getHours(now)) {
  2738. this.disabledyyDateZy = (current: Date): boolean => {
  2739. return differenceInCalendarDays(current, new Date()) < 1;
  2740. };
  2741. } else {
  2742. this.disabledyyDateZy = (current: Date): boolean => {
  2743. return differenceInCalendarDays(current, new Date()) < 0;
  2744. };
  2745. }
  2746. let end = this.getLgNumber(getMinutes(this.yyTimeZy), this.inspectAndPatientTransportConfig.timeMod);
  2747. this.yyTimeZy = setMinutes(this.yyTimeZy, end);
  2748. }
  2749. this.clickYYZyFlag = false;
  2750. }
  2751. // 获取大于x,并且是n的倍数的数字
  2752. getLgNumber(x: number, n:number): number{
  2753. for(let i = x; i < 60; i++){
  2754. if(i % n === 0){
  2755. return i;
  2756. }
  2757. }
  2758. return 0;
  2759. }
  2760. hidePatientOrder() {
  2761. this.patientModal = false;
  2762. this.clickYYFlag = false;
  2763. this.clickYYZyFlag = false;
  2764. }
  2765. // 预约建单
  2766. btnLoading1 = false;
  2767. confirmPatient1(type) {
  2768. this.confirmPatient(type);
  2769. }
  2770. // 患者信息保存
  2771. clickYYFlag = false; //是否点击预约建单-患者陪检
  2772. clickYYZyFlag = false; //是否点击预约建单-患者其他
  2773. confirmPatient(yuyue?) {
  2774. if (yuyue === "patient-yuyue") {
  2775. this.clickYYFlag = true;
  2776. } else {
  2777. this.clickYYFlag = false;
  2778. }
  2779. if (yuyue === "patient-zy-yuyue") {
  2780. this.clickYYZyFlag = true;
  2781. } else {
  2782. this.clickYYZyFlag = false;
  2783. }
  2784. // 选项是患者转运
  2785. let flag = this.checkTypeLis.some((item) => {
  2786. return (
  2787. item.id == this.patientForm.controls.checkedType.value &&
  2788. item.associationType.value == "patientTransport"
  2789. );
  2790. });
  2791. //预约时间-患者陪检不能为空
  2792. console.log(this.yyTime, this.yyTimeZy, flag, yuyue);
  2793. if (
  2794. (!this.yyTime && !flag && yuyue === "patient-yuyue") ||
  2795. (!this.yyTimeZy && flag && yuyue === "patient-zy-yuyue")
  2796. ) {
  2797. return;
  2798. }
  2799. console.log(this.yyDateZy, this.yyTimeZy, this.yyDate, this.yyTime, flag);
  2800. if (flag) {
  2801. //转运
  2802. let yyDateZy = (typeof this.yyDateZy === 'object') ? new Date(this.yyDateZy) : parse(this.yyDateZy, 'yyyy-MM-dd HH:mm:ss', new Date());
  2803. let yyTimeZy = (typeof this.yyTimeZy === 'object') ? new Date(this.yyTimeZy) : parse(this.yyTimeZy, 'yyyy-MM-dd HH:mm:ss', new Date());
  2804. this.yyTimeZy =
  2805. format(yyDateZy, "yyyy-MM-dd") +
  2806. " " +
  2807. format(yyTimeZy, "HH:mm") +
  2808. ":00";
  2809. } else {
  2810. //陪检
  2811. let yyDate = (typeof this.yyDate === 'object') ? new Date(this.yyDate) : parse(this.yyDate, 'yyyy-MM-dd HH:mm:ss', new Date());
  2812. let yyTime = (typeof this.yyTime === 'object') ? new Date(this.yyTime) : parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date());
  2813. this.yyTime =
  2814. format(yyDate, "yyyy-MM-dd") +
  2815. " " +
  2816. format(yyTime, "HH:mm") +
  2817. ":00";
  2818. }
  2819. var that = this;
  2820. for (const i in that.patientForm.controls) {
  2821. that.patientForm.controls[i].markAsDirty();
  2822. that.patientForm.controls[i].updateValueAndValidity();
  2823. }
  2824. if (that.patientForm.invalid) {
  2825. if(!that.patientForm.value.inspectScore){
  2826. this.message.error("陪检方式必填!");
  2827. }
  2828. return;
  2829. }
  2830. console.log(that.patientForm);
  2831. if (yuyue) {
  2832. this.confirmYuyue = true;
  2833. this.btnLoading1 = true;
  2834. } else {
  2835. this.confirmYuyue = false;
  2836. this.btnLoading = true;
  2837. }
  2838. let postData: any = {
  2839. workOrder: {
  2840. sourceId: SourceId.hushi,
  2841. taskType: { id: that.patientForm.controls.checkedType.value },
  2842. startDept: { id: that.checkedShowMsg.startDept },
  2843. endDepts: [{ id: that.checkedShowMsg.endDept }],
  2844. createDept: that.loginUserDeptId,
  2845. patient: {
  2846. patientCode: that.patientMsg.patientCode,
  2847. },
  2848. },
  2849. };
  2850. if (!flag) {
  2851. postData.workOrder.taskType.isHalfInspect =
  2852. this.currentTasktype.isHalfInspect === 1 ? 1 : 0; //半程陪检
  2853. }
  2854. if (
  2855. (that.checkedShowMsg.status == 100013 ||
  2856. that.checkedShowMsg.status == 100015) &&
  2857. that.patientForm.value.originOffice
  2858. ) {
  2859. postData.workOrder.startDept.id = that.patientForm.value.originOffice;
  2860. }
  2861. if (that.patientForm.value.targetOffice) {
  2862. postData.workOrder["endDepts"] = [
  2863. { id: that.patientForm.value.targetOffice },
  2864. ];
  2865. } else if (flag) {
  2866. postData.workOrder["endDepts"] = [
  2867. { id: that.checkedShowMsg.end.end.list[0].id },
  2868. ];
  2869. }
  2870. let checkedArr = [];
  2871. let yy = false; //是否有预约时间
  2872. if (that.linkCheckLis && that.linkCheckLis.length) {
  2873. that.linkCheckLis.forEach((e) => {
  2874. if (e.checked) {
  2875. checkedArr.push({ id: e.value });
  2876. if (e.yyTime) {
  2877. yy = true;
  2878. }
  2879. }
  2880. });
  2881. }
  2882. // 携带设备
  2883. let goods = "";
  2884. if (that.patientForm.value.goods && that.patientForm.value.goods.length) {
  2885. that.patientForm.value.goods.forEach((e) => {
  2886. if (e.checked) {
  2887. goods += e.value + ",";
  2888. }
  2889. });
  2890. goods = goods.slice(0, goods.length - 1);
  2891. }
  2892. postData.workOrder["goods"] = goods;
  2893. // 陪检方式
  2894. if (that.patientForm.value.inspectScore) {
  2895. postData.workOrder["inspectScore"] = { id: that.patientForm.value.inspectScore };
  2896. }
  2897. // 工单备注
  2898. postData.workOrder["workOrderRemark"] = that.workOrderRemark2 || '';
  2899. if (!yuyue && that.current_allowUrgent && this.allowUrgent == 1) {
  2900. postData.workOrder["urgentDetails"] = {
  2901. checkStatus: { id: 329 },
  2902. urgentReason: that.urgentReason,
  2903. };
  2904. } else {
  2905. delete postData.workOrder["urgentDetails"];
  2906. }
  2907. if (
  2908. yy &&
  2909. that.checkedShowMsg.status == 200 &&
  2910. that.linkCheckLis &&
  2911. checkedArr.length
  2912. ) {
  2913. // 有预约时间
  2914. postData.workOrder["checkList"] = checkedArr;
  2915. that.hidePatientOrder();
  2916. that.confirmSub = true;
  2917. that.confirmPostData = postData;
  2918. that.confirmInfo = "您确认建单吗?";
  2919. } else {
  2920. if (!yy && that.checkedShowMsg.status == 200) {
  2921. postData.workOrder["checkList"] = checkedArr;
  2922. // 添加预约时间
  2923. if (yuyue) {
  2924. postData.workOrder.yyTime =
  2925. format(parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()), "yyyy-MM-dd HH:mm") + ":00";
  2926. }
  2927. } else {
  2928. delete postData.workOrder["checkList"];
  2929. // 添加预约时间
  2930. if (yuyue) {
  2931. postData.workOrder.yyTime =
  2932. format(parse(this.yyTimeZy, 'yyyy-MM-dd HH:mm:ss', new Date()), "yyyy-MM-dd HH:mm") + ":00";
  2933. }
  2934. }
  2935. if (that.checkedShowMsg.status != 200) {
  2936. postData.workOrder["isRemand"] = this.isRemand ? 1 : 0;
  2937. }
  2938. if (!yuyue) {
  2939. postData.workOrder.platform = 2;
  2940. } else {
  2941. delete postData.workOrder.platform;
  2942. }
  2943. //是否需要医护陪同检查
  2944. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  2945. //特级护理或一级护理
  2946. if (
  2947. this.patientMsg.careLevel.value === "0" ||
  2948. this.patientMsg.careLevel.value === "1"
  2949. ) {
  2950. this.btnLoading = false;
  2951. this.btnLoading1 = false;
  2952. this.accompany(postData, yuyue, "patient");
  2953. return;
  2954. }
  2955. }
  2956. if (
  2957. this.patientMsg.illnessState &&
  2958. this.currentTasktype.isAccompany == 1
  2959. ) {
  2960. //病危或病重
  2961. if (
  2962. this.patientMsg.illnessState.value === "2" ||
  2963. this.patientMsg.illnessState.value === "3"
  2964. ) {
  2965. this.btnLoading = false;
  2966. this.btnLoading1 = false;
  2967. this.accompany(postData, yuyue, "patient");
  2968. return;
  2969. }
  2970. }
  2971. postData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  2972. this.newOrderTimeFun(postData.workOrder, () => {
  2973. this.hidePatientOrder();
  2974. }, () => {
  2975. this.mainService
  2976. .postCustom("api", yuyue ? "appointmentOrder" : "startOrder", postData)
  2977. .subscribe((data) => {
  2978. this.message.remove(this.jdFlagId);
  2979. this.hidePatientOrder();
  2980. if (data.status == 200) {
  2981. if(this.currentDept.typeValue == 'recovery'){
  2982. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: postData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2983. this.showPromptModal("创建", true, "");
  2984. this.goodsLis = [];
  2985. // this.workOrderInspectScore = undefined;
  2986. this.getOrderList();
  2987. this.getDeptTaskType();
  2988. this.getTodayNum();
  2989. });
  2990. }else{
  2991. this.showPromptModal("创建", true, "");
  2992. this.goodsLis = [];
  2993. // this.workOrderInspectScore = undefined;
  2994. this.getOrderList();
  2995. this.getDeptTaskType();
  2996. this.getTodayNum();
  2997. }
  2998. } else if (data.status == 100042) {
  2999. this.showPromptModal("创建", false, data.msg);
  3000. this.getPatient(this.tabSearchCont);
  3001. } else if (data.status == 1000033) {
  3002. //重复建单那策略
  3003. this.repeatMsg = data.msg;
  3004. this.showDelModal(postData, "transport", yuyue);
  3005. } else {
  3006. this.showPromptModal("创建", false, data.msg);
  3007. }
  3008. });
  3009. })
  3010. }
  3011. }
  3012. // 是否需要护士医生陪同模态框
  3013. accompanyModal: boolean = false;
  3014. accompanyLoading: boolean = false;
  3015. cancenlLoading: boolean = false;
  3016. accompanyPostData = null;
  3017. accompanyYuyue;
  3018. accompanyType = "";
  3019. accompany(postData, yuyue, type) {
  3020. this.accompanyModal = true;
  3021. this.accompanyPostData = postData;
  3022. this.accompanyYuyue = yuyue;
  3023. this.accompanyType = type;
  3024. }
  3025. confirmAccompany() {
  3026. this.accompanyPostData.workOrder.isAccompany = 1;
  3027. this.accompanyLoading = true;
  3028. if (this.accompanyType == "patient") {
  3029. //患者列表直接建单
  3030. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  3031. this.hidePatientOrder();
  3032. this.accompanyModal = false;
  3033. this.accompanyLoading = false;
  3034. }, () => {
  3035. this.mainService
  3036. .postCustom(
  3037. "api",
  3038. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  3039. this.accompanyPostData
  3040. )
  3041. .subscribe((data) => {
  3042. this.message.remove(this.jdFlagId);
  3043. this.hidePatientOrder();
  3044. this.accompanyModal = false;
  3045. this.accompanyLoading = false;
  3046. if (data.status == 200) {
  3047. if(this.currentDept.typeValue == 'recovery'){
  3048. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  3049. this.showPromptModal("创建", true, "");
  3050. this.goodsLis = [];
  3051. // this.workOrderInspectScore = undefined;
  3052. this.getOrderList();
  3053. this.getDeptTaskType();
  3054. this.getTodayNum();
  3055. });
  3056. }else{
  3057. this.showPromptModal("创建", true, "");
  3058. this.goodsLis = [];
  3059. // this.workOrderInspectScore = undefined;
  3060. this.getOrderList();
  3061. this.getDeptTaskType();
  3062. this.getTodayNum();
  3063. }
  3064. } else if (data.status == 100042) {
  3065. this.showPromptModal("创建", false, data.msg);
  3066. this.getPatient(this.tabSearchCont);
  3067. } else if (data.status == 1000033) {
  3068. //重复建单那策略
  3069. this.repeatMsg = data.msg;
  3070. this.showDelModal(
  3071. this.accompanyPostData,
  3072. "accompany1",
  3073. this.accompanyYuyue
  3074. );
  3075. } else {
  3076. this.showPromptModal("创建", false, data.msg);
  3077. }
  3078. });
  3079. })
  3080. } else if (this.accompanyType == "patient-yy") {
  3081. //患者列表预约建单
  3082. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  3083. this.btnLoading3 = false;
  3084. this.accompanyModal = false;
  3085. this.accompanyLoading = false;
  3086. this.cancel();
  3087. }, () => {
  3088. this.mainService
  3089. .postCustom(
  3090. "api",
  3091. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  3092. this.accompanyPostData
  3093. )
  3094. .subscribe((data) => {
  3095. this.message.remove(this.jdFlagId);
  3096. this.btnLoading3 = false;
  3097. this.accompanyModal = false;
  3098. this.accompanyLoading = false;
  3099. this.cancel();
  3100. if (data.status == 200) {
  3101. if(this.currentDept.typeValue == 'recovery'){
  3102. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  3103. this.showPromptModal("创建", true, "");
  3104. this.goodsLis = [];
  3105. // this.workOrderInspectScore = undefined;
  3106. this.getOrderList();
  3107. this.getDeptTaskType();
  3108. this.getTodayNum();
  3109. });
  3110. }else{
  3111. this.showPromptModal("创建", true, "");
  3112. this.goodsLis = [];
  3113. // this.workOrderInspectScore = undefined;
  3114. this.getOrderList();
  3115. this.getDeptTaskType();
  3116. this.getTodayNum();
  3117. }
  3118. } else if (data.status == 100042) {
  3119. this.showPromptModal("创建", false, data.msg);
  3120. this.getPatient(this.tabSearchCont);
  3121. } else if (data.status == 1000033) {
  3122. //重复建单那策略
  3123. this.repeatMsg = data.msg;
  3124. this.showDelModal(
  3125. this.accompanyPostData,
  3126. "accompany2",
  3127. this.accompanyYuyue
  3128. );
  3129. } else {
  3130. this.showPromptModal("创建", false, data.msg);
  3131. }
  3132. });
  3133. })
  3134. }
  3135. }
  3136. hideAccompanyModal(e) {
  3137. console.log(e);
  3138. if (e === "x") {
  3139. //关闭
  3140. this.accompanyModal = false;
  3141. return;
  3142. }
  3143. this.accompanyPostData.workOrder.isAccompany = 0;
  3144. this.cancenlLoading = true;
  3145. if (this.accompanyType == "patient") {
  3146. //患者列表直接建单
  3147. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  3148. this.hidePatientOrder();
  3149. this.accompanyModal = false;
  3150. this.cancenlLoading = false;
  3151. }, () => {
  3152. this.mainService
  3153. .postCustom(
  3154. "api",
  3155. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  3156. this.accompanyPostData
  3157. )
  3158. .subscribe((data) => {
  3159. this.message.remove(this.jdFlagId);
  3160. this.hidePatientOrder();
  3161. this.accompanyModal = false;
  3162. this.cancenlLoading = false;
  3163. if (data.status == 200) {
  3164. if(this.currentDept.typeValue == 'recovery'){
  3165. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  3166. this.showPromptModal("创建", true, "");
  3167. this.goodsLis = [];
  3168. // this.workOrderInspectScore = undefined;
  3169. this.getOrderList();
  3170. this.getDeptTaskType();
  3171. this.getTodayNum();
  3172. });
  3173. }else{
  3174. this.showPromptModal("创建", true, "");
  3175. this.goodsLis = [];
  3176. // this.workOrderInspectScore = undefined;
  3177. this.getOrderList();
  3178. this.getDeptTaskType();
  3179. this.getTodayNum();
  3180. }
  3181. } else if (data.status == 100042) {
  3182. this.showPromptModal("创建", false, data.msg);
  3183. this.getPatient(this.tabSearchCont);
  3184. } else if (data.status == 1000033) {
  3185. //重复建单那策略
  3186. this.repeatMsg = data.msg;
  3187. this.showDelModal(
  3188. this.accompanyPostData,
  3189. "accompany3",
  3190. this.accompanyYuyue
  3191. );
  3192. } else {
  3193. this.showPromptModal("创建", false, data.msg);
  3194. }
  3195. });
  3196. })
  3197. } else if (this.accompanyType == "patient-yy") {
  3198. //患者列表预约建单
  3199. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  3200. this.btnLoading3 = false;
  3201. this.accompanyModal = false;
  3202. this.cancenlLoading = false;
  3203. this.cancel();
  3204. }, () => {
  3205. this.mainService
  3206. .postCustom(
  3207. "api",
  3208. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  3209. this.accompanyPostData
  3210. )
  3211. .subscribe((data) => {
  3212. this.message.remove(this.jdFlagId);
  3213. this.btnLoading3 = false;
  3214. this.accompanyModal = false;
  3215. this.cancenlLoading = false;
  3216. this.cancel();
  3217. if (data.status == 200) {
  3218. if(this.currentDept.typeValue == 'recovery'){
  3219. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  3220. this.showPromptModal("创建", true, "");
  3221. this.goodsLis = [];
  3222. // this.workOrderInspectScore = undefined;
  3223. this.getOrderList();
  3224. this.getDeptTaskType();
  3225. this.getTodayNum();
  3226. });
  3227. }else{
  3228. this.showPromptModal("创建", true, "");
  3229. this.goodsLis = [];
  3230. // this.workOrderInspectScore = undefined;
  3231. this.getOrderList();
  3232. this.getDeptTaskType();
  3233. this.getTodayNum();
  3234. }
  3235. } else if (data.status == 100042) {
  3236. this.showPromptModal("创建", false, data.msg);
  3237. this.getPatient(this.tabSearchCont);
  3238. } else if (data.status == 1000033) {
  3239. //重复建单那策略
  3240. this.repeatMsg = data.msg;
  3241. this.showDelModal(
  3242. this.accompanyPostData,
  3243. "accompany4",
  3244. this.accompanyYuyue
  3245. );
  3246. } else {
  3247. this.showPromptModal("创建", false, data.msg);
  3248. }
  3249. });
  3250. })
  3251. }
  3252. }
  3253. //获取携带设备
  3254. goodsLis: any = []; //携带设备
  3255. getAllGoods() {
  3256. this.mainService.getDictionary("list", "goods").subscribe((data) => {
  3257. let goodsLis = data || [];
  3258. goodsLis.forEach((e) => {
  3259. this.goodsLis.push({
  3260. label: e.name,
  3261. value: e.id,
  3262. checked: false,
  3263. });
  3264. });
  3265. });
  3266. }
  3267. //获取陪检方式
  3268. workOrderInspectScoreList:any[] = [];
  3269. workOrderInspectScore:any;
  3270. getWorkOrderInspectScore() {
  3271. let postData = { idx: 0, sum: 9999, workOrderInspectScore: { hosId: this.currentHospital.id } };
  3272. this.mainService
  3273. .getFetchDataList("simple/data", "workOrderInspectScore", postData)
  3274. .subscribe((result) => {
  3275. if (result.status == 200) {
  3276. this.workOrderInspectScoreList = result.list || [];
  3277. } else {
  3278. this.message.error("请求数据失败");
  3279. }
  3280. });
  3281. }
  3282. // 切换患者送检检查项目
  3283. checkedShowMsg: any = {}; //患者送检检查项目对应展示信息
  3284. current_allowUrgent = false; //当前任务类型是否允许加急
  3285. currentTasktype; //当前选中的任务类型对象
  3286. cLoading = false;
  3287. historyCustomRemarks2 = [];
  3288. isStartFixedType:boolean = false;
  3289. isEndFixedType:boolean = false;
  3290. patientQuery:any={};
  3291. changeCheckedType(isInit = false) {
  3292. isInit && (this.inspectToday = new Date());
  3293. this.customRemarks2 = [];
  3294. this.historyCustomRemarks2 = [];
  3295. this.isYyInspect = false;
  3296. this.linkCheckLisTrue = false;
  3297. this.clickYYFlag = false;
  3298. this.clickYYZyFlag = false;
  3299. this.currentTasktype = this.checkTypeLis.find(
  3300. (item) => item.id == this.patientForm.controls.checkedType.value
  3301. );
  3302. // 是否回显注意事项
  3303. if(isInit){
  3304. if(this.currentTasktype.remarksSwitch === 1){
  3305. this.workOrderRemark2 = this.patientMsg.remark || "";
  3306. }else{
  3307. this.workOrderRemark2 = '';
  3308. }
  3309. }
  3310. // 获取患者其他服务,护士端是否预约建单
  3311. let appointmentZyBuildFlag = this.checkTypeLis.filter((item) => item.id == this.patientForm.controls.checkedType.value && item.associationType.value == "patientTransport");
  3312. if (appointmentZyBuildFlag.length) {
  3313. this.appointmentZyBuildFlag =
  3314. appointmentZyBuildFlag[0].appointmentOtherSwitch == 1 ? "1" : "0";
  3315. console.log(this.appointmentZyBuildFlag, "seimin");
  3316. this.yyDateZy = new Date();
  3317. this.yyTimeZy = new Date();
  3318. let end = this.getLgNumber(this.yyTimeZy.getMinutes(), this.inspectAndPatientTransportConfig.timeMod);
  3319. this.yyTimeZy.setMinutes(end);
  3320. if(end === 0){
  3321. this.yyTimeZy.setHours(this.yyTimeZy.getHours() + 1);
  3322. }
  3323. } else {
  3324. this.appointmentBuildFlag =
  3325. this.currentTasktype.appointmentSwitch == 1 ? "1" : "0";
  3326. console.log(this.appointmentBuildFlag, "seimin");
  3327. }
  3328. console.log(this.patientForm.controls.checkedType.value, this.checkTypeLis);
  3329. this.current_allowUrgent =
  3330. this.checkTypeLis.find(
  3331. (item) => item.id == this.patientForm.controls.checkedType.value
  3332. ).allowUrgent == 1
  3333. ? true
  3334. : false;
  3335. // 判断这个任务类型是否允许加急 start
  3336. // 判断这个任务类型是否允许加急 end
  3337. let that = this;
  3338. let isInpect = this.checkTypeLis.some((item) => item.id == this.patientForm.controls.checkedType.value && item.associationType.value == "inspect");
  3339. this.patientQuery = {
  3340. taskTypeId: that.patientForm.controls.checkedType.value,
  3341. patientCode: that.patientMsg.patientCode,
  3342. startTime: isInpect ? format(startOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss') : undefined,
  3343. endTime: isInpect ? format(endOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss') : undefined,
  3344. };
  3345. this.cLoading = true;
  3346. that.mainService
  3347. .postCustom("nurse", "workOrder/buildTrip", this.patientQuery)
  3348. .subscribe((data) => {
  3349. this.cLoading = false;
  3350. this.message.remove(this.maskFlag);
  3351. this.maskFlag = false;
  3352. this.patientModal = true;
  3353. that.checkedShowMsg = data;
  3354. if(data.end){
  3355. if(data.end.end.departmentStrategy==202 ||
  3356. data.end.end.departmentStrategy==204 ||
  3357. data.end.end.departmentStrategy==205){
  3358. this.isEndFixedType = true
  3359. }else{
  3360. this.isEndFixedType = false
  3361. }
  3362. }
  3363. if(data.start){
  3364. if(data.start.start.departmentStrategy==202 ||
  3365. data.start.start.departmentStrategy==204 ||
  3366. data.start.start.departmentStrategy==205){
  3367. this.isStartFixedType = true
  3368. }else{
  3369. this.isStartFixedType = false
  3370. }
  3371. }
  3372. if (that.checkedShowMsg.status != 200) {
  3373. that.isRemand = data.isRemand == 1 ? true : false;
  3374. }
  3375. that.goodsLis = [];
  3376. // that.workOrderInspectScore = undefined;
  3377. that.allowUrgent = "0"; //加急
  3378. that.urgentReason = ""; //加急原因
  3379. that.getAllGoods();
  3380. that.getWorkOrderInspectScore();
  3381. // 工单备注配置 start
  3382. that.isRemarks = data.remarksSwitch == 1;
  3383. if (data.remarksSwitch == 1) {
  3384. if (data.customRemarks === null || data.customRemarks === "") {
  3385. that.customRemarks2 = [];
  3386. } else {
  3387. that.customRemarks2 = data.customRemarks.split("$");
  3388. }
  3389. that.workOrderRemarkTips2 =
  3390. data.remarksPrompts || "请填写工单备注,不超过100个字符";
  3391. // let user = JSON.parse(localStorage.getItem("user"));
  3392. // that.mainService
  3393. // .postCustom("nurse", "workOrder/recentRemarks", {
  3394. // deptId: user.user.dept.id,
  3395. // taskTypeId: that.patientForm.controls.checkedType.value,
  3396. // })
  3397. // .subscribe((result) => {
  3398. // if (result.state == 200) {
  3399. // that.historyCustomRemarks2 = result.data;
  3400. // }
  3401. // });
  3402. }
  3403. // 工单备注配置 end
  3404. that.linkCheckLis = [];
  3405. if (data.status == 200 && data.data && data.data.length) {
  3406. let arr = [];
  3407. data.data.forEach((e) => {
  3408. if(e.yyTime){
  3409. e.yyEndTime = e.yyTime
  3410. e.newTime = format(new Date(e.yyTime), 'MM-dd HH:mm')
  3411. if(e.endCheckTime){
  3412. e.newTime2 = format(new Date(e.endCheckTime), 'HH:mm')
  3413. e.yyEndTime = e.newTime + '--' + e.newTime2
  3414. }else{
  3415. e.yyEndTime = e.newTime
  3416. }
  3417. }else{
  3418. e.yyEndTime = null
  3419. }
  3420. arr.push({
  3421. execDeptId: e.execDept.id,
  3422. yyTime: e.yyTime,
  3423. priority: e.priority,
  3424. manualCreate: e.manualCreate,
  3425. label:
  3426. (e.yyEndTime || "") +
  3427. " " +
  3428. (this.deptDisplay == 2
  3429. ? e.execDept.deptalias
  3430. : e.execDept.dept) +
  3431. " 进行 " +
  3432. (e.inspectName?e.inspectName:'' + '-' + e.inspectCode || "检查"),
  3433. value: e["id"],
  3434. checked: false,
  3435. remark: e.remark,
  3436. });
  3437. });
  3438. that.linkCheckLis = arr;
  3439. }
  3440. });
  3441. }
  3442. // 需要预约建单-事件
  3443. yyInspectChange(e) {
  3444. if (this.currentTasktype.associationType.value === "inspect") {
  3445. //陪检
  3446. let obj = this.filterLinkCheckLis.find((item) => {
  3447. return (
  3448. parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() >
  3449. this.leadTime * 60 * 1000
  3450. );
  3451. });
  3452. if (obj) {
  3453. this.showDateTime();
  3454. } else {
  3455. this.yyTime = null;
  3456. this.yyDate = new Date();
  3457. console.log(this.isYyInspect);
  3458. }
  3459. } else {
  3460. //转运
  3461. this.yyTimeZy = null;
  3462. this.yyDateZy = new Date();
  3463. }
  3464. }
  3465. //回显时间日期
  3466. showDateTime() {
  3467. //当前时间要大于生效时间
  3468. let isYyInspect = this.filterLinkCheckLis.every((item) => {
  3469. return (
  3470. parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() >
  3471. this.leadTime * 60 * 1000
  3472. );
  3473. });
  3474. //如果勾选需要预约检查
  3475. if (isYyInspect) {
  3476. //筛选离当前时间最近的
  3477. let timeList = this.filterLinkCheckLis
  3478. .map((item) => parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime())
  3479. .sort();
  3480. this.yyTime = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约时间,需要减去生效时间
  3481. this.yyDate = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约日期,需要减去生效时间
  3482. this.yyDateChange(this.yyTime);
  3483. } else {
  3484. this.yyTime = null;
  3485. this.yyDate = null;
  3486. }
  3487. }
  3488. // 患者送检检查项目-选择检查项目
  3489. linkCheckLisTrue = false; //是否有已选择(患者)
  3490. isInspectPriority = false; //选择的检查是否紧急(患者)
  3491. filterLinkCheckLis = []; //有预约时间并且选中的
  3492. isInspects = false; //勾选检车的时候是否多个检查多个检查科室
  3493. linkCheckLisChange(e) {
  3494. let flag = false; //检查是否紧急
  3495. let arr = []; //选中的索引
  3496. // 是否检查生成工单允许多个科室,1是,0否
  3497. if (this.currentTasktype.isMoreDept === 0) {
  3498. let arr = e.map((item) => item.execDeptId);
  3499. arr = Array.from(new Set(arr));
  3500. this.isInspects = arr.length > 1;
  3501. }
  3502. this.linkCheckLis.forEach((item, index) => {
  3503. if (e.length) {
  3504. //有选中的检查
  3505. e.forEach((v) => {
  3506. //检查是否有紧急度
  3507. if (v.priority == 1) {
  3508. flag = true;
  3509. }
  3510. //选中的检查设置checked
  3511. if (v.value == item.value) {
  3512. arr.push(index);
  3513. }
  3514. });
  3515. } else {
  3516. item.checked = false;
  3517. }
  3518. });
  3519. this.linkCheckLis.forEach((item, index) => {
  3520. item.checked = arr.includes(index);
  3521. });
  3522. console.log(e, this.linkCheckLis);
  3523. //检查有紧急度,则加急
  3524. if (flag) {
  3525. this.allowUrgent = "1";
  3526. this.urgentReason = "系统根据检查信息,自动进行加急";
  3527. } else {
  3528. this.allowUrgent = "0";
  3529. this.urgentReason = "";
  3530. }
  3531. this.clickYYFlag = false;
  3532. // 有预约时间并且选中的
  3533. this.filterLinkCheckLis = this.linkCheckLis.filter(
  3534. (item) => Boolean(item.yyTime) && item.checked
  3535. );
  3536. //有预约时间并且选中的检查数组不为空,并且预约建单的开关开启
  3537. if (this.filterLinkCheckLis.length && this.appointmentBuildFlag == "1") {
  3538. //当前时间要大于生效时间
  3539. this.isYyInspect = this.filterLinkCheckLis.every((item) => {
  3540. return (
  3541. parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() >
  3542. this.leadTime * 60 * 1000
  3543. );
  3544. });
  3545. this.allowUrgentChange(this.allowUrgent);
  3546. if (this.allowUrgent == 0) {
  3547. //不加急状态下,回显时间
  3548. this.showDateTime();
  3549. }
  3550. } else {
  3551. //有预约时间并且选中的检查数组为空
  3552. this.isYyInspect = false;
  3553. this.yyTime = null;
  3554. this.yyDate = null;
  3555. }
  3556. this.linkCheckLisTrue = e.length > 0;
  3557. this.isInspectPriority = e.some((item) => item.priority == 1);
  3558. }
  3559. // 是否加急
  3560. allowUrgentChange(e) {
  3561. // this.urgentReasonValidator = (control: FormControl): { [s: string]: boolean } => {
  3562. // if (e == 1) {
  3563. // return { required: true };
  3564. // }
  3565. // };
  3566. if (e == 0) {
  3567. this.patientForm.get("urgentReason")!.clearValidators();
  3568. this.patientForm.get("urgentReason")!.markAsPristine();
  3569. } else {
  3570. this.patientForm.get("urgentReason")!.setValidators(Validators.required);
  3571. this.patientForm.get("urgentReason")!.markAsDirty();
  3572. }
  3573. this.patientForm.get("urgentReason")!.updateValueAndValidity();
  3574. if (this.isYyInspect) {
  3575. this.isYyInspect = e == 0;
  3576. if (!this.isYyInspect) {
  3577. this.yyDate = null;
  3578. this.yyDateZy = null;
  3579. this.yyTime = null;
  3580. this.yyTimeZy = null;
  3581. }
  3582. } else {
  3583. this.yyDate = null;
  3584. this.yyDateZy = null;
  3585. this.yyTime = null;
  3586. this.yyTimeZy = null;
  3587. }
  3588. }
  3589. // 禁用小时
  3590. disabledHours = (): number[] => {
  3591. let now = new Date();
  3592. let nHour = now.getHours();
  3593. let nMinute = now.getMinutes();
  3594. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  3595. return range(0, nHour + 1);
  3596. } else {
  3597. return range(0, nHour);
  3598. }
  3599. }
  3600. // 禁用分钟
  3601. disabledMinutes = (hour: number): number[] => {
  3602. let now = new Date();
  3603. let nHour = now.getHours();
  3604. let nMinute = now.getMinutes();
  3605. if (hour === nHour || hour === undefined) {
  3606. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  3607. } else {
  3608. return [];
  3609. }
  3610. }
  3611. // start和end之间能被n整除的所有数字集合
  3612. integralDivision(start:number, end:number, n:number): number[]{
  3613. let arr = [];
  3614. for(let i = start; i <= end; i++){
  3615. if(i % n === 0){
  3616. arr.push(i);
  3617. }
  3618. }
  3619. return arr;
  3620. }
  3621. // 快捷一键发起建单
  3622. shortcutMsg; //一键发起信息
  3623. buildMsg: any = {}; //一键发起返回信息
  3624. buildType: string = ""; //快捷建单类型
  3625. historyCustomRemarks = []; //历史快捷输入
  3626. msgId:any;
  3627. // 打开一键发起建单模态框
  3628. newShortcutOrder(msg, type) {
  3629. this.workOrderRemark = "";
  3630. this.customRemarks = [];
  3631. this.historyCustomRemarks = [];
  3632. console.log(msg, type);
  3633. this.buildType = type;
  3634. this.shortcutMsg = msg;
  3635. this.initForm();
  3636. this.buildMsg = {};
  3637. this.msgId = msg.id;
  3638. let postData = {
  3639. taskTypeId: msg.id,
  3640. };
  3641. this.nLoading = true;
  3642. this.mainService
  3643. .postCustom("nurse", "workOrder/buildTrip", postData)
  3644. .subscribe((result) => {
  3645. result.start.start.list.forEach(i=>{
  3646. if(i.inputcode){
  3647. i.inputcode = i.inputcode.toUpperCase()
  3648. if(this.deptDisplay ==2){
  3649. i.deptalias = i.deptalias + '('+i.inputcode+')'
  3650. }else{
  3651. i.dept = i.dept + '('+i.inputcode+')'
  3652. }
  3653. }
  3654. })
  3655. result.end.end.list.forEach(i=>{
  3656. if(i.inputcode){
  3657. i.inputcode = i.inputcode.toUpperCase()
  3658. if(this.deptDisplay ==2){
  3659. i.deptalias = i.deptalias + '('+i.inputcode+')'
  3660. }else{
  3661. i.dept = i.dept + '('+i.inputcode+')'
  3662. }
  3663. }
  3664. })
  3665. this.buildMsg = result;
  3666. if(result.end){
  3667. if(result.end.end.departmentStrategy==202 ||
  3668. result.end.end.departmentStrategy==204 ||
  3669. result.end.end.departmentStrategy==205){
  3670. this.isEndFixedType = true
  3671. }else{
  3672. this.isEndFixedType = false
  3673. }
  3674. }
  3675. if(result.start){
  3676. if(result.start.start.departmentStrategy==202 ||
  3677. result.start.start.departmentStrategy==204 ||
  3678. result.start.start.departmentStrategy==205){
  3679. this.isStartFixedType = true
  3680. }else{
  3681. this.isStartFixedType = false
  3682. }
  3683. }
  3684. if (result.remarksSwitch == 1) {
  3685. if (result.customRemarks === null || result.customRemarks === "") {
  3686. this.customRemarks = [];
  3687. } else {
  3688. this.customRemarks = result.customRemarks.split("$");
  3689. }
  3690. this.workOrderRemarkTips =
  3691. result.remarksPrompts || "请填写工单备注,不超过100个字符";
  3692. let user = JSON.parse(localStorage.getItem("user"));
  3693. this.mainService
  3694. .postCustom("nurse", "workOrder/recentRemarks", {
  3695. deptId: user.user.dept.id,
  3696. taskTypeId: msg.id,
  3697. })
  3698. .subscribe((result1) => {
  3699. this.nLoading = false;
  3700. if (result1.state == 200) {
  3701. this.historyCustomRemarks = result1.data;
  3702. }
  3703. });
  3704. } else {
  3705. this.nLoading = false;
  3706. }
  3707. });
  3708. }
  3709. shortcutForm: FormGroup; //一键发起建单表单
  3710. bxForm: FormGroup; //报修表单
  3711. // 一键建单校验
  3712. // 起点科室校验
  3713. originOfficeShortCutValidator = (
  3714. control: FormControl
  3715. ): { [s: string]: boolean } => {
  3716. if (
  3717. this.shortcutForm &&
  3718. this.shortcutForm.value &&
  3719. !control.value &&
  3720. (this.buildMsg.status == 100013 || this.buildMsg.status == 100015)
  3721. ) {
  3722. return { required: true };
  3723. }
  3724. };
  3725. // 目标科室校验
  3726. targetOfficeShortCutValidator = (
  3727. control: FormControl
  3728. ): { [s: string]: boolean } => {
  3729. if (
  3730. this.shortcutForm &&
  3731. this.shortcutForm.value &&
  3732. !control.value &&
  3733. (this.buildMsg.status == 100014 || this.buildMsg.status == 100015)
  3734. ) {
  3735. return { required: true };
  3736. }
  3737. };
  3738. // 修改工号
  3739. userAccount = null;
  3740. changeAccount(e){
  3741. this.userAccount =this.accountList.find(v => v.id == e);
  3742. }
  3743. // 查看关联业务
  3744. otherBindConfigDto:any = {};
  3745. relationTransModalShow = false; //关联业务弹窗开关
  3746. // 关闭关联业务弹窗
  3747. closeModelRelationTrans(e) {
  3748. this.relationTransModalShow = JSON.parse(e).show;
  3749. }
  3750. // 确定关联业务弹窗
  3751. confirmModelRelationTrans(e) {
  3752. if(JSON.parse(e).otherList.length){
  3753. this.otherDataConfirm(e);
  3754. }else{
  3755. this.message.info('请选择病历!');
  3756. }
  3757. }
  3758. // 一键发起建单保存
  3759. loading5 = false;
  3760. async confirmShortcut(shortcutForm?, buildType?) {
  3761. shortcutForm && (this.shortcutForm = shortcutForm);
  3762. var that = this;
  3763. for (const i in that.shortcutForm.controls) {
  3764. that.shortcutForm.controls[i].markAsDirty();
  3765. that.shortcutForm.controls[i].updateValueAndValidity();
  3766. }
  3767. console.log(that.shortcutForm);
  3768. if (that.shortcutForm.invalid) return;
  3769. that.loading5 = true;
  3770. that.buildType = buildType || "other";
  3771. if(this.buildMsg.reserveUserSwitch == 1 && !this.userAccount){
  3772. this.message.info('请选择工号!');
  3773. this.loading5 = false;
  3774. return;
  3775. }
  3776. // 判断改任务类型是否开启关联数据
  3777. let taskTypeDtoPromise = await this.mainService.getFetchDataList('simple/data', 'otherBindConfig', {"idx":0,"sum":10,"otherBindConfig":{"hosId":1}}).toPromise();
  3778. console.log(taskTypeDtoPromise);
  3779. console.log(that.shortcutMsg);
  3780. let otherBindConfigDto = taskTypeDtoPromise.list.find(v => v.taskTypeId == that.shortcutMsg.id);
  3781. if(taskTypeDtoPromise.status == 200 && otherBindConfigDto && otherBindConfigDto.startAlert == 1 && that.shortcutMsg.bindTrans == 1){
  3782. this.otherBindConfigDto = otherBindConfigDto;
  3783. this.relationTransModalShow = true;
  3784. that.loading5 = false;
  3785. return;
  3786. }
  3787. shortcutForm && (this.isShowBuildQuickConfirm = false);
  3788. this.otherBuildOrder(undefined, buildType);
  3789. }
  3790. otherBuildOrder(otherList?,buildType?){
  3791. var that = this;
  3792. // 其他
  3793. let workOrderRemark = '';
  3794. if(otherList){
  3795. workOrderRemark = this.userAccount ? `${this.userAccount.account}-${this.userAccount.name}:${this.workOrderRemark}共${otherList.length}本${this.otherBindConfigDto.relationTrans.name}` : this.workOrderRemark + `共${otherList.length}本${this.otherBindConfigDto.relationTrans.name}`;
  3796. }else{
  3797. workOrderRemark = this.userAccount ? `${this.userAccount.account}-${this.userAccount.name}:${this.workOrderRemark}` : this.workOrderRemark;
  3798. }
  3799. let postData = {
  3800. workOrder: {
  3801. sourceId: SourceId.hushi,
  3802. workOrderRemark,
  3803. taskType: { id: that.shortcutMsg.id },
  3804. createDept: that.loginUserDeptId,
  3805. startDept: { id: that.buildMsg.startDept },
  3806. endDepts: [{ id: that.buildMsg.endDept }],
  3807. otherList: otherList || undefined,
  3808. },
  3809. };
  3810. if (
  3811. (that.buildMsg.status == 100013 || that.buildMsg.status == 100015) &&
  3812. that.shortcutForm.value.originOffice
  3813. ) {
  3814. postData.workOrder.startDept.id = that.shortcutForm.value.originOffice;
  3815. }
  3816. if (that.shortcutForm.value.targetOffice) {
  3817. postData.workOrder["endDepts"] = [
  3818. { id: that.shortcutForm.value.targetOffice },
  3819. ];
  3820. } else {
  3821. postData.workOrder["endDepts"] = [
  3822. { id: that.buildMsg.end.end.list[0].id },
  3823. ];
  3824. }
  3825. console.log(postData);
  3826. this.newOrderTimeFun(postData.workOrder, () => {
  3827. that.loading5 = false;
  3828. }, () => {
  3829. that.mainService
  3830. .postCustom("api", this.shortcutMsg.reserveSwitch == 1 && this.currentDept.typeValue != 'recovery' && this.currentDept.typeValue != 'surgery' ? "reserveOrder" :"startOrder", postData)
  3831. .subscribe((data) => {
  3832. this.message.remove(this.jdFlagId);
  3833. that.loading5 = false;
  3834. if (data.status == 200 && (that.buildType == "other" || that.buildType == "ordinary")) {
  3835. that.showPromptModal("创建", true, "", that.buildType);
  3836. this.getTodayNum();
  3837. } else if (data.status == 200 && that.buildType == "bb") {
  3838. that.showPromptModal("创建", true, "", "bb");
  3839. this.getTodayNum();
  3840. } else if (that.buildType == "bb" && data.status == 100043) {
  3841. that.showPromptModal("创建", true, data.msg);
  3842. this.getTodayNum();
  3843. } else if (data.status == 1000033) {
  3844. //重复建单那策略
  3845. this.repeatMsg = data.msg;
  3846. this.showDelModal(postData, that.buildType);
  3847. } else {
  3848. that.showPromptModal("创建", false, data.msg);
  3849. }
  3850. // 重置
  3851. this.getDeptTaskType();
  3852. });
  3853. })
  3854. }
  3855. // ======================start===============================
  3856. // 快捷一键发起建单
  3857. shortcutModal: boolean = false; //检查信息一键建单模态框
  3858. shortcutMsg1; //一键发起信息
  3859. buildMsg1: any = {}; //一键发起返回信息
  3860. urgentFlag = false;
  3861. bLoading = false; //收取标本的loading
  3862. // 打开一键发起建单模态框,urgent为true的时候是紧急
  3863. historyCustomRemarks1 = [];
  3864. newShortcutOrder1(msg, type, urgent?) {
  3865. this.btnLoading = false;
  3866. this.workOrderRemark1 = "";
  3867. this.customRemarks1 = [];
  3868. this.historyCustomRemarks1 = [];
  3869. console.log(msg, type);
  3870. this.urgentFlag = Boolean(urgent);
  3871. this.buildType = type;
  3872. this.shortcutMsg1 = msg;
  3873. this.initForm();
  3874. this.buildMsg1 = {};
  3875. let postData = {
  3876. taskTypeId: msg.id,
  3877. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  3878. };
  3879. this.bLoading = true;
  3880. this.mainService
  3881. .postCustom("nurse", "workOrder/buildTrip", postData)
  3882. .subscribe((result) => {
  3883. this.shortcutModal = true;
  3884. this.buildMsg1 = result;
  3885. if (result.remarksSwitch == 1) {
  3886. if (result.customRemarks === null || result.customRemarks === "") {
  3887. this.customRemarks1 = [];
  3888. } else {
  3889. this.customRemarks1 = result.customRemarks.split("$");
  3890. }
  3891. this.workOrderRemarkTips1 =
  3892. result.remarksPrompts || "请填写工单备注,不超过100个字符";
  3893. let user = JSON.parse(localStorage.getItem("user"));
  3894. this.mainService
  3895. .postCustom("nurse", "workOrder/recentRemarks", {
  3896. deptId: user.user.dept.id,
  3897. taskTypeId: msg.id,
  3898. })
  3899. .subscribe((result1) => {
  3900. this.bLoading = false;
  3901. if (result1.state == 200) {
  3902. this.historyCustomRemarks1 = result1.data;
  3903. }
  3904. });
  3905. } else {
  3906. this.bLoading = false;
  3907. }
  3908. });
  3909. }
  3910. hideShortcutOrder() {
  3911. this.shortcutModal = false;
  3912. }
  3913. shortcutForm1: FormGroup; //一键发起建单表单
  3914. // 一键建单校验
  3915. // 起点科室校验
  3916. originOfficeShortCutValidator1 = (
  3917. control: FormControl
  3918. ): { [s: string]: boolean } => {
  3919. if (
  3920. this.shortcutForm1 &&
  3921. this.shortcutForm1.value &&
  3922. !control.value &&
  3923. (this.buildMsg1.status == 100013 || this.buildMsg1.status == 100015)
  3924. ) {
  3925. return { required: true };
  3926. }
  3927. };
  3928. // 目标科室校验
  3929. targetOfficeShortCutValidator1 = (
  3930. control: FormControl
  3931. ): { [s: string]: boolean } => {
  3932. if (
  3933. this.shortcutForm1 &&
  3934. this.shortcutForm1.value &&
  3935. !control.value &&
  3936. (this.buildMsg1.status == 100014 || this.buildMsg1.status == 100015)
  3937. ) {
  3938. return { required: true };
  3939. }
  3940. };
  3941. // 建单判断时间-护士端建单通用方法
  3942. isShowConfirm:boolean = true;
  3943. isShowConfirmInfo:string = '';
  3944. newOrderTimeFun(order, fun1, fun2){
  3945. if(this.currentDept.typeValue != 'recovery' && this.currentDept.typeValue != 'surgery'){
  3946. let taskTypeId = order.taskType.id;
  3947. let deptId = order.createDept;
  3948. let maskFlag = this.message.loading("正在加载中..", {
  3949. nzDuration: 0,
  3950. }).messageId;
  3951. this.mainService
  3952. .postCustom("api", "compareWorkTime", {taskTypeId, deptId, yyTime: order.yyTime})
  3953. .subscribe((data) => {
  3954. this.message.remove(maskFlag);
  3955. if(data.state == 200){
  3956. fun2.call(this);
  3957. }else{
  3958. fun1.call(this);
  3959. this.limitTimeModal = true;
  3960. this.limitTimeItem = {taskTypeId, fun1, fun2};
  3961. this.limitTimeInfo = data.data.remark;
  3962. this.isShowConfirm = data.data.limitType == 1;
  3963. if(this.isShowConfirm || data.data.limitNum == 1){
  3964. this.isShowConfirmInfo = '';
  3965. }else{
  3966. this.isShowConfirmInfo = '请在规定时间内下单';
  3967. }
  3968. }
  3969. })
  3970. }else{
  3971. fun2.call(this);
  3972. }
  3973. }
  3974. limitTimeModal: boolean = false; //模态框
  3975. limitTimeInfo:string = '';
  3976. limitTimeItem: any = {};
  3977. hideLimitTimeModal() {
  3978. this.limitTimeModal = false;
  3979. }
  3980. // 确认
  3981. jdFlagId;
  3982. limitTimeLoading:boolean = false;
  3983. confirmLimitTime() {
  3984. console.log(this.limitTimeItem);
  3985. this.limitTimeModal = false;
  3986. this.jdFlagId = this.message.loading("正在加载中..", {
  3987. nzDuration: 0,
  3988. }).messageId;
  3989. this.limitTimeItem.fun2.call(this);
  3990. }
  3991. // 一键发起建单保存
  3992. confirmShortcut1(shortcutForm?) {
  3993. shortcutForm && (this.shortcutForm1 = shortcutForm);
  3994. var that = this;
  3995. for (const i in that.shortcutForm1.controls) {
  3996. that.shortcutForm1.controls[i].markAsDirty();
  3997. that.shortcutForm1.controls[i].updateValueAndValidity();
  3998. }
  3999. console.log(that.shortcutForm1);
  4000. if (that.shortcutForm1.invalid) return;
  4001. shortcutForm && (this.isShowBuildQuickConfirm = false);
  4002. that.btnLoading = true;
  4003. let postData;
  4004. if (that.buildType == "bb") {
  4005. // 标本
  4006. postData = {
  4007. urgent: this.urgentFlag ? 1 : 0,
  4008. workOrder: {
  4009. sourceId: SourceId.hushi,
  4010. workOrderRemark: this.workOrderRemark1,
  4011. taskType: { id: that.shortcutMsg1.id },
  4012. createDept: that.loginUserDeptId,
  4013. startDept: { id: that.loginUserDeptId },
  4014. },
  4015. };
  4016. }
  4017. console.log(postData);
  4018. this.newOrderTimeFun(postData.workOrder, () => {
  4019. this.hideShortcutOrder();
  4020. }, () => {
  4021. that.mainService
  4022. .postCustom("api", "startOrder", postData)
  4023. .subscribe((data) => {
  4024. this.message.remove(this.jdFlagId);
  4025. this.hideShortcutOrder();
  4026. console.log(that.buildType, data.status);
  4027. if (data.status == 200 && that.buildType == "other") {
  4028. that.showPromptModal("创建", true, "", "other");
  4029. this.getTodayNum();
  4030. } else if (data.status == 200 && that.buildType == "bb") {
  4031. that.showPromptModal("创建", true, "", "bb");
  4032. this.getTodayNum();
  4033. } else if (that.buildType == "bb" && data.status == 100043) {
  4034. that.showPromptModal("创建", true, data.msg);
  4035. this.getOrderList();
  4036. this.getSpecimenWorkOrderMsg();
  4037. this.getTodayNum();
  4038. } else if (data.status == 1000033) {
  4039. //重复建单那策略
  4040. this.repeatMsg = data.msg;
  4041. this.showDelModal(postData, "specimen");
  4042. } else {
  4043. that.showPromptModal("创建", false, data.msg);
  4044. }
  4045. });
  4046. });
  4047. }
  4048. repeatModal: boolean = false; //删除模态框
  4049. repeatMsg = "";
  4050. loadingRepeat = false;
  4051. repeatPostData;
  4052. sourceType;
  4053. isYuyue;
  4054. showDelModal(postData, sourceType, yuyue?) {
  4055. this.repeatModal = true;
  4056. this.repeatPostData = postData;
  4057. this.sourceType = sourceType;
  4058. this.isYuyue = yuyue ? yuyue : false;
  4059. }
  4060. hideRepeatModal() {
  4061. this.repeatModal = false;
  4062. this.btnLoading = false;
  4063. }
  4064. confirmRepeat() {
  4065. this.loadingRepeat = true;
  4066. this.repeatPostData.tipsCreateOder = 1;
  4067. this.newOrderTimeFun(this.repeatPostData.workOrder, () => {
  4068. this.loadingRepeat = false;
  4069. this.repeatModal = false;
  4070. }, () => {
  4071. this.mainService
  4072. .postCustom(
  4073. "api",
  4074. this.isYuyue ? "appointmentOrder" : "startOrder",
  4075. this.repeatPostData
  4076. )
  4077. .subscribe((data) => {
  4078. this.message.remove(this.jdFlagId);
  4079. this.loadingRepeat = false;
  4080. this.repeatModal = false;
  4081. if(this.currentDept.typeValue == 'recovery'){
  4082. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.repeatPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  4083. this.confirmRepeatFun(data);
  4084. });
  4085. }else{
  4086. this.confirmRepeatFun(data);
  4087. }
  4088. });
  4089. })
  4090. }
  4091. confirmRepeatFun(data){
  4092. if (this.sourceType === "specimen") {
  4093. // 标本建单
  4094. if (data.status == 200 && (this.buildType == "other" || this.buildType == "ordinary")) {
  4095. this.showPromptModal("创建", true, "", this.buildType);
  4096. this.getTodayNum();
  4097. } else if (data.status == 200 && this.buildType == "bb") {
  4098. this.showPromptModal("创建", true, "", "bb");
  4099. this.getTodayNum();
  4100. } else if (this.buildType == "bb" && data.status == 100043) {
  4101. this.showPromptModal("创建", true, data.msg);
  4102. this.getOrderList();
  4103. this.getSpecimenWorkOrderMsg();
  4104. this.getTodayNum();
  4105. } else {
  4106. this.showPromptModal("创建", false, data.msg);
  4107. }
  4108. } else if (this.sourceType === "other" || this.sourceType === "ordinary") {
  4109. // 其他建单
  4110. if (data.status == 200 && (this.buildType == "other" || this.buildType == "ordinary")) {
  4111. this.showPromptModal("创建", true, "", this.buildType);
  4112. this.getTodayNum();
  4113. } else if (data.status == 200 && this.buildType == "bb") {
  4114. this.showPromptModal("创建", true, "", "bb");
  4115. this.getTodayNum();
  4116. } else if (this.buildType == "bb" && data.status == 100043) {
  4117. this.showPromptModal("创建", true, data.msg);
  4118. this.getTodayNum();
  4119. } else {
  4120. this.showPromptModal("创建", false, data.msg);
  4121. }
  4122. } else if (this.sourceType === "transport") {
  4123. // 转运
  4124. if (data.status == 200) {
  4125. this.showPromptModal("创建", true, "");
  4126. this.goodsLis = [];
  4127. // this.workOrderInspectScore = undefined;
  4128. this.getOrderList();
  4129. this.getDeptTaskType();
  4130. this.getTodayNum();
  4131. } else if (data.status == 100042) {
  4132. this.showPromptModal("创建", false, data.msg);
  4133. this.getPatient(this.tabSearchCont);
  4134. } else {
  4135. this.showPromptModal("创建", false, data.msg);
  4136. }
  4137. } else if (this.sourceType === "accompany1") {
  4138. // 陪检
  4139. if (data.status == 200) {
  4140. this.showPromptModal("创建", true, "");
  4141. this.goodsLis = [];
  4142. // this.workOrderInspectScore = undefined;
  4143. this.getOrderList();
  4144. this.getDeptTaskType();
  4145. this.getTodayNum();
  4146. } else if (data.status == 100042) {
  4147. this.showPromptModal("创建", false, data.msg);
  4148. this.getPatient(this.tabSearchCont);
  4149. } else {
  4150. this.showPromptModal("创建", false, data.msg);
  4151. }
  4152. } else if (this.sourceType === "accompany2") {
  4153. // 陪检
  4154. if (data.status == 200) {
  4155. this.showPromptModal("创建", true, "");
  4156. this.goodsLis = [];
  4157. // this.workOrderInspectScore = undefined;
  4158. this.getOrderList();
  4159. this.getDeptTaskType();
  4160. this.getTodayNum();
  4161. } else if (data.status == 100042) {
  4162. this.showPromptModal("创建", false, data.msg);
  4163. this.getPatient(this.tabSearchCont);
  4164. } else {
  4165. this.showPromptModal("创建", false, data.msg);
  4166. }
  4167. } else if (this.sourceType === "accompany3") {
  4168. // 陪检
  4169. if (data.status == 200) {
  4170. this.showPromptModal("创建", true, "");
  4171. this.goodsLis = [];
  4172. // this.workOrderInspectScore = undefined;
  4173. this.getOrderList();
  4174. this.getDeptTaskType();
  4175. this.getTodayNum();
  4176. } else if (data.status == 100042) {
  4177. this.showPromptModal("创建", false, data.msg);
  4178. this.getPatient(this.tabSearchCont);
  4179. } else {
  4180. this.showPromptModal("创建", false, data.msg);
  4181. }
  4182. } else if (this.sourceType === "accompany4") {
  4183. // 陪检
  4184. if (data.status == 200) {
  4185. this.showPromptModal("创建", true, "");
  4186. this.goodsLis = [];
  4187. // this.workOrderInspectScore = undefined;
  4188. this.getOrderList();
  4189. this.getDeptTaskType();
  4190. this.getTodayNum();
  4191. } else if (data.status == 100042) {
  4192. this.showPromptModal("创建", false, data.msg);
  4193. this.getPatient(this.tabSearchCont);
  4194. } else {
  4195. this.showPromptModal("创建", false, data.msg);
  4196. }
  4197. } else if (this.sourceType === "accompany5") {
  4198. // 陪检
  4199. if (data.status == 200) {
  4200. this.showPromptModal("创建", true, "");
  4201. this.goodsLis = [];
  4202. // this.workOrderInspectScore = undefined;
  4203. this.getOrderList();
  4204. this.getDeptTaskType();
  4205. this.getTodayNum();
  4206. } else if (data.status == 100042) {
  4207. this.showPromptModal("创建", false, data.msg);
  4208. this.getPatient(this.tabSearchCont);
  4209. } else {
  4210. this.showPromptModal("创建", false, data.msg);
  4211. }
  4212. }
  4213. }
  4214. // =======================end=================================
  4215. // 页面中间部分tab切换
  4216. checkedTableType: string = "";
  4217. checkTable(type) {
  4218. if(typeof type === 'object'){
  4219. if(type.system){
  4220. this.checkedTableType = 'other';
  4221. }else{
  4222. this.checkedTableType = type.id;
  4223. }
  4224. this.getDeptTaskType('');
  4225. }else{
  4226. this.checkedTableType = type;
  4227. }
  4228. this.positionY = 0;
  4229. this.selectOtherId = null;
  4230. this.otherSearch = '';
  4231. if (type === "surgery") {
  4232. this.getSurgery(true);
  4233. } else if (type === "outpatientHelpAppointment") {
  4234. this.getOutpatientHelpAppointment(true);
  4235. } else if (type === "historySpecimen") {
  4236. this.getHistorySpecimen(true);
  4237. } else if (type === "historyDrugsbag") {
  4238. this.getHistoryDrugsbag(true);
  4239. } else if (type === "bxlb" && this.isShowBx && this.coopBtns.repairList) {
  4240. this.getBxlb(this.bxlbPageIndex);
  4241. // this.getIncidentState();
  4242. this.getDegrees();
  4243. }
  4244. }
  4245. //提交报修
  4246. bxLoading = false;
  4247. submitBxForm() {
  4248. for (const i in this.bxForm.controls) {
  4249. this.bxForm.controls[i].markAsDirty();
  4250. this.bxForm.controls[i].updateValueAndValidity();
  4251. }
  4252. if (this.bxForm.invalid) return;
  4253. // if(!this.selectIncidentId){
  4254. // this.message.error("请选择故障现象!");
  4255. // return;
  4256. // }
  4257. this.bxLoading = true;
  4258. this.mainService.wxbx({}).subscribe((result) => {
  4259. if ((result as any).status == 200) {
  4260. let bxcode = (result as any).data; //生成微信报修号
  4261. let postData = {
  4262. verification: "true",
  4263. incident: {
  4264. branch:this.loginUser.currentHospital.id,
  4265. // contacts: this.loginUser.name,
  4266. deptId:this.loginUser.dept.id,
  4267. // contactsInformation: this.loginUser.phone,
  4268. // address: this.bxForm.controls.address.value,
  4269. // areaId: this.bxForm.controls.hospital.value,
  4270. // contacts: this.bxForm.controls.name.value,
  4271. // contactsInformation: this.bxForm.controls.phone.value,
  4272. description: this.bxForm.controls.content.value,
  4273. categoryId: this.selectIncidentId,
  4274. // placeId: this.bxForm.controls.building.value,
  4275. requester: { account: this.loginUser.account },
  4276. sourceType: "wechatUserIncident",
  4277. fileUrl: "url",
  4278. bxcode,
  4279. },
  4280. loginUser: {
  4281. account: this.loginUser.account,
  4282. id: this.loginUser.id,
  4283. },
  4284. };
  4285. this.mainService.addWxIncident(postData).subscribe((res) => {
  4286. this.bxLoading = false;
  4287. if ((res as any).state == 200) {
  4288. this.showPromptModal("提交", true, "");
  4289. this.checkTable("bxlb");
  4290. } else {
  4291. this.showPromptModal("提交", false, (res as any).msg);
  4292. }
  4293. });
  4294. } else {
  4295. this.bxLoading = false;
  4296. this.showPromptModal("提交", false, "");
  4297. }
  4298. });
  4299. }
  4300. // 意见箱表格数据
  4301. adviceList: any = [];
  4302. advicePageIndex: number = 1; //表格当前页码
  4303. advicePageSize: number = 10; //表格每页展示条数
  4304. adviceListLength: number = 10; //表格总数据量
  4305. adviceSearchInp: string = ""; //意见箱搜索
  4306. adviceLoading = false;
  4307. getAdvice(idx?) {
  4308. if(!this.coopBtns.suggestionBox){
  4309. return;
  4310. }
  4311. if(idx){
  4312. this.advicePageIndex = 1;
  4313. }
  4314. let that = this;
  4315. let postData = {
  4316. advice: {
  4317. content: that.adviceSearchInp || "",
  4318. creatDepartment: {
  4319. id: that.loginUserDeptId,
  4320. },
  4321. createUser: {
  4322. id: that.loginUser.id,
  4323. },
  4324. },
  4325. idx: that.advicePageIndex - 1,
  4326. sum: that.advicePageSize,
  4327. };
  4328. this.adviceLoading = true;
  4329. that.mainService
  4330. .getFetchDataList("adviceCollection", "advice", postData)
  4331. .subscribe((data) => {
  4332. this.adviceLoading = false;
  4333. that.adviceList = data.list || [];
  4334. that.adviceListLength = data.totalNum || 0;
  4335. });
  4336. }
  4337. startDate:any = format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss");
  4338. endDate:any = format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss");
  4339. scheduleTime: any = format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss");
  4340. changeDate(result){
  4341. if(result){
  4342. this.startDate = format(result, 'yyyy-MM-dd') +' '+ '00:00:00';
  4343. this.endDate = format(result, 'yyyy-MM-dd') +' '+'23:59:59';
  4344. }else{
  4345. this.startDate = null
  4346. this.endDate = null
  4347. }
  4348. }
  4349. // 手术排程信息表格数据
  4350. surgeryList: any = [];
  4351. surgeryPageIndex: number = 1; //表格当前页码
  4352. surgeryPageSize: number = 10; //表格每页展示条数
  4353. surgeryListLength: number = 10; //表格总数据量
  4354. surgeryCodeSearchInp: string = ""; //标本编码搜索
  4355. surgeryParentSearchInp: string = ""; //患者信息搜索
  4356. surgeryInfoLoading = false;
  4357. getSurgery(idx?) {
  4358. if (idx) {
  4359. this.surgeryPageIndex = 1;
  4360. }
  4361. let postData:any = {
  4362. surgery: {
  4363. applyDateStart: this.startDate,
  4364. applyDateEnd: this.endDate,
  4365. // hosId: this.currentHospital.id,
  4366. },
  4367. idx: this.surgeryPageIndex - 1,
  4368. sum: this.surgeryPageSize,
  4369. };
  4370. if(this.currentDept.typeValue == 'surgery'){
  4371. postData.surgery.surgeryDept = this.loginUserDeptId;
  4372. }else{
  4373. postData.surgery.areaDept = this.loginUserDeptId;
  4374. }
  4375. this.surgeryInfoLoading = true;
  4376. this.mainService
  4377. .getFetchDataList("simple/data", "surgery", postData)
  4378. .subscribe((data) => {
  4379. this.surgeryInfoLoading = false;
  4380. this.surgeryList = data.list || [];
  4381. this.surgeryListLength = data.totalNum || 0;
  4382. });
  4383. }
  4384. // 门诊帮扶表格数据
  4385. outpatientHelpAppointmentList: any = [];
  4386. outpatientHelpAppointmentPageIndex: number = 1; //表格当前页码
  4387. outpatientHelpAppointmentPageSize: number = 10; //表格每页展示条数
  4388. outpatientHelpAppointmentListLength: number = 10; //表格总数据量
  4389. outpatientHelpAppointmentDateSearchInp = new Date(); //预约时间搜索
  4390. outpatientHelpAppointmentInfoLoading = false;
  4391. getOutpatientHelpAppointment(idx?) {
  4392. if (idx) {
  4393. this.outpatientHelpAppointmentPageIndex = 1;
  4394. }
  4395. let postData:any = {
  4396. patientAppointment: {
  4397. escortTime: this.outpatientHelpAppointmentDateSearchInp ? format(startOfDay(this.outpatientHelpAppointmentDateSearchInp), "yyyy-MM-dd HH:mm:ss") : undefined,
  4398. hosId: this.currentHospital.id,
  4399. },
  4400. idx: this.outpatientHelpAppointmentPageIndex - 1,
  4401. sum: this.outpatientHelpAppointmentPageSize,
  4402. };
  4403. this.outpatientHelpAppointmentInfoLoading = true;
  4404. this.mainService
  4405. .getFetchDataList("simple/data", "patientAppointment", postData)
  4406. .subscribe((data) => {
  4407. this.outpatientHelpAppointmentInfoLoading = false;
  4408. this.outpatientHelpAppointmentList = data.list || [];
  4409. this.outpatientHelpAppointmentListLength = data.totalNum || 0;
  4410. });
  4411. }
  4412. // 历史标本查询表格数据
  4413. historySpecimenList: any = [];
  4414. historySpecimenPageIndex: number = 1; //表格当前页码
  4415. historySpecimenPageSize: number = 10; //表格每页展示条数
  4416. historySpecimenListLength: number = 10; //表格总数据量
  4417. historySpecimenCodeSearchInp: string = ""; //标本编码搜索
  4418. historySpecimenParentSearchInp: string = ""; //患者信息搜索
  4419. hsLoading = false;
  4420. getHistorySpecimen(idx?) {
  4421. if (idx) {
  4422. this.historySpecimenPageIndex = 1;
  4423. }
  4424. let current = JSON.parse(localStorage.getItem("user"));
  4425. let postData = {
  4426. specimen: {
  4427. hosId: this.currentHospital.id,
  4428. sickRoom: {
  4429. id: current.user.dept.id,
  4430. },
  4431. scode:
  4432. this.historySpecimenCodeSearchInp === ""
  4433. ? null
  4434. : this.historySpecimenCodeSearchInp,
  4435. keyWord:
  4436. this.historySpecimenParentSearchInp === ""
  4437. ? null
  4438. : this.historySpecimenParentSearchInp,
  4439. },
  4440. idx: this.historySpecimenPageIndex - 1,
  4441. sum: this.historySpecimenPageSize,
  4442. };
  4443. this.hsLoading = true;
  4444. this.mainService
  4445. .getFetchDataList("simple/data", "specimen", postData)
  4446. .subscribe((data) => {
  4447. this.hsLoading = false;
  4448. this.historySpecimenList = data.list || [];
  4449. this.historySpecimenListLength = data.totalNum || 0;
  4450. });
  4451. }
  4452. // 历史药单查询表格数据
  4453. historyDrugsbagList: any = [];
  4454. historyDrugsbagPageIndex: number = 1; //表格当前页码
  4455. historyDrugsbagPageSize: number = 10; //表格每页展示条数
  4456. historyDrugsbagListLength: number = 10; //表格总数据量
  4457. historyDrugsbagCodeSearchInp: string = ""; //发药单号搜索
  4458. // historyDrugsbagParentSearchInp: string = ""; //患者信息搜索
  4459. hsDLoading = false;
  4460. getHistoryDrugsbag(idx?) {
  4461. if (idx) {
  4462. this.historyDrugsbagPageIndex = 1;
  4463. }
  4464. let current = JSON.parse(localStorage.getItem("user"));
  4465. let postData = {
  4466. drugsBag: {
  4467. target: {
  4468. id: current.user.dept.id,
  4469. },
  4470. packid:
  4471. this.historyDrugsbagCodeSearchInp === ""
  4472. ? ""
  4473. : this.historyDrugsbagCodeSearchInp,
  4474. platform: 2,
  4475. },
  4476. idx: this.historyDrugsbagPageIndex - 1,
  4477. sum: this.historyDrugsbagPageSize,
  4478. };
  4479. this.hsDLoading = true;
  4480. this.mainService
  4481. .getFetchDataList("api", "drugsBag", postData)
  4482. .subscribe((data) => {
  4483. this.hsDLoading = false;
  4484. this.historyDrugsbagList = data.list || [];
  4485. this.historyDrugsbagListLength = data.totalNum || 0;
  4486. });
  4487. }
  4488. // 获取事件状态
  4489. incidentStateId = undefined;
  4490. incidentStateList = [
  4491. {name: '全部', value: 0},
  4492. {name: '待受理', value: 'accept,storage'},
  4493. {name: '处理中', value: 'pending,handler,reassign'},
  4494. {name: '待评价', value: 'close0', hasWxdegree: 0},
  4495. {name: '已关闭', value: 'close1', hasWxdegree: 1},
  4496. {name: '不受理', value: 'reject'},
  4497. {name: '撤销', value: 'cancel'},
  4498. ];
  4499. // getIncidentState() {
  4500. // let postData = { type: "list", key: "wxincident_state" };
  4501. // this.iLoading = true;
  4502. // this.mainService.getDictionaryByITSM(postData).subscribe((data: any) => {
  4503. // this.iLoading = false;
  4504. // if (data.status == 200) {
  4505. // this.incidentStateList = data.data || [];
  4506. // }
  4507. // });
  4508. // }
  4509. // 报修列表查询表格数据
  4510. bxlbList: any = [];
  4511. bxlbPageIndex: number = 1; //表格当前页码
  4512. bxlbPageSize: number = 10; //表格每页展示条数
  4513. bxlbListLength: number = 10; //表格总数据量
  4514. bxlbCodeSearchInp: string = ""; //标本编码搜索
  4515. bxlbParentSearchInp: string = ""; //患者信息搜索
  4516. processing: number = 0; //处理中的数量
  4517. bxlbLoading = false;
  4518. repairIncidentTypeList = [];//科室报修或公共报修
  4519. getBxlb(idx, isInitState = false) {
  4520. // 获取事件状态
  4521. this.iLoading = true;
  4522. this.bxlbLoading = true;
  4523. this.mainService.getDictionary('list', 'repair_incident_type').subscribe((data: any) => {
  4524. this.iLoading = false;
  4525. this.repairIncidentTypeList = data || [];
  4526. if(isInitState){
  4527. let valueObj2 = this.incidentStateList.find(v => v.value == 0);
  4528. this.incidentStateId = valueObj2 ? valueObj2.value : undefined;
  4529. }
  4530. // 报修列表查询表格数据
  4531. if (idx) {
  4532. this.bxlbPageIndex = 1;
  4533. }
  4534. let current = JSON.parse(localStorage.getItem("user"));
  4535. this.mainService
  4536. .getFetchDataList("simple/data", "incident", {
  4537. idx: this.bxlbPageIndex - 1,
  4538. sum: this.bxlbPageSize,
  4539. incident: {
  4540. repairIncidentType: { id: this.repairIncidentTypeList.find(v => v.value === 'dept').id },
  4541. statesValues: this.incidentStateId || undefined,
  4542. department: { id: current.user.dept.id },
  4543. }
  4544. })
  4545. .subscribe((data: any) => {
  4546. this.bxlbLoading = false;
  4547. this.bxlbList = data.list || [];
  4548. this.bxlbListLength = data.totalNum || 0;
  4549. this.processing = data.totalNum || 0;
  4550. });
  4551. })
  4552. }
  4553. //快速报修列表
  4554. quickBxlbLoading = false;
  4555. quickBxlbList = [];
  4556. getQuickBxlb() {
  4557. this.quickBxlbLoading = true;
  4558. this.mainService
  4559. .getFetchDataList("simple/data", "incidentCategoryContent", { idx: 0, sum: 10 })
  4560. .subscribe((data: any) => {
  4561. this.quickBxlbLoading = false;
  4562. if (data.status == 200) {
  4563. this.quickBxlbList = data.list || [];
  4564. }
  4565. });
  4566. }
  4567. // 意见箱-查看模态框
  4568. adviceModal: boolean = false;
  4569. adviceDetailInfo: any = {}; //意见详情
  4570. adviceDetail(id) {
  4571. this.adviceModal = true;
  4572. this.mainService
  4573. .getFetchData("adviceCollection", "advice", id)
  4574. .subscribe((data) => {
  4575. this.adviceDetailInfo = data.data;
  4576. console.log(this.adviceDetailInfo);
  4577. });
  4578. }
  4579. hideAdvice() {
  4580. this.adviceModal = false;
  4581. }
  4582. // 意见收集
  4583. adviceSubModal: boolean = false;
  4584. adviceSubContent: string; //填写意见内容
  4585. coopAdviceInfo: any = {}; //当前编辑意见详情
  4586. addAdvice(data?) {
  4587. let that = this;
  4588. that.adviceSubContent = "";
  4589. if (data) {
  4590. that.coopAdviceInfo = data;
  4591. that.adviceSubContent = data.content;
  4592. }
  4593. that.adviceSubModal = true;
  4594. }
  4595. hideSubAdvice() {
  4596. this.adviceSubModal = false;
  4597. }
  4598. // 提交意见内容
  4599. confirmSubAdvice() {
  4600. let that = this;
  4601. if (!that.adviceSubContent) return;
  4602. that.btnLoading = true;
  4603. let postData = {
  4604. advice: {
  4605. creatDepartment: {
  4606. id: that.loginUserDeptId,
  4607. },
  4608. createUser: {
  4609. id: that.loginUser.id,
  4610. },
  4611. content: that.adviceSubContent,
  4612. },
  4613. };
  4614. if (that.coopAdviceInfo.id) {
  4615. postData.advice["id"] = that.coopAdviceInfo.id;
  4616. }
  4617. that.mainService
  4618. .postCustom(
  4619. "adviceCollection",
  4620. that.coopAdviceInfo.id ? "updData/advice" : "addData/advice",
  4621. postData
  4622. )
  4623. .subscribe((data) => {
  4624. if (data.status == 200) {
  4625. that.adviceSubModal = false;
  4626. that.showPromptModal(
  4627. that.coopAdviceInfo.id ? "编辑" : "新增",
  4628. true,
  4629. ""
  4630. );
  4631. that.coopAdviceInfo = {};
  4632. that.adviceSubContent = "";
  4633. that.getAdvice();
  4634. } else {
  4635. that.adviceSubModal = false;
  4636. that.showPromptModal(
  4637. that.coopAdviceInfo.id ? "编辑" : "新增",
  4638. false,
  4639. data.msg
  4640. );
  4641. that.adviceSubContent = "";
  4642. }
  4643. });
  4644. }
  4645. // 查看标本详情
  4646. detailModel: boolean = false;
  4647. loading33: boolean = false;
  4648. detailList: any = [];
  4649. // 选择急查或普查(1是急标,0是普标)
  4650. changeSpeDetail(e, speDetailType: number) {
  4651. e.stopPropagation();
  4652. this.detailModel = true;
  4653. let user = JSON.parse(localStorage.getItem("user"));
  4654. let postData = {
  4655. deptId: user.user.dept.id,
  4656. urgent: speDetailType,
  4657. };
  4658. this.loading33 = true;
  4659. this.mainService
  4660. .postCustom("nurse", "getSpecimenWorkOrderDetails", postData)
  4661. .subscribe((result) => {
  4662. this.loading33 = false;
  4663. if (result.status == 200) {
  4664. this.detailList = result.data || [];
  4665. }
  4666. });
  4667. }
  4668. // 跳转患者陪检闭环视图
  4669. changeInspectClosedLoopView(e, stateValue){
  4670. e.stopPropagation();
  4671. let queryParams = {
  4672. department: { id: this.currentDept.id, dept: this.currentDept.dept },
  4673. stateValue,
  4674. }
  4675. this.router.navigateByUrl(`/inspectClosedLoopView?queryParams=${JSON.stringify(queryParams)}`);
  4676. }
  4677. // 标本打包弹窗
  4678. toSpecimenPackage(e, stateValue){
  4679. e.stopPropagation();
  4680. this.viewSpecimenPackageList(stateValue);
  4681. }
  4682. // 隐藏查看标本详情弹层
  4683. hideSpeDetailModel() {
  4684. this.detailModel = false;
  4685. }
  4686. // 意见删除模态框
  4687. delAdviceModal: boolean = false;
  4688. delAdviceId: number; //删除意见id
  4689. delAdvice(id) {
  4690. this.delAdviceId = id;
  4691. this.delAdviceModal = true;
  4692. }
  4693. confirmDelAdvice() {
  4694. let that = this;
  4695. that.btnLoading = true;
  4696. let postData = [that.delAdviceId];
  4697. that.mainService
  4698. .postCustom("adviceCollection", "rmvData/advice", postData)
  4699. .subscribe((data) => {
  4700. if (data.status == 200) {
  4701. that.delAdviceModal = false;
  4702. that.showPromptModal("删除", true, "");
  4703. if (
  4704. that.adviceList.length == 1 &&
  4705. that.advicePageIndex ==
  4706. Math.ceil(that.adviceListLength / that.advicePageSize)
  4707. ) {
  4708. that.adviceListLength--;
  4709. that.advicePageIndex = Math.ceil(
  4710. that.adviceListLength / that.advicePageSize
  4711. );
  4712. }
  4713. that.getAdvice();
  4714. } else {
  4715. that.delAdviceModal = false;
  4716. that.showPromptModal("删除", false, data.msg);
  4717. }
  4718. });
  4719. }
  4720. hideDelAdviceModal() {
  4721. this.delAdviceModal = false;
  4722. }
  4723. // 追加检查删除模态框
  4724. delInspectModal: boolean = false;
  4725. delInspectId: number; //删除id
  4726. btnLoading4:boolean = false;
  4727. delInspect(id) {
  4728. this.delInspectId = id;
  4729. this.delInspectModal = true;
  4730. }
  4731. confirmDelInspect() {
  4732. this.btnLoading4 = true;
  4733. this.mainService
  4734. .coopData("rmvData", "inspect", [this.delInspectId])
  4735. .subscribe((data) => {
  4736. this.delInspectModal = false;
  4737. this.btnLoading4 = false;
  4738. if (data.status == 200) {
  4739. this.message.success('删除检查成功!')
  4740. this.refreshInspectList();
  4741. } else {
  4742. this.message.error(data.msg || '删除检查失败!')
  4743. }
  4744. });
  4745. }
  4746. hideDelInspectModal() {
  4747. this.delInspectModal = false;
  4748. }
  4749. // 报修撤销模态框
  4750. delBxModal: boolean = false;
  4751. delBxData: any; //删除的data
  4752. delBx(data) {
  4753. this.delBxData = data;
  4754. this.delBxModal = true;
  4755. }
  4756. confirmDelBx() {
  4757. this.btnLoading = true;
  4758. this.mainService
  4759. .flowPost("incident/task/cancel", { incident: this.delBxData })
  4760. .subscribe((result) => {
  4761. if(result.state == 200){
  4762. this.delBxModal = false;
  4763. this.showPromptModal("撤销", true, "");
  4764. this.getBxlb(true);
  4765. }else{
  4766. this.delBxModal = false;
  4767. this.showPromptModal("撤销", false, result.msg);
  4768. }
  4769. });
  4770. }
  4771. hideDelBxModal() {
  4772. this.delBxModal = false;
  4773. }
  4774. // 报修提示框
  4775. reqModal: boolean = false;
  4776. extraData:any = {};
  4777. showReqModal() {
  4778. this.extraData.floor = this.floors.find(v => v.id == this.validateBxForm.value.floor);
  4779. // this.reqModal = true;
  4780. this.confirmBxNext(0);
  4781. }
  4782. confirmReq() {
  4783. this.confirmBxNext(1);
  4784. }
  4785. cancelReq() {
  4786. this.confirmBxNext(0);
  4787. }
  4788. hideReqModal() {
  4789. this.reqModal = false;
  4790. }
  4791. // 工单列表下拉筛选
  4792. selectedType: null;
  4793. changeOrderSel(e) {
  4794. this.selectedType = e;
  4795. this.getOrderList();
  4796. }
  4797. // 工单列表工单状态下拉筛选
  4798. changeOrderState(e) {
  4799. this.getOrderList();
  4800. }
  4801. // 工单列表
  4802. orderList: any = [];
  4803. orderIdx: number = 1;
  4804. orderLength: number = 10;
  4805. OLoading: boolean = true;
  4806. getOrderList() {
  4807. let that = this;
  4808. that.orderList = [];
  4809. that.OLoading = true;
  4810. let postData: any = {
  4811. workOrder: {
  4812. createDept: JSON.parse(localStorage.getItem("user")).user.dept.id,
  4813. platform: 2,
  4814. searchDays: 2,
  4815. taskType: {},
  4816. },
  4817. idx: that.orderIdx - 1,
  4818. sum: 10,
  4819. };
  4820. if (that.selectedType && that.selectedType != -1) {
  4821. postData.workOrder.taskType["associationType"] = {
  4822. id: that.selectedType,
  4823. };
  4824. }
  4825. // 执行中包含状态:待抢单、待接单、待到达、待送达、执行中、定时预约
  4826. if (that.orderStateSelected == "1") {
  4827. //执行中
  4828. delete postData.workOrder.gdState;
  4829. postData.workOrder.nurseState = 1;
  4830. } else if (that.orderStateSelected == "2") {
  4831. //待评价
  4832. delete postData.workOrder.nurseState;
  4833. postData.workOrder.gdState = { id: "73" };
  4834. } else {
  4835. //全部
  4836. delete postData.workOrder.nurseState;
  4837. delete postData.workOrder.gdState;
  4838. }
  4839. that.mainService
  4840. .getFetchDataList("nurse", "workOrder", postData)
  4841. .subscribe((data) => {
  4842. that.orderList = data.list || [];
  4843. //显示三项
  4844. that.orderList.forEach((item) => {
  4845. if (item.record.length > 2) {
  4846. let i = item.record
  4847. .reverse()
  4848. .findIndex((step) => step.record.length > 0);
  4849. item.record.reverse();
  4850. i = item.record.length - 1 - i;
  4851. if (i < 2) {
  4852. item.record = item.record.slice(0, 3);
  4853. } else if (i > item.record.length - 2) {
  4854. item.record = item.record.slice(
  4855. item.record.length - 3,
  4856. item.record.length
  4857. );
  4858. } else {
  4859. item.record = item.record.slice(i - 1, i + 2);
  4860. }
  4861. }
  4862. });
  4863. that.orderLength = data.totalNum || 0;
  4864. that.OLoading = false;
  4865. });
  4866. }
  4867. // 撤销
  4868. coopId: number;
  4869. recallOrderModal: boolean = false;
  4870. // 打开撤销模态框
  4871. openRecallModal(id) {
  4872. this.coopId = id;
  4873. this.recallOrderModal = true;
  4874. }
  4875. // 确认撤销
  4876. confirmRec() {
  4877. let that = this;
  4878. that.btnLoading = true;
  4879. that.mainService.delOrder(that.coopId).subscribe((data) => {
  4880. that.closeRecallOrderModal();
  4881. if (data.status == 200) {
  4882. that.getOrderList();
  4883. that.changeInfo();
  4884. this.getTodayNum();
  4885. that.showPromptModal("撤销", true, "");
  4886. } else {
  4887. that.showPromptModal("撤销", false, data.msg);
  4888. }
  4889. });
  4890. }
  4891. // 关闭撤销模态框
  4892. closeRecallOrderModal() {
  4893. this.recallOrderModal = false;
  4894. }
  4895. // 打印二维码-门诊服务点---------------start
  4896. outpatientServiceMsg = "";
  4897. coopOutpatientServiceItem: any;
  4898. outpatientServiceModal: boolean = false;
  4899. // 打开模态框
  4900. openOutpatientServiceModal(item) {
  4901. this.coopOutpatientServiceItem = item;
  4902. this.outpatientServiceMsg = `提示:打印<strong class='red'>${item.patientName}</strong>患者二维码,可用于身份识别`
  4903. this.outpatientServiceModal = true;
  4904. }
  4905. // 确认
  4906. cardNoDto: any = {};
  4907. confirmOutpatientService() {
  4908. this.btnLoading = true;
  4909. this.mainService.qrcodeCardNo({id: this.coopOutpatientServiceItem.id, fieldName: 'cardNo'}).subscribe((data) => {
  4910. this.closeOutpatientServiceModal();
  4911. this.btnLoading = false;
  4912. if (data.state == 200) {
  4913. data.logo = location.origin + '/file' + data.logo || '';
  4914. this.cardNoDto = data;
  4915. this.getPatient();
  4916. // 打印
  4917. setTimeout(()=>{
  4918. this.printBtn.nativeElement.click();
  4919. }, )
  4920. } else {
  4921. this.showPromptModal("打印", false, data.msg);
  4922. }
  4923. });
  4924. }
  4925. // 关闭模态框
  4926. closeOutpatientServiceModal() {
  4927. this.outpatientServiceModal = false;
  4928. }
  4929. // 打印二维码-门诊服务点---------------end
  4930. // 评价
  4931. appraiseModal: boolean = false;
  4932. starNum: number = 5; //评价星
  4933. appraiseContent: string = ""; //评级
  4934. appraiseId: number;
  4935. showAppraise(id) {
  4936. this.appraiseId = id;
  4937. this.appraiseModal = true;
  4938. this.starNum = 5;
  4939. this.appraiseContent = "";
  4940. }
  4941. // 保存评价
  4942. confirmAppraise() {
  4943. console.log(this.starNum, this.appraiseContent);
  4944. let that = this;
  4945. if (!that.starNum) return;
  4946. that.btnLoading = true;
  4947. let id;
  4948. switch (that.starNum) {
  4949. case 1:
  4950. id = 358;
  4951. break;
  4952. case 2:
  4953. id = 357;
  4954. break;
  4955. case 3:
  4956. id = 356;
  4957. break;
  4958. case 4:
  4959. id = 355;
  4960. break;
  4961. case 5:
  4962. id = 354;
  4963. break;
  4964. }
  4965. let postData = {
  4966. serviceEvaluation: { id: id },
  4967. remark: that.appraiseContent,
  4968. };
  4969. this.mainService
  4970. .postCustom("nurse/workOrder", "evaluate/" + this.appraiseId, postData)
  4971. .subscribe((data) => {
  4972. that.hideAppraise();
  4973. if (data.status == 200) {
  4974. that.getOrderList();
  4975. that.showPromptModal("评价", true, "");
  4976. } else {
  4977. that.showPromptModal("评价", false, data.msg);
  4978. }
  4979. });
  4980. }
  4981. hideAppraise() {
  4982. this.appraiseModal = false;
  4983. }
  4984. // 报修评价
  4985. appraiseModalBx: boolean = false;
  4986. starNumBx: number = 5; //评价星
  4987. appraiseContentBx: string = ""; //评级
  4988. appraiseDataBx: any;
  4989. showAppraiseBx(data) {
  4990. this.appraiseDataBx = data;
  4991. this.appraiseModalBx = true;
  4992. this.starNumBx = 5;
  4993. this.appraiseContentBx = "";
  4994. }
  4995. // 保存评价
  4996. confirmAppraiseBx() {
  4997. console.log(this.starNumBx, this.appraiseContentBx);
  4998. if (!this.starNumBx) return;
  4999. this.btnLoading = true;
  5000. let id = this.degrees.find(v=>v.value == this.starNumBx).id;
  5001. let postData = {
  5002. incident: {
  5003. ...this.appraiseDataBx,
  5004. wxdegree: { id },
  5005. wxdegreeremark: this.appraiseContentBx,
  5006. }
  5007. };
  5008. this.mainService
  5009. .flowPost("incident/task/resolve", postData)
  5010. .subscribe((data:any) => {
  5011. this.hideAppraiseBx();
  5012. if (data.state == 200) {
  5013. this.getBxlb(this.bxlbPageIndex);
  5014. this.showPromptModal("评价", true, "");
  5015. } else {
  5016. this.showPromptModal("评价", false, data.msg);
  5017. }
  5018. });
  5019. }
  5020. hideAppraiseBx() {
  5021. this.appraiseModalBx = false;
  5022. }
  5023. // 审核状态
  5024. checkStatusLis: any = [];
  5025. getCheckStatusLis() {
  5026. let that = this;
  5027. that.mainService.getDictionary("list", "check_status").subscribe((data) => {
  5028. that.checkStatusLis = data;
  5029. });
  5030. }
  5031. // 填写加急原因模态框
  5032. jiajiModal: boolean = false;
  5033. jiajiContent: string; //加急原因
  5034. jiajiId; //加急工单id
  5035. showJiaji(id) {
  5036. this.jiajiId = id;
  5037. this.jiajiModal = true;
  5038. this.jiajiContent = "";
  5039. }
  5040. hideJiaji() {
  5041. this.jiajiModal = false;
  5042. }
  5043. // 保存加急原因
  5044. confirmJiaji() {
  5045. let that = this;
  5046. let checkStatusId;
  5047. if (!that.jiajiContent) return;
  5048. that.btnLoading = true;
  5049. that.checkStatusLis.forEach((e) => {
  5050. if (e.value == 1) {
  5051. checkStatusId = e.id;
  5052. }
  5053. });
  5054. let postData = {
  5055. urgentDetails: {
  5056. workerOrder: that.jiajiId,
  5057. checkStatus: { id: checkStatusId },
  5058. urgentReason: that.jiajiContent,
  5059. },
  5060. };
  5061. that.mainService
  5062. .postCustom("workerOrder", "urge", postData)
  5063. .subscribe((data) => {
  5064. if (data.status == 200) {
  5065. that.showPromptModal("加急", true, "");
  5066. that.getOrderList();
  5067. that.hideJiaji();
  5068. } else {
  5069. that.showPromptModal("加急", false, data.msg);
  5070. }
  5071. });
  5072. }
  5073. // 查看工单详情
  5074. openDetails(data) {
  5075. if (data.taskType.associationType.value == 'specimen' || data.taskType.associationType.value == 'specimenPlan') {
  5076. // 标本类
  5077. this.router.navigateByUrl("nurse/detailSample/" + data.id);
  5078. } else if (data.taskType.associationType.value == 'inspect' || data.taskType.associationType.value == 'patientTransport') {
  5079. // 送患者
  5080. this.router.navigateByUrl("nurse/detailPatients/" + data.id);
  5081. } else if (data.taskType.associationType.value == 'drugsBag' || data.taskType.associationType.value == 'jPBag') {
  5082. // 药品配送/静配
  5083. this.router.navigateByUrl("nurse/detailDrug/" + data.id);
  5084. } else if (data.taskType.associationType.value == 'ordinary') {
  5085. // 万能交接服务
  5086. this.router.navigateByUrl("nurse/detailOrdinary/" + data.id);
  5087. } else {
  5088. // 其他
  5089. this.router.navigateByUrl("nurse/detailOthers/" + data.id);
  5090. }
  5091. }
  5092. // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
  5093. showPromptModal(con, success, promptInfo?, back?) {
  5094. this.btnLoading = false;
  5095. this.btnLoading1 = false;
  5096. this.promptModalShow = false;
  5097. this.promptContent = con;
  5098. this.ifSuccess = success;
  5099. this.promptInfo = promptInfo;
  5100. this.back = back;
  5101. setTimeout(() => {
  5102. this.promptModalShow = true;
  5103. }, 100);
  5104. }
  5105. // 回到系统管理
  5106. toMain() {
  5107. this.router.navigateByUrl("main");
  5108. }
  5109. // 查看工单
  5110. toOrder() {
  5111. this.router.navigateByUrl(`main/orderManagement`);
  5112. }
  5113. // 退出
  5114. logOut(): void {
  5115. let that = this;
  5116. // 假退出
  5117. let hospital = this.tool.getCurrentHospital();
  5118. if(hospital){
  5119. this.router.navigate(["login", hospital.id]);
  5120. }else{
  5121. this.router.navigateByUrl("login");
  5122. }
  5123. localStorage.removeItem("user");
  5124. localStorage.removeItem("menu");
  5125. localStorage.removeItem("index");
  5126. // 假退出
  5127. that.mainService.logOut().subscribe((data) => {
  5128. if (data.status == 200) {
  5129. if(hospital){
  5130. this.router.navigate(["login", hospital.id]);
  5131. }else{
  5132. this.router.navigateByUrl("login");
  5133. }
  5134. localStorage.removeItem("user");
  5135. localStorage.removeItem("menu");
  5136. localStorage.removeItem("index");
  5137. }
  5138. });
  5139. }
  5140. // 格式化时分秒
  5141. // (时间小于一分钟则显示秒,时间大于一分钟则显示分钟数,如超出一小时则显示小时和分钟。)time单位:秒
  5142. formatTime(time) {
  5143. let timeStr = "";
  5144. if (time >= 0 && time < 60) {
  5145. // 秒
  5146. timeStr = time + "秒";
  5147. } else if (time >= 60 && time < 3600) {
  5148. // 分钟
  5149. timeStr = Math.floor(time / 60) + "分钟";
  5150. } else if (time >= 3600) {
  5151. // 时 + 分
  5152. let h = "";
  5153. let m = "";
  5154. h = Math.floor(time / 3600) + "小时";
  5155. m = time % 3600 >= 60 ? Math.floor((time % 3600) / 60) + "分钟" : "";
  5156. timeStr = h + m;
  5157. }
  5158. return timeStr;
  5159. }
  5160. // 计算历史记录耗时
  5161. filterTime(step) {
  5162. let num = 0;
  5163. step.forEach((e) => {
  5164. num += e.difTime;
  5165. });
  5166. return this.formatTime(num / 1000);
  5167. }
  5168. // 截取意见内容(ie内核截取)
  5169. spliceContent(con) {
  5170. if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) {
  5171. return con.slice(0, 41) + "...";
  5172. } else {
  5173. return con;
  5174. }
  5175. }
  5176. @ViewChild("msgTemplate", { static: false }) msgTemplate: TemplateRef<any>; //消息通知模板
  5177. // 消息提醒
  5178. createBasicNotification(msgs): void {
  5179. this.notification.template(this.msgTemplate, {
  5180. nzDuration: 0,
  5181. nzData: msgs,
  5182. });
  5183. }
  5184. isShowNurseCode = false; //是否展开科室二维码
  5185. nurseCodeImg = ""; //图片
  5186. refreshQRCodeTime = 0; //刷新时间间隔
  5187. // 关闭科室二维码
  5188. closeNurseCode() {
  5189. this.isShowNurseCode = false;
  5190. clearInterval(this.timer);
  5191. this.timer = null;
  5192. }
  5193. // 展开科室二维码
  5194. timer = null;
  5195. showNurseCode() {
  5196. this.isShowNurseCode = true;
  5197. this.getConfig()
  5198. }
  5199. // 获取配置
  5200. iskeySwitch:any = false;
  5201. getConfig() {
  5202. let postData = {
  5203. idx: 0,
  5204. sum: 9999,
  5205. hospitalConfig:{
  5206. hosId:this.currentHospital.id,
  5207. model:"all"
  5208. }
  5209. };
  5210. this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe((result:any) => {
  5211. if (result.status == 200) {
  5212. for(let i of result.list){
  5213. if(i.key=='digitalSecretKey'){
  5214. if(i.value==1){
  5215. this.iskeySwitch = true
  5216. this.getSecretKey()
  5217. }else{
  5218. this.iskeySwitch = false
  5219. this.mainService.getDeptCode([this.loginUserDeptId]).subscribe((data) => {
  5220. if (data["status"] == 200) {
  5221. this.nurseCodeImg = data["data"][0].base64;
  5222. this.refreshQRCodeTime = data["data"][0].refreshQRCodeTime;
  5223. clearInterval(this.timer);
  5224. this.timer = setInterval(() => {
  5225. this.refreshQRCodeTime = Math.max(--this.refreshQRCodeTime, 0);
  5226. if (this.refreshQRCodeTime === 0) {
  5227. clearInterval(this.timer);
  5228. this.showNurseCode();
  5229. }
  5230. }, 1000);
  5231. }
  5232. });
  5233. }
  5234. }
  5235. }
  5236. }
  5237. });
  5238. }
  5239. // 获取动态密钥
  5240. numberKey:any;
  5241. getSecretKey(){
  5242. this.mainService.getSecretKey(this.currentDept.id).subscribe((res:any) => {
  5243. if (res["status"] == 200) {
  5244. this.numberKey = res.data.digitalSecretKey;
  5245. this.nurseCodeImg = res.data.base64;
  5246. this.refreshQRCodeTime = res.data.refreshQRCodeTime;
  5247. clearInterval(this.timer);
  5248. this.timer = setInterval(() => {
  5249. this.refreshQRCodeTime = Math.max(--this.refreshQRCodeTime, 0);
  5250. if (this.refreshQRCodeTime === 0) {
  5251. clearInterval(this.timer);
  5252. this.showNurseCode();
  5253. }
  5254. }, 1000);
  5255. }
  5256. });
  5257. }
  5258. // 右侧菜单
  5259. showLastItems: boolean = false;
  5260. // 下拉
  5261. fixedMenuXiala() {
  5262. this.showLastItems = true;
  5263. }
  5264. // 上拉
  5265. fixedMenuShangla() {
  5266. this.showLastItems = false;
  5267. }
  5268. mainRole: boolean = false; //回到系统管理权限
  5269. mainRoleBtnName = "回到系统管理"; //回到系统管理名字
  5270. initRole() {
  5271. let menus = JSON.parse(localStorage.getItem("menu"));
  5272. console.log("菜单数量" + menus.length);
  5273. if (menus.length >= 2) {
  5274. this.mainRole = true;
  5275. return;
  5276. }
  5277. }
  5278. // 切换右侧菜单Tab
  5279. fixedTab: string = "";
  5280. checkFixedTab(type: string) {
  5281. if (type == "toSystem") {
  5282. this.router.navigateByUrl("main");
  5283. }
  5284. if (this.fixedTab == type) {
  5285. this.fixedTab = "";
  5286. } else {
  5287. this.fixedTab = type;
  5288. }
  5289. }
  5290. //子传父接收
  5291. closeModelHs(e) {
  5292. this.hsPromptModalShow = JSON.parse(e).show;
  5293. this.changeShow = JSON.parse(e).changeShow;
  5294. }
  5295. //子传父接收
  5296. clearModelHs(e) {
  5297. if (JSON.parse(e).clear === true) {
  5298. clearInterval(this.timerCloseTime);
  5299. }
  5300. this.changeShow = JSON.parse(e).changeShow;
  5301. }
  5302. // 头部切换科室
  5303. changeKsNow() {
  5304. this.hsPromptModalShow = true;
  5305. clearInterval(this.timerCloseTime);
  5306. this.changeShow = false;
  5307. }
  5308. // 刷新工单列表
  5309. refreshList(e) {
  5310. if (!e.promptContent) {
  5311. return;
  5312. }
  5313. this.getOrderList();
  5314. }
  5315. // 打印二维码-门诊服务点
  5316. printCode(item){
  5317. console.log(item)
  5318. }
  5319. //打开修改密码弹窗
  5320. pwdAfterOpen(){
  5321. this.passwordVisible = false;
  5322. this.pwdIsOkLoading = false;
  5323. this.enoughRegFlag = true; //弱
  5324. this.mediumRegFlag = false; //中
  5325. this.strongRegFlag = false; //强
  5326. this.upModalData = {
  5327. userid: "",
  5328. pwdOld: "",
  5329. newPwd: "",
  5330. newPwd2: "",
  5331. };
  5332. }
  5333. // 修改密码
  5334. passwordVisible = false;
  5335. password?: string;
  5336. isPwdVisible = false;
  5337. pwdIsOkLoading = false;
  5338. upModalData = {
  5339. userid: "",
  5340. pwdOld: "",
  5341. newPwd: "",
  5342. newPwd2: "",
  5343. };
  5344. upPwd(): void {
  5345. if(this.upModalData.pwdOld.trim() === ''){
  5346. this.message.error('请填写原始密码!', {
  5347. nzDuration: 5000,
  5348. });
  5349. return;
  5350. }
  5351. if(!this.strongRegFlag){
  5352. this.message.error('新密码不符合要求!', {
  5353. nzDuration: 5000,
  5354. });
  5355. return;
  5356. }
  5357. if(this.upModalData.newPwd !== this.upModalData.newPwd2){
  5358. this.message.error('新密码与确认新密码不一致!', {
  5359. nzDuration: 5000,
  5360. });
  5361. return;
  5362. }
  5363. this.pwdIsOkLoading = true;
  5364. let userid = JSON.parse(localStorage.getItem("user")).user.id;
  5365. this.upModalData.userid = userid;
  5366. this.mainService.upPwd(this.upModalData).subscribe((data) => {
  5367. if (data.status == 200) {
  5368. this.isPwdVisible = false;
  5369. this.pwdIsOkLoading = false;
  5370. this.message.success("修改成功!", {
  5371. nzDuration: 5000,
  5372. });
  5373. } else {
  5374. this.pwdIsOkLoading = false;
  5375. this.message.error(data.error, {
  5376. nzDuration: 5000,
  5377. });
  5378. }
  5379. });
  5380. }
  5381. showUpPwd(): void {
  5382. this.isPwdVisible = true;
  5383. }
  5384. pwdHandleOk(): void {
  5385. this.upPwd();
  5386. }
  5387. pwdHandleCancel(): void {
  5388. this.isPwdVisible = false;
  5389. }
  5390. // 新密码失去焦点
  5391. enoughRegFlag = true; //弱
  5392. mediumRegFlag = false; //中
  5393. strongRegFlag = false; //强
  5394. blurNewPwd(){
  5395. let enoughReg = /^.{0,6}$/;//密码强度-弱
  5396. let strongReg = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\!\@\#\$\%\^\&\*]).{9,}$/;//密码强度-强
  5397. this.enoughRegFlag = enoughReg.test(this.upModalData.newPwd);
  5398. this.strongRegFlag = strongReg.test(this.upModalData.newPwd);
  5399. this.mediumRegFlag = !this.enoughRegFlag && !this.strongRegFlag;
  5400. console.log(this.enoughRegFlag,this.mediumRegFlag,this.strongRegFlag);
  5401. }
  5402. // 快捷方式建单
  5403. isShowBuildQuickConfirm:boolean = false;
  5404. buildQuickConfirmData:any = {};
  5405. buildQuick(data){
  5406. if(data.bussType.value === 'service'){
  5407. // 运维报修
  5408. this.showBxModal();
  5409. }else if(data.icon.value === 'specimenPackage'){
  5410. // 标本打包
  5411. this.router.navigateByUrl("/batchSpecimen");
  5412. }else if(data.bussType.value === 'goods'){
  5413. // 物品配送
  5414. this.buildQuickConfirmData = data || {};
  5415. this.isShowBuildQuickConfirm = true;
  5416. }else if(data.bussType.value === 'inspect'){
  5417. // 陪检
  5418. if(this.inspectAndPatientTransportConfig.batchInspectType == 1){
  5419. // 预约陪检
  5420. this.router.navigateByUrl("/batchInspection");
  5421. }else if(this.inspectAndPatientTransportConfig.batchInspectType == 2){
  5422. // 陪检信息配置
  5423. this.router.navigateByUrl("/inspectInfoConfig");
  5424. }
  5425. }
  5426. }
  5427. cancelBuildQuickConfirm(e){
  5428. this.isShowBuildQuickConfirm = false;
  5429. }
  5430. loadingQuick:boolean = false;
  5431. confirmBuildQuickConfirm(options){
  5432. let { taskType, shortcutForm, buildMsg, workOrderRemark, userAccount } = options;
  5433. if(taskType.associationType.value === 'other' || taskType.associationType.value === 'ordinary'){
  5434. // 其他临床服务|万能交接
  5435. this.loadingQuick = this.loading5;
  5436. this.buildType = taskType.associationType.value;
  5437. this.shortcutMsg = taskType;
  5438. this.buildMsg = buildMsg;
  5439. this.workOrderRemark = workOrderRemark;
  5440. this.userAccount = userAccount;
  5441. this.confirmShortcut(shortcutForm, taskType.associationType.value);
  5442. }else if(taskType.associationType.value === 'specimen'){
  5443. // 标本配送
  5444. this.loadingQuick = this.btnLoading;
  5445. this.buildType = "bb";
  5446. this.shortcutMsg1 = taskType;
  5447. this.workOrderRemark1 = workOrderRemark;
  5448. this.confirmShortcut1(shortcutForm);
  5449. }
  5450. }
  5451. // 详细地址获取焦点
  5452. isShowAddressList:boolean = false;
  5453. focusAddress(){
  5454. this.isShowAddressList = true;
  5455. this.getAddressList();
  5456. }
  5457. // 点击其他位置
  5458. clickExtra(e){
  5459. if(document.documentElement.contains(document.querySelector('.addressList')) && e.target !== document.querySelector('.addressFocus')){
  5460. this.isShowAddressList = false;
  5461. }
  5462. if(document.documentElement.contains(document.querySelector('.noteList')) && e.target !== document.querySelector('.noteFocus')){
  5463. this.isShowNoteList = false;
  5464. }
  5465. }
  5466. // 选择地址
  5467. selectAddress(name){
  5468. this.validateBxForm.controls.officeAddress.setValue(name)
  5469. this.isShowAddressList = false;
  5470. }
  5471. // 获取科室地点列表
  5472. addressList:any[] = [];
  5473. addressLoading:boolean = false;
  5474. getAddressList() {
  5475. let postData = {
  5476. idx: 0,
  5477. sum: 99999,
  5478. qrCode: {
  5479. deptId: this.loginUserDeptId,
  5480. }
  5481. };
  5482. this.addressLoading = true;
  5483. this.mainService.getFetchDataList("simple/data", "qrCode", postData).subscribe(result=>{
  5484. this.addressLoading = false;
  5485. if(result.status == 200){
  5486. this.addressList = result.list || [];
  5487. }else{
  5488. this.addressList = [];
  5489. }
  5490. });
  5491. }
  5492. // 注意事项获取焦点
  5493. isShowNoteList:boolean = false;
  5494. focusNote(){
  5495. this.isShowNoteList = true;
  5496. this.getNoteList();
  5497. }
  5498. // 选择注意事项
  5499. selectNote(name){
  5500. this.workOrderRemark2 = name;
  5501. this.isShowNoteList = false;
  5502. }
  5503. // 获取注意事项列表
  5504. noteList:any[] = [];
  5505. noteLoading:boolean = false;
  5506. getNoteList() {
  5507. this.noteLoading = true;
  5508. this.mainService.getDictionary('list', 'inspect_notes',).subscribe(result=>{
  5509. this.noteLoading = false;
  5510. this.noteList = result || [];
  5511. });
  5512. }
  5513. // 关联的检查-上一日,下一日,今天
  5514. inspectToday:Date = new Date();
  5515. // 上一日
  5516. previousDayNew(){
  5517. this.inspectToday = addDays(this.inspectToday, -1);
  5518. this.inspectSubject.next();
  5519. }
  5520. // 今天
  5521. todayNew(){
  5522. this.inspectToday = new Date();
  5523. this.inspectSubject.next();
  5524. }
  5525. // 下一日
  5526. nextDayNew(){
  5527. this.inspectToday = addDays(this.inspectToday, 1);
  5528. this.inspectSubject.next();
  5529. }
  5530. refreshInspectList(){
  5531. let postData = {
  5532. taskTypeId: this.patientForm.controls.checkedType.value,
  5533. patientCode: this.patientMsg.patientCode,
  5534. startTime: format(startOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss'),
  5535. endTime: format(endOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss'),
  5536. };
  5537. this.linkCheckLis = [];
  5538. this.mainService
  5539. .postCustom("nurse", "workOrder/buildTrip", postData)
  5540. .subscribe((data) => {
  5541. // 工单备注配置 end
  5542. if (data.status == 200 && data.data && data.data.length) {
  5543. let arr = [];
  5544. data.data.forEach((e) => {
  5545. if(e.yyTime){
  5546. e.newTime = format(new Date(e.yyTime), 'MM-dd HH:mm')
  5547. if(e.endCheckTime){
  5548. e.newTime2 = format(new Date(e.endCheckTime), 'HH:mm')
  5549. e.yyEndTime = e.newTime + '--' + e.newTime2
  5550. }else{
  5551. e.yyEndTime = e.newTime
  5552. }
  5553. }else{
  5554. e.yyEndTime = null
  5555. }
  5556. arr.push({
  5557. execDeptId: e.execDept.id,
  5558. yyTime: e.yyTime,
  5559. priority: e.priority,
  5560. manualCreate: e.manualCreate,
  5561. label:
  5562. (e.yyEndTime|| "") +
  5563. " " +
  5564. (this.deptDisplay == 2
  5565. ? e.execDept.deptalias
  5566. : e.execDept.dept) +
  5567. " 进行 " +
  5568. (e.inspectName?e.inspectName:'' + '-' + e.inspectCode || "检查"),
  5569. value: e["id"],
  5570. checked: false,
  5571. remark: e.remark,
  5572. });
  5573. });
  5574. this.linkCheckLis = arr;
  5575. }
  5576. });
  5577. }
  5578. // 查看标本打包
  5579. specimenPackageStateValue;
  5580. isShowSpecimenPackageList = false; //业务数据弹窗开关
  5581. viewSpecimenPackageList(stateValue) {
  5582. this.specimenPackageStateValue = stateValue;
  5583. this.isShowSpecimenPackageList = true;
  5584. }
  5585. // 关闭标本打包弹窗
  5586. closeSpecimenPackageList(e) {
  5587. this.isShowSpecimenPackageList = JSON.parse(e).show;
  5588. }
  5589. // 追加检查
  5590. isShowAddInspect = false; //弹窗开关
  5591. addInspect(){
  5592. this.isShowAddInspect = true;
  5593. }
  5594. // 关闭弹窗
  5595. closeAddInspectModel(e) {
  5596. this.isShowAddInspect = JSON.parse(e).show;
  5597. }
  5598. // 确定弹窗
  5599. confirmAddInspectModel(e) {
  5600. console.log(e);
  5601. let obj = JSON.parse(e);
  5602. this.isShowAddInspect = obj.show;
  5603. let user = JSON.parse(localStorage.getItem("user"));
  5604. if(obj.type == 2){
  5605. // 手动添加
  5606. let postData:any = {
  5607. inspectList: obj.list.map(v => ({
  5608. patientCode: this.patientMsg.patientCode,
  5609. patientName: this.patientMsg.patientName,
  5610. barCode: this.patientMsg.barCode,
  5611. inspectCheckType: { id: v.id },
  5612. applyDeptId: user.user.dept.id,
  5613. bedNum: this.patientMsg.bedNum,
  5614. hosId: this.patientMsg.hosId,
  5615. })) || undefined,
  5616. };
  5617. this.maskFlag = this.message.loading("正在加载中..", {
  5618. nzDuration: 0,
  5619. }).messageId;
  5620. this.mainService
  5621. .simplePost("addData", "inspect", postData)
  5622. .subscribe((data:any) => {
  5623. this.message.remove(this.maskFlag);
  5624. this.maskFlag = false;
  5625. if (data.status == 200) {
  5626. this.message.success('追加检查成功!')
  5627. this.refreshInspectList();
  5628. } else {
  5629. this.message.error(data.msg || '追加检查失败!')
  5630. }
  5631. });
  5632. }else{
  5633. let postData:any = {
  5634. inspectList: [{
  5635. patientCode: this.patientMsg.patientCode,
  5636. patientName: this.patientMsg.patientName,
  5637. barCode: this.patientMsg.barCode,
  5638. inspectCheckType: { id: obj.inspectData.id },
  5639. applyDeptId: user.user.dept.id,
  5640. execDeptId: obj.inspectData.execDeptId,
  5641. bedNum: this.patientMsg.bedNum,
  5642. hosId: this.patientMsg.hosId,
  5643. yyTime: format(new Date(obj.inspectData.date), 'yyyy-MM-dd ') + format(startOfMinute(new Date(obj.inspectData.time)), 'HH:mm:ss'),
  5644. endCheckTime: obj.inspectData.endCheckTime
  5645. }] || undefined,
  5646. };
  5647. this.maskFlag = this.message.loading("正在加载中..", {
  5648. nzDuration: 0,
  5649. }).messageId;
  5650. this.mainService
  5651. .simplePost("addData", "inspect", postData)
  5652. .subscribe((data:any) => {
  5653. this.message.remove(this.maskFlag);
  5654. this.maskFlag = false;
  5655. if (data.status == 200) {
  5656. this.message.success('追加检查成功!')
  5657. this.refreshInspectList();
  5658. } else {
  5659. this.message.error(data.msg || '追加检查失败!')
  5660. }
  5661. });
  5662. }
  5663. }
  5664. }