hushijiandan.component.ts 125 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968
  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 } 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 } from "rxjs/operators";
  24. import {
  25. format,
  26. getMinutes,
  27. setMinutes,
  28. addDays,
  29. differenceInCalendarDays,
  30. getHours,
  31. startOfDay,
  32. endOfDay,
  33. } from "date-fns";
  34. import { SourceId } from "src/app/type/types";
  35. // 日期禁用
  36. function range(start: number, end: number): number[] {
  37. const result: number[] = [];
  38. for (let i = start; i < end; i++) {
  39. result.push(i);
  40. }
  41. return result;
  42. }
  43. @Component({
  44. selector: "app-hushijiandan",
  45. templateUrl: "./hushijiandan.component.html",
  46. styleUrls: ["./hushijiandan.component.less"],
  47. })
  48. export class HushijiandanComponent implements OnInit {
  49. @ViewChild("remarksEle", { static: false }) remarksEle: ElementRef;
  50. @ViewChild("remarksEle1", { static: false }) remarksEle1: ElementRef;
  51. @ViewChild("remarksEle2", { static: false }) remarksEle2: ElementRef;
  52. @ViewChild("osComponentRef1", {
  53. read: OverlayScrollbarsComponent,
  54. static: false,
  55. })
  56. osComponentRef1: OverlayScrollbarsComponent;
  57. @ViewChild("osComponentRef2", {
  58. read: OverlayScrollbarsComponent,
  59. static: false,
  60. })
  61. osComponentRef2: OverlayScrollbarsComponent;
  62. @ViewChild("osComponentRef3", {
  63. read: OverlayScrollbarsComponent,
  64. static: false,
  65. })
  66. osComponentRef3: OverlayScrollbarsComponent;
  67. @ViewChild("osComponentRef4", {
  68. read: OverlayScrollbarsComponent,
  69. static: false,
  70. })
  71. osComponentRef4: OverlayScrollbarsComponent;
  72. @ViewChild("osComponentRef6", {
  73. read: OverlayScrollbarsComponent,
  74. static: false,
  75. })
  76. osComponentRef6: OverlayScrollbarsComponent;
  77. @ViewChild("osComponentRef7", {
  78. read: OverlayScrollbarsComponent,
  79. static: false,
  80. })
  81. osComponentRef7: OverlayScrollbarsComponent;
  82. @ViewChild("osComponentRef8", {
  83. read: OverlayScrollbarsComponent,
  84. static: false,
  85. })
  86. osComponentRef8: OverlayScrollbarsComponent;
  87. @ViewChild("osComponentRef9", {
  88. read: OverlayScrollbarsComponent,
  89. static: false,
  90. })
  91. osComponentRef9: OverlayScrollbarsComponent;
  92. @ViewChild("osComponentRef10", {
  93. read: OverlayScrollbarsComponent,
  94. static: false,
  95. })
  96. osComponentRef10: OverlayScrollbarsComponent;
  97. othersListOptions: any;
  98. sortableTimer = null;
  99. searchAccountSubject = new Subject(); //查工号防抖
  100. searchTabInpSubject = new Subject(); //左侧查患者信息和检查信息防抖
  101. otherSearchChangeSubject = new Subject(); //其他建单搜索防抖
  102. incidentSearchChangeSubject = new Subject(); //故障现象搜索防抖
  103. isYyInspect = false; //需要预约检查
  104. inspectAndPatientTransportConfig:any = {timeMod: 30};
  105. constructor(
  106. private message: NzMessageService,
  107. private fb: FormBuilder,
  108. public router: Router,
  109. private route: ActivatedRoute,
  110. private mainService: MainService,
  111. private notification: NzNotificationService,
  112. private webs: WebsocketNurseService,
  113. public tool: ToolService
  114. ) {
  115. this.othersListOptions = {
  116. onUpdate: (event: any) => {
  117. // 触发一次排序
  118. clearTimeout(this.sortableTimer);
  119. this.sortableTimer = setTimeout(() => {
  120. let postData = {
  121. orders: [],
  122. };
  123. postData.orders = this.othersList.map((item, i) => {
  124. return {
  125. id: item.id,
  126. orders: i,
  127. };
  128. });
  129. this.mainService
  130. .coopConfig("setOrders", postData)
  131. .subscribe((result) => {});
  132. }, 500);
  133. },
  134. };
  135. }
  136. // 关闭倒计时
  137. closeTime = 3;
  138. closeTimeFlag;
  139. timerCloseTime = null;
  140. changeShow = true;
  141. currentHospital; //当前院区
  142. currentDept; //当前科室
  143. logTimer = null; //综合日志定时器
  144. logTime = 0; //综合日志自动刷新秒数
  145. logTimeConst = 60; //综合日志自动刷新秒数
  146. orderListTimer = null; //工单列表定时器
  147. orderListTime = 0; //工单列表自动刷新秒数
  148. orderListTimeConst = 60; //工单列表自动刷新秒数
  149. deptDisplay; //护士端是否显示可以别名,1是显示科室名称,2是显示科室别名
  150. // 初始化权限按钮
  151. coopBtns: any = {};
  152. ngOnInit() {
  153. this.getCoopBtns();
  154. this.currentHospital = this.tool.getCurrentHospital();
  155. this.tool.getDeptDisplay().subscribe((result) => {
  156. if (result.status == 200) {
  157. this.deptDisplay = result.list[0].valueconfig;
  158. }
  159. });
  160. this.getItsmIncident();
  161. this.getInspectAndPatientTransportConfigTasktype();
  162. this.getUpdateTipsForNurses();
  163. this.getCloseTimeFlag();
  164. this.currentDept = this.tool.getCurrentUserDept();
  165. console.log(this.currentDept, this.tabSearchCont);
  166. this.currentDept.typeValue == 'surgery' && this.getSurgeryConfig();
  167. this.getSpecimenButton();
  168. //防抖
  169. this.getAccountList();
  170. this.searchAccountSubject.pipe(debounceTime(500)).subscribe((v:any) => {
  171. this.getAccountList(v);
  172. });
  173. this.searchTabInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  174. this.getPatient(v);
  175. });
  176. this.otherSearchChangeSubject.pipe(debounceTime(500)).subscribe((v) => {
  177. this.getDeptTaskType(v);
  178. });
  179. this.incidentSearchChangeSubject
  180. .pipe(debounceTime(500))
  181. .subscribe((v: string) => {
  182. this.getIncidentcategory(v);
  183. });
  184. this.getTodayNum();
  185. this.initLogin();
  186. this.getDeptTaskType();
  187. this.initForm();
  188. this.getAdvice();
  189. this.getOrderSelectList();
  190. this.getCheckStatusLis();
  191. this.refreshSpecimenWorkOrderMsg();
  192. this.initRole();
  193. this.getWebsocket();
  194. // 综合日志倒计时 start
  195. this.logTime = this.logTimeConst;
  196. clearInterval(this.logTimer);
  197. this.logTimer = setInterval(() => {
  198. this.logTime--;
  199. if (this.logTime === 0) {
  200. this.logTime = this.logTimeConst;
  201. if (this.smallTabId == 1) {
  202. this.listDeptOrderRecord();
  203. } else if (this.smallTabId == 2) {
  204. this.getQuickBxlb();
  205. }
  206. this.getTodayNum(); //当日工单数量
  207. }
  208. }, 1000);
  209. // 综合日志倒计时 end
  210. // 工单列表倒计时 start
  211. this.orderListTime = this.orderListTimeConst;
  212. clearInterval(this.orderListTimer);
  213. this.orderListTimer = setInterval(() => {
  214. this.orderListTime--;
  215. if (this.orderListTime === 0) {
  216. this.orderListTime = this.orderListTimeConst;
  217. this.getOrderList();
  218. }
  219. }, 1000);
  220. // 工单列表倒计时 end
  221. }
  222. ngOnDestroy() {
  223. clearInterval(this.moveId);
  224. clearInterval(this.moveId1);
  225. clearInterval(this.msgTimerId);
  226. clearInterval(this.logTimer);
  227. clearInterval(this.orderListTimer);
  228. this.webs.closeWs(true);
  229. }
  230. loginUser: any = localStorage.getItem("user")
  231. ? JSON.parse(localStorage.getItem("user")).user
  232. : null; //登录人信息
  233. loginUserDeptId: number = JSON.parse(localStorage.getItem("user")).user.dept
  234. .id; //登录人所属科室
  235. appointmentBuildFlag = "0"; //是否开启护士端预约建单-患者陪检
  236. appointmentZyBuildFlag = "0"; //是否开启护士端预约建单-患者其他
  237. leadTime = 0; //护士端预约建单生效时长
  238. followFlag = "0"; //是否开启护士端终点关注
  239. promptContent: string; //操作提示框提示信息
  240. ifSuccess: boolean; //操作成功/失败
  241. promptInfo: string; //操作结果提示信息
  242. back: string; //操作结果后回调标识
  243. promptModalShow: boolean; //操作提示框是否展示
  244. hsPromptModalShow: boolean = false; //护士端科室切换提示框是否展示
  245. deptTaskTypeRules: any = {}; //当前登录科室任务类型信息规则
  246. orderSelectList: any = []; //工单列表筛选选项
  247. orderSelected = "-1"; //工单列表下拉框选中
  248. orderStateSelected = "1"; //工单列表工单状态下拉框选中
  249. tabSearchCont: string = ""; //左侧tab搜索框内容
  250. pLoading: boolean = true; //患者信息loading
  251. patientList: any = []; //左侧tab患者信息list
  252. infoPageIdx: number = 1; //左侧tab页码
  253. infoLength: number = 5; //左侧tab信息总数
  254. specimenWorkOrderMsg: any = {}; //急标普标数量&信息
  255. jpDrugsWKOMsg: any = {}; //药品静配提示信息
  256. surgeryWKOMsg: any = {}; //手术提示信息
  257. getCoopBtns(){
  258. let menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
  259. let coopBtns:any = {};
  260. let nurseMenu = menu.find(v => v.link === 'nurse');
  261. let nurseMenuChildren = nurseMenu.childrens || [];
  262. nurseMenuChildren.forEach((e) => {
  263. switch (e.link) {
  264. case "suggestionBox":
  265. coopBtns.suggestionBox = true; //意见箱
  266. break;
  267. case "inquiryOfHistoricalSpecimens":
  268. coopBtns.inquiryOfHistoricalSpecimens = true; //历史标本查询
  269. break;
  270. case "historicalMedicineListInquiry":
  271. coopBtns.historicalMedicineListInquiry = true; //历史药单查询
  272. break;
  273. case "quickReportForRepair":
  274. coopBtns.quickReportForRepair = true; //快捷报修
  275. break;
  276. case "repairList":
  277. coopBtns.repairList = true; //报修列表
  278. break;
  279. case "buildOrdersForOtherTasks":
  280. coopBtns.buildOrdersForOtherTasks = true; //其他任务建单
  281. break;
  282. }
  283. });
  284. this.coopBtns = coopBtns;
  285. console.log(this.coopBtns);
  286. }
  287. // 切换综合日志和一键报修
  288. smallTabs = [];
  289. smallTabId = 2; //默认显示一键报修
  290. changeSmallTab(id) {
  291. this.smallTabId = id;
  292. if (id == 1) {
  293. this.listDeptOrderRecord();
  294. } else if (id == 2) {
  295. this.getQuickBxlb();
  296. }
  297. }
  298. // 获取当日建单总数
  299. todayNum = ""; //当日建单总数
  300. getTodayNum() {
  301. this.mainService
  302. .getFetchDataList("nurse", "workOrder", {
  303. idx: 0,
  304. sum: 1,
  305. workOrder: {
  306. createDept: this.loginUser.dept.id,
  307. startTime1: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  308. endTime1: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  309. },
  310. })
  311. .subscribe((data) => {
  312. if (data.status == 200) {
  313. this.todayNum = data.totalNum || 0;
  314. }
  315. });
  316. }
  317. // 获取报修区域(所属院区)
  318. // areas: any = []; //区域(所属院区)列表
  319. // getArea() {
  320. // this.areas = [];
  321. // this.mainService
  322. // .fetchListBx("area", { idx: 0, sum: 1000 })
  323. // .subscribe((result: any) => {
  324. // if (result.status == 200) {
  325. // this.areas = result.list;
  326. // if (this.areas.length) {
  327. // this.bxForm.controls.hospital.setValue(this.areas[0].id);
  328. // } else {
  329. // this.bxForm.controls.hospital.setValue(null);
  330. // }
  331. // }
  332. // });
  333. // }
  334. //根据区域(所属院区)获取地点(楼栋)
  335. places: any = []; //地点(楼栋)列表
  336. getPlace(buildingId) {
  337. this.places = [];
  338. this.mainService
  339. .fetchListBx("place", {
  340. idx: 0,
  341. sum: 1000,
  342. place: { area: { id: buildingId } },
  343. })
  344. .subscribe((result: any) => {
  345. if (result.status == 200) {
  346. this.places = result.list;
  347. if (this.places.length) {
  348. this.bxForm.controls.building.setValue(this.places[0].id);
  349. } else {
  350. this.bxForm.controls.building.setValue(null);
  351. }
  352. }
  353. });
  354. }
  355. btnLoading: boolean = false; //确认按钮loading状态
  356. workOrderRemark = ""; //备注
  357. workOrderRemark1 = ""; //备注
  358. workOrderRemark2 = ""; //备注
  359. workOrderRemarkTips = ""; //备注提示
  360. workOrderRemarkTips1 = ""; //备注提示
  361. workOrderRemarkTips2 = ""; //备注提示
  362. customRemarks = []; //备注快速输入
  363. customRemarks1 = []; //备注快速输入
  364. customRemarks2 = []; //备注快速输入
  365. // 添加备注
  366. addRemarks(item) {
  367. this.remarksEle.nativeElement.focus();
  368. this.workOrderRemark += item;
  369. }
  370. // 添加备注
  371. addRemarks1(item) {
  372. this.remarksEle1.nativeElement.focus();
  373. this.workOrderRemark1 += item;
  374. }
  375. // 添加备注
  376. addRemarks2(item) {
  377. this.remarksEle2.nativeElement.focus();
  378. this.workOrderRemark2 += item;
  379. }
  380. // 立即执行
  381. coopItem: any = {};
  382. execModal: boolean = false;
  383. // 打开立即执行模态框
  384. openExecModal(item) {
  385. this.coopItem = item;
  386. this.execModal = true;
  387. }
  388. // 确认立即执行
  389. confirmExec() {
  390. this.btnLoading = true;
  391. // let postData: any = {
  392. // workOderId: this.coopItem.id,
  393. // workOrder: {
  394. // sourceId: this.coopItem.sourceId,
  395. // taskType: {
  396. // id: this.coopItem.taskType.id,
  397. // },
  398. // startDept: {
  399. // id: this.coopItem.startDept.id,
  400. // },
  401. // endDepts: this.coopItem.endDepts.map((v) => ({ id: v.id })),
  402. // createDept: this.coopItem.createDept,
  403. // patient: {
  404. // patientCode: this.coopItem.patient.patientCode,
  405. // },
  406. // goods: this.coopItem.goods,
  407. // platform: 2,
  408. // isAccompany: this.coopItem.isAccompany,
  409. // },
  410. // };
  411. // if (this.coopItem.isRemand !== undefined) {
  412. // postData.workOrder.isRemand = this.coopItem.isRemand;
  413. // }
  414. // if (this.coopItem.taskType.associationType.value == 'inspect') {
  415. // postData.workOrder.taskType.isHalfInspect = this.coopItem.taskType.isHalfInspect;
  416. // }
  417. // checkList:[
  418. // {
  419. // "id": 1165517
  420. // }
  421. // ]
  422. this.mainService.executeNow(this.coopItem.id).subscribe((result: any) => {
  423. this.closeExecModal();
  424. if (result.status == 200) {
  425. this.showPromptModal("立即执行", true, "");
  426. this.getOrderList();
  427. } else {
  428. this.showPromptModal("立即执行", false, result.msg);
  429. }
  430. });
  431. }
  432. // 关闭立即执行模态框
  433. closeExecModal() {
  434. this.execModal = false;
  435. }
  436. // 获取系统配置,护士端是否显示报修
  437. isShowBx = false;
  438. getItsmIncident() {
  439. let postData = { idx: 0, sum: 100, hospitalConfig: { hosId: this.currentHospital.id } };
  440. this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe((result) => {
  441. if (result.status == 200) {
  442. this.isShowBx = result.list.find(v => v.key == 'hos_itsmIncident').value == 1;
  443. if (this.isShowBx && (this.coopBtns.repairList || this.coopBtns.quickReportForRepair)) {
  444. this.smallTabs = [
  445. { id: 1, name: "综合日志" },
  446. { id: 2, name: "一键报修" },
  447. ];
  448. this.smallTabId = 2;
  449. this.getQuickBxlb();
  450. this.getBxlb();
  451. } else {
  452. this.smallTabs = [{ id: 1, name: "综合日志" }];
  453. this.smallTabId = 1;
  454. this.listDeptOrderRecord();
  455. }
  456. }
  457. });
  458. }
  459. //获取检查页面任务类型
  460. getInspectAndPatientTransportConfigTasktype() {
  461. let postData = {
  462. idx: 0,
  463. sum: 10,
  464. taskType: {
  465. simpleQuery: true,
  466. hosId: {
  467. id: this.currentHospital.id
  468. },
  469. associationType: {
  470. key:"association_types",
  471. value: 'inspect'
  472. }
  473. }
  474. };
  475. this.mainService
  476. .getFetchDataList("simple/data", "taskType", postData)
  477. .subscribe((result) => {
  478. if (result.status == 200) {
  479. let tasktype:any = result.list[0] || {};
  480. this.getInspectAndPatientTransportConfig(tasktype);
  481. }
  482. });
  483. }
  484. // 获取检查页面信息配置
  485. getInspectAndPatientTransportConfig(tasktype) {
  486. let postData = {
  487. idx: 0,
  488. sum: 10,
  489. taskTypeConfig: {
  490. taskTypeDTO: {
  491. hosId: {
  492. id: this.currentHospital.id
  493. },
  494. associationType: tasktype.associationType
  495. }
  496. }
  497. };
  498. this.mainService
  499. .getFetchDataList("simple/data", "taskTypeConfig", postData)
  500. .subscribe((result) => {
  501. if (result.status == 200) {
  502. let inspectAndPatientTransportConfig = result.list[0] || {};
  503. this.inspectAndPatientTransportConfig = {...this.inspectAndPatientTransportConfig, ...inspectAndPatientTransportConfig};
  504. // 是否显示排队信息
  505. if(this.inspectAndPatientTransportConfig.queuingInformation == 1){
  506. this.getQueuingInformation();
  507. }
  508. }
  509. });
  510. }
  511. // 获取排队信息
  512. queuingInformationList:any[] = [];
  513. getQueuingInformation() {
  514. this.mainService
  515. .coopWorkerOrder("queuingInformation", {})
  516. .subscribe((result) => {
  517. if(result.status == 200){
  518. this.queuingInformationList = result.datalist || [];
  519. }
  520. });
  521. }
  522. // 获取护士端更新提示
  523. updateTipsForNurses = "";
  524. getUpdateTipsForNurses() {
  525. let postData = {
  526. idx: 0,
  527. sum: 1,
  528. systemConfiguration: { keyconfig: "updateTipsForNurses" },
  529. };
  530. this.mainService
  531. .getFetchDataList("simple/data", "systemConfiguration", postData)
  532. .subscribe((result) => {
  533. if (result.status == 200) {
  534. this.updateTipsForNurses = result.list[0].valueconfig;
  535. }
  536. });
  537. }
  538. // 获取标本按钮
  539. specimenButton = "";
  540. getSpecimenButton() {
  541. if(this.currentDept.typeValue == 'surgery'){
  542. return;
  543. }
  544. let postData = {
  545. idx: 0,
  546. sum: 1,
  547. systemConfiguration: { keyconfig: "specimenButton" },
  548. };
  549. this.mainService
  550. .getFetchDataList("simple/data", "systemConfiguration", postData)
  551. .subscribe((result) => {
  552. if (result.status == 200) {
  553. this.specimenButton = result.list[0].valueconfig;
  554. }
  555. });
  556. }
  557. // 获取护士端弹窗的配置
  558. // (1) 当用户设置为正数时,用户必须查看此窗体指定秒数。
  559. // (2) 当用户设置为负数时,用户可点击知道了也可倒计时自动关闭。
  560. // (3) 如果用户填写0则为无自动关闭和强制查看时间。
  561. getCloseTimeFlag() {
  562. let postData = {
  563. idx: 0,
  564. sum: 1,
  565. systemConfiguration: { keyconfig: "nurseDeptSwitchTip" },
  566. };
  567. this.mainService
  568. .getFetchDataList("simple/data", "systemConfiguration", postData)
  569. .subscribe((result) => {
  570. if (result.status == 200) {
  571. this.closeTimeFlag = result.list[0].valueconfig - 0;
  572. this.changeKs();
  573. }
  574. });
  575. }
  576. //获取综合日志
  577. rLoading = false;
  578. listDeptOrderRecords: any = [];
  579. listDeptOrderRecord() {
  580. this.rLoading = true;
  581. this.mainService
  582. .listMsgByMain("listDeptOrderRecord", { deptId: this.loginUserDeptId })
  583. .subscribe((result) => {
  584. this.rLoading = false;
  585. if (result["status"] == 200) {
  586. this.listDeptOrderRecords = result["data"].slice(0, 15);
  587. }
  588. });
  589. }
  590. // 查看标本历史记录
  591. historyPromptModalShow = false; //标本历史记录弹窗开关
  592. scode = ""; //查看历史记录携带
  593. viewSpecimenHistory(data) {
  594. this.scode = data.scode;
  595. this.historyPromptModalShow = true;
  596. }
  597. // 关闭标本历史记录弹窗
  598. closeModelHistory(e) {
  599. this.historyPromptModalShow = JSON.parse(e).show;
  600. }
  601. // 查看药单历史记录
  602. historyDPromptModalShow = false; //药单历史记录弹窗开关
  603. drugsBagId = ""; //查看历史记录携带
  604. viewDrugsbagHistory(data) {
  605. this.drugsBagId = data.id;
  606. this.historyDPromptModalShow = true;
  607. }
  608. // 关闭药单历史记录弹窗
  609. closeModelHistoryDrugsbag(e) {
  610. this.historyDPromptModalShow = JSON.parse(e).show;
  611. }
  612. // 查看报修信息
  613. detailBx(data){
  614. this.router.navigateByUrl("nurse/detailBx/" + data.id);
  615. }
  616. // 查看报修信息弹窗
  617. bxPromptModalShow = false; //弹窗开关
  618. bData = ""; //查看详情携带所有数据
  619. viewBx(data) {
  620. this.bData = data;
  621. this.bxPromptModalShow = true;
  622. }
  623. // 关闭报修信息弹窗
  624. closeModelBx(e) {
  625. this.bxPromptModalShow = JSON.parse(e).show;
  626. }
  627. // 护士端患者信息列表,鼠标移入姓名展示最近一条检查信息
  628. recentInfo = "";
  629. recentInfoTimer = null;
  630. recentInfoNum = 0;
  631. isRemand = true; //自动送回
  632. yyTime = null; //预约时间-患者列表
  633. yyTimeZy = null; //预约时间-患者列表-患者其他服务
  634. yyDate = null; //预约日期-陪检
  635. yyDateZy = null; //预约日期-转运
  636. getRecentInfo(patientCode) {
  637. if(this.currentDept.typeValue == 'surgery'){
  638. return;
  639. }
  640. this.recentInfo = "";
  641. clearTimeout(this.recentInfoTimer);
  642. this.recentInfoTimer = setTimeout(() => {
  643. this.recentInfoNum++;
  644. this.mainService
  645. .listMsgByMain("workOrder/findInspectRecently", { patientCode })
  646. .subscribe((result) => {
  647. this.recentInfoNum--;
  648. if (result["status"] == 200 && this.recentInfoNum === 0) {
  649. this.recentInfo = result["data"]["info"];
  650. } else {
  651. this.recentInfo = "";
  652. }
  653. });
  654. }, 500);
  655. }
  656. // 获取患者陪检任务类型(只有一个)的信息
  657. getTaskTypeByInspection() {
  658. const list = {
  659. idx: 0,
  660. sum: 1,
  661. taskType: {
  662. patientInspectQuery: true,
  663. hosIds: this.currentHospital.id + "",
  664. associationType: {
  665. id: 260,
  666. },
  667. },
  668. };
  669. return this.mainService.getFetchDataList("configuration", "taskType", list);
  670. }
  671. //修改预约建单时间的日期
  672. yyDateChange(e) {
  673. // 获取年月日
  674. let yyDate = new Date(e);
  675. let year = yyDate.getFullYear();
  676. let month = yyDate.getMonth();
  677. let date = yyDate.getDate();
  678. // 获取当前时间的年月日
  679. let now = new Date();
  680. let nYear = now.getFullYear();
  681. let nMonth = now.getMonth();
  682. let nDate = now.getDate();
  683. if (year != nYear || month != nMonth || date != nDate) {
  684. this.disabledHours = () => [];
  685. this.disabledMinutes = (hour) => [];
  686. } else {
  687. // 禁用小时
  688. this.disabledHours = () => {
  689. let now = new Date();
  690. let nHour = now.getHours();
  691. let nMinute = now.getMinutes();
  692. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  693. return range(0, nHour + 1);
  694. } else {
  695. return range(0, nHour);
  696. }
  697. };
  698. // 禁用分钟
  699. this.disabledMinutes = (hour) => {
  700. let now = new Date();
  701. let nHour = now.getHours();
  702. let nMinute = now.getMinutes();
  703. if (hour === nHour || hour === undefined) {
  704. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  705. } else {
  706. return [];
  707. }
  708. };
  709. }
  710. }
  711. // 关闭其他建单保存结果
  712. closeModel(e) {
  713. console.log(e);
  714. if (e === "other") {
  715. this.osComponentRef2.osInstance().scroll({ x: 0, y: this.positionY });
  716. this.getOrderList();
  717. } else if (e === "bb") {
  718. this.getOrderList();
  719. this.getSpecimenWorkOrderMsg();
  720. }
  721. }
  722. // 其他建单
  723. selectOtherId; //选中的id
  724. otherSearch = ""; //搜索的关键词
  725. oLoading = false;
  726. nLoading = false;
  727. positionY = 0; //记录其他建单Y轴滚动距离
  728. otherClick(item) {
  729. this.positionY = this.osComponentRef2.osInstance().scroll().position.y; //内容滚动的距离
  730. this.selectOtherId = item.id;
  731. this.newShortcutOrder(item, "other");
  732. this.account = null;
  733. }
  734. selectIncidentId; //选中的id
  735. incidentClick(item) {
  736. this.positionY = this.osComponentRef10.osInstance().scroll().position.y; //内容滚动的距离
  737. this.selectIncidentId = item.id;
  738. this.bxForm.controls.content.setValue(item.mutiCategory);
  739. }
  740. //搜索
  741. otherNum = 0;
  742. otherSearchChange() {
  743. this.otherSearchChangeSubject.next(this.otherSearch);
  744. }
  745. //搜索
  746. incidentSearch = ""; //搜索的关键词
  747. incidentNum = 0;
  748. incidentSearchChange() {
  749. this.incidentSearchChangeSubject.next(this.incidentSearch);
  750. }
  751. // 切换科室
  752. changeKs() {
  753. this.hsPromptModalShow = true;
  754. // (1) 当用户设置为正数时,用户必须查看此窗体指定秒数。
  755. // (2) 当用户设置为负数时,用户可点击知道了也可倒计时自动关闭。
  756. // (3) 如果用户填写0则为无自动关闭和强制查看时间。
  757. if (this.closeTimeFlag === 0) {
  758. return;
  759. }
  760. this.closeTime = Math.abs(this.closeTimeFlag);
  761. clearInterval(this.timerCloseTime);
  762. this.timerCloseTime = setInterval(() => {
  763. this.closeTime = Math.max(--this.closeTime, 0);
  764. if (this.closeTime === 0) {
  765. if (this.closeTimeFlag <= 0) {
  766. this.hsPromptModalShow = false;
  767. }
  768. clearInterval(this.timerCloseTime);
  769. }
  770. }, 1000);
  771. }
  772. // 判断登录是否已失效
  773. initLogin() {
  774. let that = this;
  775. if (!localStorage.getItem("user")) {
  776. that.message.error("您的登录已失效,请重新登录!", {
  777. nzDuration: 3000,
  778. });
  779. setTimeout(() => {
  780. that.router.navigateByUrl("login");
  781. }, 2000);
  782. return;
  783. }
  784. }
  785. // 连接websocket
  786. getWebsocket() {
  787. let that = this;
  788. this.webs
  789. .connectWs(http.nurseWs, { userCount: that.loginUser.account })
  790. .subscribe((data) => {
  791. if (data && data.content) {
  792. that.createBasicNotification(data);
  793. }
  794. });
  795. }
  796. // 每隔一分钟刷新标本信息
  797. msgTimerId: any;
  798. refreshSpecimenWorkOrderMsg() {
  799. this.msgTimerId = setInterval(() => {
  800. this.getSpecimenWorkOrderMsg();
  801. }, 60000);
  802. }
  803. // 工单列表筛选
  804. getOrderSelectList() {
  805. let that = this;
  806. that.mainService
  807. .getDictionary("list", "association_types")
  808. .subscribe((data) => {
  809. that.orderSelectList = data || [];
  810. });
  811. }
  812. // 急标普标数量
  813. getSpecimenWorkOrderMsg() {
  814. if(this.currentDept.typeValue == 'surgery'){
  815. return;
  816. }
  817. let that = this;
  818. that.mainService
  819. .postCustom("nurse", "getSpecimenWorkOrderMsg", {
  820. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  821. })
  822. .subscribe((data) => {
  823. that.specimenWorkOrderMsg = data;
  824. });
  825. }
  826. // 手术提示信息
  827. surgeryLoading = false;
  828. getSurgeryWKOMsg() {
  829. if(this.currentDept.typeValue != 'surgery'){
  830. return;
  831. }
  832. let postData = {
  833. idx: 0,
  834. sum: 1,
  835. surgery: {
  836. applyDateStart: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  837. applyDateEnd: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  838. hosId: this.currentHospital.id,
  839. surgeryDept: this.loginUserDeptId,
  840. state: {
  841. key: 'surgery_trans_state',
  842. value: 8
  843. }
  844. }
  845. }
  846. this.surgeryLoading = true;
  847. this.mainService
  848. .getFetchDataList("simple/data", "surgery", postData)
  849. .subscribe((data) => {
  850. data.list = Array.isArray(data.list) ? data.list : [];
  851. this.surgeryLoading = false;
  852. this.surgeryWKOMsg = data.list[0] || {};
  853. });
  854. }
  855. // 获取手术配置信息
  856. surgeryField = null; //手术关联业务
  857. surgeryConfigs:any = {};
  858. // 送回苏醒室的运输过程终点科室信息
  859. surgeryCarryingCourse:any = null;
  860. surgeryCarryingCourseDepts: any[] = [];
  861. getSurgeryConfig() {
  862. this.mainService
  863. .getDictionary("list", "ordinary_field")
  864. .subscribe((data) => {
  865. this.surgeryField = data.find(v => v.value == 'surgery');
  866. if(this.surgeryField){
  867. let postData = {
  868. idx: 0,
  869. sum: 10,
  870. taskTypeConfig: {
  871. hosId: this.currentHospital.id,
  872. ordinaryField: this.surgeryField
  873. }
  874. };
  875. this.mainService
  876. .getFetchDataList("simple/data", "taskTypeConfig", postData)
  877. .subscribe((result) => {
  878. if (result.status == 200) {
  879. this.surgeryConfigs = result.list[0] || {};
  880. // 送回苏醒室开关开启 并且 有对应的任务类型
  881. if(this.surgeryConfigs.remandRecovery == 1 && this.surgeryConfigs.recoveryType){
  882. this.surgeryCarryingCourse = this.surgeryConfigs.recoveryType.carryingCourses ? this.surgeryConfigs.recoveryType.carryingCourses.find(v => v.nodeId ? v.nodeId.value == 'finish' : false) : null;
  883. // 运输过程终点科室配置是固定科室或者固定科室范围-苏醒室
  884. if(this.surgeryCarryingCourse && (this.surgeryCarryingCourse.departmentStrategy.value == 2 || this.surgeryCarryingCourse.departmentStrategy.value == 3)){
  885. this.surgeryCarryingCourseDepts = this.surgeryCarryingCourse.departmentDTOS || [];
  886. }
  887. }
  888. }
  889. });
  890. }
  891. });
  892. }
  893. // 药品静配提示信息
  894. drugJpLoading = false;
  895. getJpDrugsWKOMsg() {
  896. if(this.currentDept.typeValue == 'surgery'){
  897. return;
  898. }
  899. let that = this;
  900. this.drugJpLoading = true;
  901. that.mainService
  902. .postCustom("nurse", "getJpDrugsWKOMsg", {})
  903. .subscribe((data) => {
  904. this.drugJpLoading = false;
  905. that.jpDrugsWKOMsg = data.data ? data.data : {};
  906. console.log(that.jpDrugsWKOMsg);
  907. if (
  908. that.jpDrugsWKOMsg.drugsInfoList &&
  909. that.jpDrugsWKOMsg.drugsInfoList.length
  910. ) {
  911. that.startSwiper(that.jpDrugsWKOMsg.drugsInfoList.length);
  912. }
  913. if (
  914. that.jpDrugsWKOMsg.jpInfoList &&
  915. that.jpDrugsWKOMsg.jpInfoList.length
  916. ) {
  917. that.startSwiper1(that.jpDrugsWKOMsg.jpInfoList.length);
  918. }
  919. });
  920. }
  921. // swiper 轮播图
  922. swiperTop: number = 0;
  923. moveId: any;
  924. index: number = 0;
  925. startSwiper(length) {
  926. let that = this;
  927. clearInterval(that.moveId);
  928. setInterval(() => {
  929. that.index++;
  930. clearInterval(that.moveId);
  931. that.moveId = setInterval(() => {
  932. if (that.swiperTop > -44 * that.index) {
  933. that.swiperTop--;
  934. }
  935. if (that.swiperTop <= length * -44) {
  936. that.swiperTop = 0;
  937. that.index = 0;
  938. clearInterval(that.moveId);
  939. }
  940. }, 20);
  941. }, 2000);
  942. }
  943. swiperTop1: number = 0;
  944. moveId1: any;
  945. index1: number = 0;
  946. startSwiper1(length) {
  947. let that = this;
  948. clearInterval(that.moveId1);
  949. setInterval(() => {
  950. that.index1++;
  951. clearInterval(that.moveId1);
  952. that.moveId1 = setInterval(() => {
  953. if (that.swiperTop1 > -44 * that.index1) {
  954. that.swiperTop1--;
  955. }
  956. if (that.swiperTop1 <= length * -44) {
  957. that.swiperTop1 = 0;
  958. that.index1 = 0;
  959. clearInterval(that.moveId1);
  960. }
  961. }, 20);
  962. }, 2000);
  963. }
  964. // 关注患者
  965. follow(data) {
  966. this.showCommonModal(
  967. data,
  968. data.focusPatient === 0
  969. ? "您将设置患者【" +
  970. data.patientName +
  971. "】为重点关注,后期此患者的相关检查将会自动建单通知支助中心"
  972. : "您将取消设置患者【" +
  973. data.patientName +
  974. "】为重点关注,后期此患者的相关检查将不会自动建单通知支助中心"
  975. );
  976. }
  977. // 通用提示模态框
  978. commonModal: boolean = false; //模态框
  979. loading4 = false;
  980. tipsMsg1: string; //提示框信息
  981. coop: any; //当前操作列
  982. showCommonModal(data: any, tipsMsg1: string) {
  983. this.commonModal = true;
  984. this.coop = data;
  985. this.tipsMsg1 = tipsMsg1;
  986. }
  987. // 隐藏模态框
  988. hideCommonModal() {
  989. this.commonModal = false;
  990. }
  991. // 确认
  992. confirmCommon() {
  993. this.commonModal = false;
  994. let postData = {
  995. patient: {
  996. id: this.coop.id,
  997. focusPatient: this.coop.focusPatient === 0 ? 1 : 0,
  998. },
  999. };
  1000. this.loading4 = true;
  1001. this.mainService.listMsgByMain("updData/patient", postData).subscribe(
  1002. (result) => {
  1003. this.loading4 = false;
  1004. if (result["status"] == 200) {
  1005. this.showPromptModal(
  1006. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  1007. true,
  1008. ""
  1009. );
  1010. this.getPatient(this.tabSearchCont);
  1011. } else {
  1012. this.showPromptModal(
  1013. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  1014. false,
  1015. ""
  1016. );
  1017. }
  1018. },
  1019. (err) => {
  1020. this.loading4 = false;
  1021. this.showPromptModal("操作", false, "");
  1022. }
  1023. );
  1024. }
  1025. // 是否确定报修模态框
  1026. bxModal: boolean = false; //模态框
  1027. loading6 = false;
  1028. tipsMsg2: string; //提示框信息
  1029. coopBx: any; //当前操作列
  1030. showBxModal(data: any, tipsMsg2: string) {
  1031. this.bxModal = true;
  1032. this.coopBx = data;
  1033. this.tipsMsg2 = tipsMsg2;
  1034. }
  1035. // 隐藏模态框
  1036. hideBxModal() {
  1037. this.bxModal = false;
  1038. }
  1039. // 确认
  1040. confirmBx() {
  1041. this.loading6 = true;
  1042. this.mainService.wxbx({}).subscribe((result) => {
  1043. if ((result as any).status == 200) {
  1044. let bxcode = (result as any).data; //生成微信报修号
  1045. let postData: any = {
  1046. verification: "true",
  1047. incident: {
  1048. branch:this.loginUser.currentHospital.id,
  1049. deptId:this.loginUser.dept.id,
  1050. // contacts: this.loginUser.name,
  1051. // contactsInformation: this.loginUser.phone,
  1052. description: this.coopBx.content,
  1053. requester: { account: this.loginUser.account },
  1054. sourceType: "wechatUserIncident",
  1055. fileUrl: "url",
  1056. bxcode,
  1057. },
  1058. loginUser: {
  1059. account: this.loginUser.account,
  1060. id: this.loginUser.id,
  1061. },
  1062. };
  1063. if (this.coopBx.category) {
  1064. postData.incident.categoryId = this.coopBx.category.id;
  1065. }
  1066. this.mainService.addWxIncident(postData).subscribe((res) => {
  1067. this.loading6 = false;
  1068. this.bxModal = false;
  1069. if ((res as any).state == 200) {
  1070. this.showPromptModal("提交", true, "");
  1071. this.checkTable("bxlb");
  1072. } else {
  1073. this.showPromptModal("提交", false, (res as any).msg);
  1074. }
  1075. });
  1076. } else {
  1077. this.loading6 = false;
  1078. this.showPromptModal("提交", false, "");
  1079. }
  1080. });
  1081. }
  1082. // 获取事件状态
  1083. incidentStateId = undefined;
  1084. incidentStateList = [];
  1085. getIncidentState() {
  1086. let postData = { type: "list", key: "wxincident_state" };
  1087. this.iLoading = true;
  1088. this.mainService.getDictionaryByITSM(postData).subscribe((data: any) => {
  1089. this.iLoading = false;
  1090. if (data.status == 200) {
  1091. this.incidentStateList = data.data || [];
  1092. }
  1093. });
  1094. }
  1095. // 获取星级
  1096. degrees = [];
  1097. getDegrees() {
  1098. let postData = { type: "list", key: "incident_degree" };
  1099. this.iLoading = true;
  1100. this.mainService.getDictionaryByITSM(postData).subscribe((data: any) => {
  1101. this.iLoading = false;
  1102. if (data.status == 200) {
  1103. this.degrees = data.data || [];
  1104. }
  1105. });
  1106. }
  1107. // 获取故障现象(三级)
  1108. incidentList = [];
  1109. iLoading = false;
  1110. getIncidentcategory(key = "") {
  1111. let postData = {
  1112. idx: 0,
  1113. sum: 9999,
  1114. incidentcategory: {
  1115. category: key,
  1116. selectType: "pinyin_qs",
  1117. hierarchyQuery: "three",
  1118. },
  1119. };
  1120. this.iLoading = true;
  1121. this.mainService
  1122. .fetchListBx("incidentcategory", postData)
  1123. .subscribe((data: any) => {
  1124. this.iLoading = false;
  1125. if (data.status == 200) {
  1126. this.incidentList = data.list || [];
  1127. }
  1128. });
  1129. }
  1130. // 获取当前登录人科室任务类型信息
  1131. othersList: any = []; // 其他一键建单列表
  1132. bbMsg: any = {}; //标本一键建单
  1133. patientMsgList: any = []; // 患者转运,患者陪检一键建单
  1134. tabFlag = true; //页面初始化获取一次患者陪检的任务类型信息
  1135. allowUrgentFlag = false; //检查列表的患者陪检类型是否允许加急
  1136. getDeptTaskType(search?, clear?) {
  1137. let that = this;
  1138. this.otherNum++;
  1139. this.oLoading = true;
  1140. let postData = {
  1141. deptId: that.loginUserDeptId,
  1142. };
  1143. if (search !== undefined) {
  1144. postData["taskName"] = search;
  1145. }
  1146. that.mainService
  1147. .postCustom("nurse", "getDeptTaskType", postData)
  1148. .subscribe((data) => {
  1149. this.otherNum--;
  1150. if (this.otherNum === 0) {
  1151. this.oLoading = false;
  1152. }
  1153. if (search === undefined) {
  1154. that.deptTaskTypeRules = data.data;
  1155. that.getOrderList();
  1156. if(that.deptTaskTypeRules.openPatientTransport){
  1157. // 手术权限
  1158. that.getSurgeryWKOMsg();
  1159. }
  1160. if (
  1161. that.deptTaskTypeRules.openInspection ||
  1162. that.deptTaskTypeRules.openPatientTransport
  1163. ) {
  1164. // 陪检权限或转科权限
  1165. if (this.tabFlag) {
  1166. this.tabFlag = false;
  1167. this.getTaskTypeByInspection().subscribe((result) => {
  1168. console.log(result);
  1169. if (result.list && result.list.length > 0) {
  1170. this.appointmentBuildFlag =
  1171. result.list[0].appointmentSwitch + ""; //是否开启护士端预约建单
  1172. // this.leadTime = result.list[0].appointmentTime; //生效时长
  1173. this.leadTime = 0; //生效时长
  1174. this.followFlag = result.list[0].focusSwitch + ""; //是否开启护士端重点关注
  1175. this.allowUrgentFlag =
  1176. result.list[0].allowUrgent == 1 ? true : false; //是否允许加急(检查列表)
  1177. } else {
  1178. this.appointmentBuildFlag = "0"; //是否开启护士端预约建单
  1179. this.leadTime = 0; //生效时长
  1180. this.followFlag = "0"; //是否开启护士端重点关注
  1181. this.allowUrgentFlag = false; //是否允许加急(检查列表)
  1182. }
  1183. this.pLoading = true;
  1184. that.getPatient();
  1185. });
  1186. } else {
  1187. that.getPatient();
  1188. }
  1189. }
  1190. if (that.deptTaskTypeRules.openSpecimen) {
  1191. // 标本权限
  1192. that.getSpecimenWorkOrderMsg();
  1193. }
  1194. if (
  1195. that.deptTaskTypeRules.openStaticDistribution ||
  1196. that.deptTaskTypeRules.openDrugsBag
  1197. ) {
  1198. // 药品静配权限
  1199. that.getJpDrugsWKOMsg();
  1200. }
  1201. }
  1202. if (data.data.allTaskTypes) {
  1203. that.othersList = [];
  1204. that.patientMsgList = [];
  1205. data.data.allTaskTypes.forEach((e) => {
  1206. if (e.associationType.value == "other") {
  1207. that.othersList.push(e);
  1208. } else if (e.associationType.value == "specimen") {
  1209. that.bbMsg = e;
  1210. } else if (
  1211. e.associationType.value == "patientTransport" ||
  1212. e.associationType.value == "inspect"
  1213. ) {
  1214. that.patientMsgList.push(e);
  1215. }
  1216. });
  1217. // if (clear === "clear") {
  1218. // this.otherSearch = "";
  1219. // this.workOrderRemark = "";
  1220. // this.customRemarks = [];
  1221. // this.historyCustomRemarks = [];
  1222. // let obj = that.othersList.find(
  1223. // (item) => item.id == this.selectOtherId
  1224. // );
  1225. // obj && this.otherClick(obj);
  1226. // }
  1227. console.log(this.selectOtherId);
  1228. if (!this.selectOtherId) {
  1229. if (that.othersList.length) {
  1230. this.selectOtherId = that.othersList[0].id;
  1231. let obj = that.othersList.find(
  1232. (item) => item.id == this.selectOtherId
  1233. );
  1234. obj && this.otherClick(obj);
  1235. } else {
  1236. this.selectOtherId = null;
  1237. }
  1238. }
  1239. }
  1240. });
  1241. }
  1242. // 工号输入搜索
  1243. searchAccount(e) {
  1244. this.searchAccountSubject.next(e);
  1245. }
  1246. // 根据工号获取用户
  1247. account = null;
  1248. accountList = [];
  1249. isLoading:boolean = false;
  1250. getAccountList(key = ''): void {
  1251. let postData = {
  1252. idx: 0,
  1253. sum: 10,
  1254. user: {
  1255. account: key,
  1256. hospital: {
  1257. id: this.currentHospital.id
  1258. }
  1259. }
  1260. };
  1261. this.isLoading = true;
  1262. this.mainService
  1263. .getFetchDataList("data", "user", postData)
  1264. .subscribe((data) => {
  1265. this.isLoading = false;
  1266. this.accountList = data.list || [];
  1267. });
  1268. }
  1269. // 目标科室输入搜索
  1270. searchDept(type, msg, e) {
  1271. this.getDeptList(type, msg, e);
  1272. }
  1273. // 获取科室
  1274. getDeptList(type, msg, key?): void {
  1275. // 返回值的status是201 则是默认发起科室
  1276. // 返回值的status是202 则是固定科室范围
  1277. // 返回值的status是203 则是固定科室
  1278. // 返回值的status是204 则是自主填写
  1279. // 返回值的status是205 则是固定科室类型
  1280. if (
  1281. (type == "start" && msg.start.start.departmentStrategy == 202) ||
  1282. (type == "target" && msg.end.end.departmentStrategy == 202)
  1283. ) {
  1284. return; //固定科室范围禁用搜索
  1285. }
  1286. let postData: any = {
  1287. idx: 0,
  1288. sum: 20,
  1289. department: {
  1290. searchType: 1,
  1291. cascadeHosId: this.currentHospital.id
  1292. },
  1293. };
  1294. if (key) {
  1295. postData.department["keyWord"] = key;
  1296. }
  1297. if (type == "start" && msg.start.start.departmentStrategy == 205) {
  1298. postData.department["type"] = { id: msg.start.start.startTypeId };
  1299. } else if (type == "target" && msg.end.end.departmentStrategy == 205) {
  1300. postData.department["type"] = { id: msg.end.end.endTypeId };
  1301. }
  1302. if (type == "start") {
  1303. postData.department["ids"] = msg.start.deptIds || "";
  1304. } else if (type == "target") {
  1305. postData.department["ids"] = msg.end.deptIds || "";
  1306. }
  1307. postData.department.nurseSign = 1;
  1308. this.mainService
  1309. .getFetchDataList("data", "department", postData)
  1310. .subscribe((data) => {
  1311. if (type == "target") {
  1312. msg.end.end.list = data.list;
  1313. } else if (type == "start") {
  1314. msg.start.start.list = data.list;
  1315. }
  1316. });
  1317. }
  1318. // 切换左侧tab
  1319. changeInfo() {
  1320. if (
  1321. !this.deptTaskTypeRules.openInspection &&
  1322. !this.deptTaskTypeRules.openPatientTransport
  1323. ) {
  1324. return;
  1325. }
  1326. this.infoPageIdx = 1;
  1327. this.getPatient();
  1328. }
  1329. // 获取患者信息
  1330. snum = 0;
  1331. getPatient(e?) {
  1332. if (
  1333. (this.currentDept.typeValue == "checkRoom2" ||
  1334. this.currentDept.typeValue == "outpatientDept" ||
  1335. this.currentDept.typeValue == "checkRoom") &&
  1336. !this.tabSearchCont
  1337. ) {
  1338. this.pLoading = false;
  1339. this.patientList = [];
  1340. this.infoLength = 0;
  1341. return; //护士端如果登录后如果科室类型为“检查科室”、“门诊科室”、“检验科室”,默认不显示患者信息
  1342. }
  1343. this.pLoading = true;
  1344. let postData = {
  1345. idx: this.infoPageIdx - 1,
  1346. sum: 10,
  1347. };
  1348. if(this.currentDept.typeValue == 'surgery'){
  1349. // 手术安排信息-手术室类型
  1350. postData["surgery"] = {
  1351. searchKey: e ? e : this.tabSearchCont,
  1352. applyDateStart: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  1353. applyDateEnd: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  1354. hosId: this.currentHospital.id,
  1355. surgeryDept: this.loginUserDeptId,
  1356. state: {
  1357. key: 'surgery_trans_state',
  1358. value: 3
  1359. }
  1360. };
  1361. }else if(this.currentDept.typeValue == 'recovery'){
  1362. // 患者信息-复苏室类型
  1363. postData["patient"] = {
  1364. keyWord: e ? e : this.tabSearchCont,
  1365. };
  1366. // 查询父级科室患者
  1367. postData["patient"]["parentIdOnly"] = true;
  1368. postData["patient"]["recoveryDept"] = this.loginUserDeptId;
  1369. postData["patient"]["recoveryDeptDTO"] = {keyWord: '1'};
  1370. }else{
  1371. // 患者信息
  1372. postData["patient"] = {
  1373. keyWord: e ? e : this.tabSearchCont,
  1374. };
  1375. // 查询父级科室患者
  1376. postData["patient"]["parentIdOnly"] = true;
  1377. if (
  1378. this.currentDept.typeValue == "checkRoom2" ||
  1379. this.currentDept.typeValue == "outpatientDept" ||
  1380. this.currentDept.typeValue == "checkRoom"
  1381. ) {
  1382. delete postData["patient"]["department"]; //搜索范围为全院在院患者
  1383. } else {
  1384. postData["patient"]["department"] = { id: this.loginUserDeptId };
  1385. }
  1386. }
  1387. this.snum++;
  1388. this.mainService
  1389. .getFetchDataList(this.currentDept.typeValue == 'surgery' ? "simple/data" : 'nurse', this.currentDept.typeValue == 'surgery' ? "surgery" : 'patient', postData)
  1390. .subscribe((data) => {
  1391. this.snum--;
  1392. if (data.list.length > 0) {
  1393. data.list.forEach((item) => {
  1394. if(this.currentDept.typeValue == 'surgery'){
  1395. if (item.patientDTO && item.patientDTO.focusPatient === undefined) {
  1396. item.patientDTO.focusPatient = 0;
  1397. }
  1398. }else{
  1399. if (item.focusPatient === undefined) {
  1400. item.focusPatient = 0;
  1401. }
  1402. }
  1403. });
  1404. }
  1405. this.patientList = data.list || [];
  1406. if (this.snum === 0) {
  1407. this.pLoading = false;
  1408. }
  1409. this.infoLength = data.totalNum || 0;
  1410. });
  1411. }
  1412. // tab输入搜索节流阀
  1413. searchTabInp(e) {
  1414. if (
  1415. !this.deptTaskTypeRules.openInspection &&
  1416. !this.deptTaskTypeRules.openPatientTransport
  1417. ) {
  1418. return;
  1419. }
  1420. this.searchTabInpSubject.next(e);
  1421. }
  1422. // 下一日(陪检)
  1423. nextDay() {
  1424. this.yyDate = addDays(this.yyDate, 1);
  1425. this.yyDateChange(this.yyDate);
  1426. }
  1427. // 下一日(转运)
  1428. nextDayZy() {
  1429. this.yyDateZy = addDays(this.yyDateZy, 1);
  1430. this.yyDateChange(this.yyDateZy);
  1431. }
  1432. // 禁用日期(陪检)
  1433. disabledyyDate = (current: Date): boolean => {
  1434. return differenceInCalendarDays(current, new Date()) < 0;
  1435. };
  1436. // 禁用日期(转运)
  1437. disabledyyDateZy = (current: Date): boolean => {
  1438. return differenceInCalendarDays(current, new Date()) < 0;
  1439. };
  1440. // 一键建单确认弹框
  1441. confirmSub: boolean = false;
  1442. confirmPostData: any = {}; //确认提交数据
  1443. confirmYuyue: boolean = false; //确认预约
  1444. confirmInfo: string = "";
  1445. btnLoading3 = false;
  1446. confirm() {
  1447. if (this.confirmYuyue) {
  1448. this.confirmPostData.workOrder.yyTime =
  1449. format(new Date(this.yyTime), "yyyy-MM-dd HH:mm") + ":00";
  1450. }
  1451. if (!this.confirmYuyue) {
  1452. this.confirmPostData.workOrder.platform = 2;
  1453. } else {
  1454. delete this.confirmPostData.workOrder.platform;
  1455. }
  1456. //是否需要医护陪同检查
  1457. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  1458. //特级护理或一级护理
  1459. if (
  1460. this.patientMsg.careLevel.value === "0" ||
  1461. this.patientMsg.careLevel.value === "1"
  1462. ) {
  1463. this.btnLoading = false;
  1464. this.btnLoading1 = false;
  1465. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  1466. return;
  1467. }
  1468. }
  1469. if (this.patientMsg.illnessState && this.currentTasktype.isAccompany == 1) {
  1470. //病危或病重
  1471. if (
  1472. this.patientMsg.illnessState.value === "2" ||
  1473. this.patientMsg.illnessState.value === "3"
  1474. ) {
  1475. this.btnLoading = false;
  1476. this.btnLoading1 = false;
  1477. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  1478. return;
  1479. }
  1480. }
  1481. this.btnLoading3 = true;
  1482. this.confirmPostData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  1483. this.newOrderTimeFun(this.confirmPostData.workOrder.taskType.id, () => {
  1484. this.btnLoading3 = false;
  1485. this.cancel();
  1486. }, () => {
  1487. this.mainService
  1488. .postCustom(
  1489. "api",
  1490. this.confirmYuyue ? "appointmentOrder" : "startOrder",
  1491. this.confirmPostData
  1492. )
  1493. .subscribe((data) => {
  1494. this.message.remove(this.jdFlagId);
  1495. this.btnLoading3 = false;
  1496. this.cancel();
  1497. if (data.status == 200) {
  1498. if(this.currentDept.typeValue == 'recovery'){
  1499. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.confirmPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  1500. this.showPromptModal("创建", true, "");
  1501. this.goodsLis = [];
  1502. this.getOrderList();
  1503. this.getDeptTaskType();
  1504. this.getTodayNum();
  1505. });
  1506. }else{
  1507. this.showPromptModal("创建", true, "");
  1508. this.goodsLis = [];
  1509. this.getOrderList();
  1510. this.getDeptTaskType();
  1511. this.getTodayNum();
  1512. }
  1513. } else if (data.status == 100042) {
  1514. this.showPromptModal("创建", false, data.msg);
  1515. this.getPatient(this.tabSearchCont);
  1516. } else if (data.status == 1000033) {
  1517. //重复建单那策略
  1518. this.repeatMsg = data.msg;
  1519. this.showDelModal(
  1520. this.confirmPostData,
  1521. "accompany5",
  1522. this.confirmYuyue
  1523. );
  1524. } else {
  1525. this.showPromptModal("创建", false, data.msg);
  1526. }
  1527. });
  1528. })
  1529. }
  1530. cancel() {
  1531. this.confirmSub = false;
  1532. // this.confirmPostData = {};
  1533. this.confirmYuyue = false;
  1534. this.btnLoading = false;
  1535. }
  1536. patientForm: FormGroup; //患者信息一键建单表单
  1537. //患者送检检查项目
  1538. checkTypeLis: any = [];
  1539. // 患者信息一键建单关联检查
  1540. linkCheckLis: any = [];
  1541. goodsLis: any = []; //携带设备
  1542. isRemarks: boolean = false; //是否开启备注信息
  1543. allowUrgent: any = "0"; //加急
  1544. urgentReason: any = ""; //加急原因
  1545. // 初始化form表单
  1546. initForm() {
  1547. // 初始化患者信息一键建单表单
  1548. this.patientForm = this.fb.group({
  1549. checkedType: [null, [Validators.required]],
  1550. goods: [null],
  1551. workOrderRemark2: [null],
  1552. linkCheck: [null, []],
  1553. targetOffice: [null, [this.targetOfficeValidator]],
  1554. originOffice: [null, [this.originOfficeValidator]],
  1555. allowUrgent: [null], //加急
  1556. urgentReason: [null, [this.urgentReasonValidator]], //加急原因
  1557. });
  1558. // 初始化一键发起建单表单
  1559. this.shortcutForm = this.fb.group({
  1560. targetOffice: [null, [this.targetOfficeShortCutValidator]],
  1561. originOffice: [null, [this.originOfficeShortCutValidator]],
  1562. });
  1563. // 初始化一键发起建单表单
  1564. this.shortcutForm1 = this.fb.group({
  1565. targetOffice: [null, [this.targetOfficeShortCutValidator1]],
  1566. originOffice: [null, [this.originOfficeShortCutValidator1]],
  1567. });
  1568. //新增报修
  1569. this.bxForm = this.fb.group({
  1570. // name: [null, [Validators.required]],
  1571. // phone: [null, [Validators.required]],
  1572. // hospital: [null, [Validators.required]],
  1573. // building: [null, [Validators.required]],
  1574. // address: [null, [Validators.required]],
  1575. content: [null, [Validators.required]],
  1576. });
  1577. }
  1578. //创建自定义校验规则dateValidator,用于复选框组校验时调用。
  1579. // 起点科室校验
  1580. originOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  1581. if (
  1582. this.patientForm &&
  1583. this.patientForm.value &&
  1584. this.checkedShowMsg.status != 200 &&
  1585. !control.value &&
  1586. (this.checkedShowMsg.status == 100015 ||
  1587. this.checkedShowMsg.status == 100013)
  1588. ) {
  1589. return { required: true };
  1590. }
  1591. };
  1592. // 目标科室校验
  1593. targetOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  1594. if (
  1595. this.patientForm &&
  1596. this.patientForm.value &&
  1597. this.checkedShowMsg.status != 200 &&
  1598. !control.value &&
  1599. (this.checkedShowMsg.status == 100015 ||
  1600. this.checkedShowMsg.status == 100014)
  1601. ) {
  1602. return { required: true };
  1603. }
  1604. };
  1605. // 加急原因校验
  1606. urgentReasonValidator = (control: FormControl): { [s: string]: boolean } => {
  1607. if (this.allowUrgent == 1) {
  1608. return { required: true };
  1609. }
  1610. };
  1611. pickUpModal: boolean = false; //模态框
  1612. pickUpInfo:string = '';
  1613. pickUpItem: any = {};
  1614. hidePickUpModal() {
  1615. this.pickUpModal = false;
  1616. }
  1617. // 确认
  1618. confirmPickUp() {
  1619. console.log(this.pickUpItem);
  1620. this.btnLoading = true;
  1621. this.mainService
  1622. .createOrTakeOrder({
  1623. type: 'surgery',
  1624. id: this.pickUpItem.id,
  1625. workOrder: {
  1626. sourceld: 2,
  1627. createDept: this.loginUser.dept.id,
  1628. platform: 2
  1629. }
  1630. })
  1631. .subscribe((result:any) => {
  1632. this.btnLoading = false;
  1633. this.pickUpModal = false;
  1634. if(result.state == 200){
  1635. this.showPromptModal("创建", true, "");
  1636. this.getOrderList();
  1637. this.getDeptTaskType();
  1638. this.getTodayNum();
  1639. }else{
  1640. this.showPromptModal("创建", false, result.msg);
  1641. }
  1642. });
  1643. }
  1644. // 手术安排信息-一键接患者
  1645. pickUpPatient(e, item){
  1646. e.stopPropagation();
  1647. this.pickUpModal = true;
  1648. this.pickUpItem = item;
  1649. 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>手术间进行手术,您确认接患者吗?`
  1650. }
  1651. sendWardModal: boolean = false; //模态框
  1652. sendWardInfo:string = '';
  1653. sendWardItem: any = {};
  1654. hideSendWardModal() {
  1655. this.sendWardModal = false;
  1656. }
  1657. // 确认
  1658. sLoading1 = false;
  1659. confirmSendWard(data) {
  1660. console.log(this.sendWardItem);
  1661. this.sLoading1 = true;
  1662. this.mainService
  1663. .createRemandOrder({
  1664. type: 'surgery',
  1665. surgeryId: this.sendWardItem.id,
  1666. orderId: this.sendWardItem.gdid,
  1667. configId: this.surgeryConfigs.id,
  1668. remandType: 'clinical',
  1669. remandClean: data.isRemandClean ? 1 : 0,
  1670. })
  1671. .subscribe((result:any) => {
  1672. this.sLoading1 = false;
  1673. this.sendWardModal = false;
  1674. if(result.state == 200){
  1675. this.showPromptModal("创建", true, "");
  1676. this.getOrderList();
  1677. this.getDeptTaskType();
  1678. this.getTodayNum();
  1679. }else{
  1680. this.showPromptModal("创建", false, result.msg);
  1681. }
  1682. });
  1683. }
  1684. // 手术中患者-送回病房
  1685. sendWard(e, item){
  1686. e.stopPropagation();
  1687. this.sendWardModal = true;
  1688. this.sendWardItem = item;
  1689. 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>科室吗?`
  1690. }
  1691. sendAwakeningRoomModal: boolean = false; //模态框
  1692. sendAwakeningRoomInfo:string = '';
  1693. sendAwakeningRoomItem: any = {};
  1694. hideSendAwakeningRoomModal() {
  1695. this.sendAwakeningRoomModal = false;
  1696. }
  1697. // 确认
  1698. sLoading2 = false;
  1699. confirmSendAwakeningRoom(data) {
  1700. console.log(this.sendAwakeningRoomItem);
  1701. console.log(this.surgeryConfigs);
  1702. if(!data.recoveryRoom){
  1703. this.message.info(`<span class="red">${this.surgeryConfigs.recoveryType.taskName}</span>任务类型-运输过程-终点科室-默认科室配置错误!`);
  1704. return;
  1705. }
  1706. this.sLoading2 = true;
  1707. this.mainService
  1708. .createRemandOrder({
  1709. type: 'surgery',
  1710. surgeryId: this.sendAwakeningRoomItem.id,
  1711. orderId: this.sendAwakeningRoomItem.gdid,
  1712. configId: this.surgeryConfigs.id,
  1713. remandType: 'recovery',
  1714. remandClean: data.isRemandClean ? 1 : 0,
  1715. endDept: data.recoveryRoom || undefined,
  1716. })
  1717. .subscribe((result:any) => {
  1718. this.sLoading2 = false;
  1719. this.sendAwakeningRoomModal = false;
  1720. if(result.state == 200){
  1721. this.showPromptModal("创建", true, "");
  1722. this.getOrderList();
  1723. this.getDeptTaskType();
  1724. this.getTodayNum();
  1725. }else{
  1726. this.showPromptModal("创建", false, result.msg);
  1727. }
  1728. });
  1729. }
  1730. // 手术中患者-送回苏醒区
  1731. sendAwakeningRoom(e, item){
  1732. e.stopPropagation();
  1733. this.sendAwakeningRoomModal = true;
  1734. this.sendAwakeningRoomItem = item;
  1735. 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>科室吗?`
  1736. }
  1737. // 患者信息一键建单
  1738. patientModal: boolean = false; //患者信息一键建单模态框
  1739. patientMsg; //患者信息
  1740. // 打开患者信息一键建单模态框
  1741. maskFlag: any = false;
  1742. newPatientOrder(msg) {
  1743. this.yyTime = null;
  1744. this.yyTimeZy = null;
  1745. this.btnLoading = false;
  1746. this.btnLoading1 = false;
  1747. let that = this;
  1748. that.initForm();
  1749. that.checkedShowMsg = {};
  1750. that.patientMsg = msg;
  1751. this.maskFlag = this.message.loading("正在加载中..", {
  1752. nzDuration: 0,
  1753. }).messageId;
  1754. that.mainService
  1755. .postCustom("configuration", "deptTSPTaskType", {})
  1756. .subscribe((data) => {
  1757. that.checkTypeLis = data.data;
  1758. // 默认选中患者陪检,没有患者陪检,则选择第一个患者其他服务的任务类型
  1759. let id;
  1760. for (let i = that.checkTypeLis.length - 1; i >= 0; i--) {
  1761. if (that.checkTypeLis[i].associationType.value == "inspect") {
  1762. id = that.checkTypeLis[i].id;
  1763. break;
  1764. } else if (
  1765. that.checkTypeLis[i].associationType.value == "patientTransport"
  1766. ) {
  1767. id = that.checkTypeLis[i].id;
  1768. }
  1769. }
  1770. that.patientForm.controls.checkedType.setValue(id);
  1771. this.changeCheckedType();
  1772. });
  1773. }
  1774. yyTimeChange(e) {
  1775. if (this.yyTime) {
  1776. let now = new Date();
  1777. // 禁用日期(陪检)
  1778. if (getHours(this.yyTime) < getHours(now)) {
  1779. this.disabledyyDate = (current: Date): boolean => {
  1780. return differenceInCalendarDays(current, new Date()) < 1;
  1781. };
  1782. } else {
  1783. this.disabledyyDate = (current: Date): boolean => {
  1784. return differenceInCalendarDays(current, new Date()) < 0;
  1785. };
  1786. }
  1787. let end = this.getLgNumber(getMinutes(this.yyTime), this.inspectAndPatientTransportConfig.timeMod);
  1788. this.yyTime = setMinutes(this.yyTime, end);
  1789. }
  1790. this.clickYYFlag = false;
  1791. }
  1792. yyTimeZyChange(e) {
  1793. if (this.yyTimeZy) {
  1794. let now = new Date();
  1795. // 禁用日期(转运)
  1796. if (getHours(this.yyTimeZy) < getHours(now)) {
  1797. this.disabledyyDateZy = (current: Date): boolean => {
  1798. return differenceInCalendarDays(current, new Date()) < 1;
  1799. };
  1800. } else {
  1801. this.disabledyyDateZy = (current: Date): boolean => {
  1802. return differenceInCalendarDays(current, new Date()) < 0;
  1803. };
  1804. }
  1805. let end = this.getLgNumber(getMinutes(this.yyTimeZy), this.inspectAndPatientTransportConfig.timeMod);
  1806. this.yyTimeZy = setMinutes(this.yyTimeZy, end);
  1807. }
  1808. this.clickYYZyFlag = false;
  1809. }
  1810. // 获取大于x,并且是n的倍数的数字
  1811. getLgNumber(x: number, n:number): number{
  1812. for(let i = x; i < 60; i++){
  1813. if(i % n === 0){
  1814. return i;
  1815. }
  1816. }
  1817. return 0;
  1818. }
  1819. hidePatientOrder() {
  1820. this.patientModal = false;
  1821. this.clickYYFlag = false;
  1822. this.clickYYZyFlag = false;
  1823. }
  1824. // 预约建单
  1825. btnLoading1 = false;
  1826. confirmPatient1(type) {
  1827. this.confirmPatient(type);
  1828. }
  1829. // 患者信息保存
  1830. clickYYFlag = false; //是否点击预约建单-患者陪检
  1831. clickYYZyFlag = false; //是否点击预约建单-患者其他
  1832. confirmPatient(yuyue?) {
  1833. if (yuyue === "patient-yuyue") {
  1834. this.clickYYFlag = true;
  1835. } else {
  1836. this.clickYYFlag = false;
  1837. }
  1838. if (yuyue === "patient-zy-yuyue") {
  1839. this.clickYYZyFlag = true;
  1840. } else {
  1841. this.clickYYZyFlag = false;
  1842. }
  1843. // 选项是患者转运
  1844. let flag = this.checkTypeLis.some((item) => {
  1845. return (
  1846. item.id == this.patientForm.controls.checkedType.value &&
  1847. item.associationType.value == "patientTransport"
  1848. );
  1849. });
  1850. //预约时间-患者陪检不能为空
  1851. console.log(this.yyTime, this.yyTimeZy, flag, yuyue);
  1852. if (
  1853. (!this.yyTime && !flag && yuyue === "patient-yuyue") ||
  1854. (!this.yyTimeZy && flag && yuyue === "patient-zy-yuyue")
  1855. ) {
  1856. return;
  1857. }
  1858. if (flag) {
  1859. //转运
  1860. this.yyTimeZy =
  1861. format(new Date(this.yyDateZy), "yyyy-MM-dd") +
  1862. " " +
  1863. format(new Date(this.yyTimeZy), "HH:mm") +
  1864. ":00";
  1865. } else {
  1866. //陪检
  1867. this.yyTime =
  1868. format(new Date(this.yyDate), "yyyy-MM-dd") +
  1869. " " +
  1870. format(new Date(this.yyTime), "HH:mm") +
  1871. ":00";
  1872. }
  1873. var that = this;
  1874. for (const i in that.patientForm.controls) {
  1875. that.patientForm.controls[i].markAsDirty();
  1876. that.patientForm.controls[i].updateValueAndValidity();
  1877. }
  1878. if (that.patientForm.invalid) {
  1879. return;
  1880. }
  1881. console.log(that.patientForm);
  1882. if (yuyue) {
  1883. this.confirmYuyue = true;
  1884. this.btnLoading1 = true;
  1885. } else {
  1886. this.confirmYuyue = false;
  1887. this.btnLoading = true;
  1888. }
  1889. let postData: any = {
  1890. workOrder: {
  1891. sourceId: SourceId.hushi,
  1892. taskType: { id: that.patientForm.controls.checkedType.value },
  1893. startDept: { id: that.checkedShowMsg.startDept },
  1894. endDepts: [{ id: that.checkedShowMsg.endDept }],
  1895. createDept: that.loginUserDeptId,
  1896. patient: {
  1897. patientCode: that.patientMsg.patientCode,
  1898. },
  1899. },
  1900. };
  1901. if (!flag) {
  1902. postData.workOrder.taskType.isHalfInspect =
  1903. this.currentTasktype.isHalfInspect === 1 ? 1 : 0; //半程陪检
  1904. }
  1905. if (
  1906. (that.checkedShowMsg.status == 100013 ||
  1907. that.checkedShowMsg.status == 100015) &&
  1908. that.patientForm.value.originOffice
  1909. ) {
  1910. postData.workOrder.startDept.id = that.patientForm.value.originOffice;
  1911. }
  1912. if (that.patientForm.value.targetOffice) {
  1913. postData.workOrder["endDepts"] = [
  1914. { id: that.patientForm.value.targetOffice },
  1915. ];
  1916. } else if (flag) {
  1917. postData.workOrder["endDepts"] = [
  1918. { id: that.checkedShowMsg.end.end.list[0].id },
  1919. ];
  1920. }
  1921. let checkedArr = [];
  1922. let yy = false; //是否有预约时间
  1923. if (that.linkCheckLis && that.linkCheckLis.length) {
  1924. that.linkCheckLis.forEach((e) => {
  1925. if (e.checked) {
  1926. checkedArr.push({ id: e.value });
  1927. if (e.yyTime) {
  1928. yy = true;
  1929. }
  1930. }
  1931. });
  1932. }
  1933. // 携带设备
  1934. let goods = "";
  1935. if (that.patientForm.value.goods && that.patientForm.value.goods.length) {
  1936. that.patientForm.value.goods.forEach((e) => {
  1937. if (e.checked) {
  1938. goods += e.value + ",";
  1939. }
  1940. });
  1941. goods = goods.slice(0, goods.length - 1);
  1942. }
  1943. postData.workOrder["goods"] = goods;
  1944. // 工单备注
  1945. postData.workOrder["workOrderRemark"] = that.workOrderRemark2 || '';
  1946. if (!yuyue && that.current_allowUrgent && this.allowUrgent == 1) {
  1947. postData.workOrder["urgentDetails"] = {
  1948. checkStatus: { id: 329 },
  1949. urgentReason: that.urgentReason,
  1950. };
  1951. } else {
  1952. delete postData.workOrder["urgentDetails"];
  1953. }
  1954. if (
  1955. yy &&
  1956. that.checkedShowMsg.status == 200 &&
  1957. that.linkCheckLis &&
  1958. checkedArr.length
  1959. ) {
  1960. // 有预约时间
  1961. postData.workOrder["checkList"] = checkedArr;
  1962. that.hidePatientOrder();
  1963. that.confirmSub = true;
  1964. that.confirmPostData = postData;
  1965. that.confirmInfo = "您确认建单吗?";
  1966. } else {
  1967. if (!yy && that.checkedShowMsg.status == 200) {
  1968. postData.workOrder["checkList"] = checkedArr;
  1969. // 添加预约时间
  1970. if (yuyue) {
  1971. postData.workOrder.yyTime =
  1972. format(new Date(this.yyTime), "yyyy-MM-dd HH:mm") + ":00";
  1973. }
  1974. } else {
  1975. delete postData.workOrder["checkList"];
  1976. // 添加预约时间
  1977. if (yuyue) {
  1978. postData.workOrder.yyTime =
  1979. format(new Date(this.yyTimeZy), "yyyy-MM-dd HH:mm") + ":00";
  1980. }
  1981. }
  1982. if (that.checkedShowMsg.status != 200) {
  1983. postData.workOrder["isRemand"] = this.isRemand ? 1 : 0;
  1984. }
  1985. if (!yuyue) {
  1986. postData.workOrder.platform = 2;
  1987. } else {
  1988. delete postData.workOrder.platform;
  1989. }
  1990. //是否需要医护陪同检查
  1991. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  1992. //特级护理或一级护理
  1993. if (
  1994. this.patientMsg.careLevel.value === "0" ||
  1995. this.patientMsg.careLevel.value === "1"
  1996. ) {
  1997. this.btnLoading = false;
  1998. this.btnLoading1 = false;
  1999. this.accompany(postData, yuyue, "patient");
  2000. return;
  2001. }
  2002. }
  2003. if (
  2004. this.patientMsg.illnessState &&
  2005. this.currentTasktype.isAccompany == 1
  2006. ) {
  2007. //病危或病重
  2008. if (
  2009. this.patientMsg.illnessState.value === "2" ||
  2010. this.patientMsg.illnessState.value === "3"
  2011. ) {
  2012. this.btnLoading = false;
  2013. this.btnLoading1 = false;
  2014. this.accompany(postData, yuyue, "patient");
  2015. return;
  2016. }
  2017. }
  2018. postData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  2019. this.newOrderTimeFun(postData.workOrder.taskType.id, () => {
  2020. this.hidePatientOrder();
  2021. }, () => {
  2022. this.mainService
  2023. .postCustom("api", yuyue ? "appointmentOrder" : "startOrder", postData)
  2024. .subscribe((data) => {
  2025. this.message.remove(this.jdFlagId);
  2026. this.hidePatientOrder();
  2027. if (data.status == 200) {
  2028. if(this.currentDept.typeValue == 'recovery'){
  2029. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: postData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2030. this.showPromptModal("创建", true, "");
  2031. this.goodsLis = [];
  2032. this.getOrderList();
  2033. this.getDeptTaskType();
  2034. this.getTodayNum();
  2035. });
  2036. }else{
  2037. this.showPromptModal("创建", true, "");
  2038. this.goodsLis = [];
  2039. this.getOrderList();
  2040. this.getDeptTaskType();
  2041. this.getTodayNum();
  2042. }
  2043. } else if (data.status == 100042) {
  2044. this.showPromptModal("创建", false, data.msg);
  2045. this.getPatient(this.tabSearchCont);
  2046. } else if (data.status == 1000033) {
  2047. //重复建单那策略
  2048. this.repeatMsg = data.msg;
  2049. this.showDelModal(postData, "transport", yuyue);
  2050. } else {
  2051. this.showPromptModal("创建", false, data.msg);
  2052. }
  2053. });
  2054. })
  2055. }
  2056. }
  2057. // 是否需要护士医生陪同模态框
  2058. accompanyModal: boolean = false;
  2059. accompanyLoading: boolean = false;
  2060. cancenlLoading: boolean = false;
  2061. accompanyPostData = null;
  2062. accompanyYuyue;
  2063. accompanyType = "";
  2064. accompany(postData, yuyue, type) {
  2065. this.accompanyModal = true;
  2066. this.accompanyPostData = postData;
  2067. this.accompanyYuyue = yuyue;
  2068. this.accompanyType = type;
  2069. }
  2070. confirmAccompany() {
  2071. this.accompanyPostData.workOrder.isAccompany = 1;
  2072. this.accompanyLoading = true;
  2073. if (this.accompanyType == "patient") {
  2074. //患者列表直接建单
  2075. this.newOrderTimeFun(this.accompanyPostData.workOrder.taskType.id, () => {
  2076. this.hidePatientOrder();
  2077. this.accompanyModal = false;
  2078. this.accompanyLoading = false;
  2079. }, () => {
  2080. this.mainService
  2081. .postCustom(
  2082. "api",
  2083. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  2084. this.accompanyPostData
  2085. )
  2086. .subscribe((data) => {
  2087. this.message.remove(this.jdFlagId);
  2088. this.hidePatientOrder();
  2089. this.accompanyModal = false;
  2090. this.accompanyLoading = false;
  2091. if (data.status == 200) {
  2092. if(this.currentDept.typeValue == 'recovery'){
  2093. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2094. this.showPromptModal("创建", true, "");
  2095. this.goodsLis = [];
  2096. this.getOrderList();
  2097. this.getDeptTaskType();
  2098. this.getTodayNum();
  2099. });
  2100. }else{
  2101. this.showPromptModal("创建", true, "");
  2102. this.goodsLis = [];
  2103. this.getOrderList();
  2104. this.getDeptTaskType();
  2105. this.getTodayNum();
  2106. }
  2107. } else if (data.status == 100042) {
  2108. this.showPromptModal("创建", false, data.msg);
  2109. this.getPatient(this.tabSearchCont);
  2110. } else if (data.status == 1000033) {
  2111. //重复建单那策略
  2112. this.repeatMsg = data.msg;
  2113. this.showDelModal(
  2114. this.accompanyPostData,
  2115. "accompany1",
  2116. this.accompanyYuyue
  2117. );
  2118. } else {
  2119. this.showPromptModal("创建", false, data.msg);
  2120. }
  2121. });
  2122. })
  2123. } else if (this.accompanyType == "patient-yy") {
  2124. //患者列表预约建单
  2125. this.newOrderTimeFun(this.accompanyPostData.workOrder.taskType.id, () => {
  2126. this.btnLoading3 = false;
  2127. this.accompanyModal = false;
  2128. this.accompanyLoading = false;
  2129. this.cancel();
  2130. }, () => {
  2131. this.mainService
  2132. .postCustom(
  2133. "api",
  2134. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  2135. this.accompanyPostData
  2136. )
  2137. .subscribe((data) => {
  2138. this.message.remove(this.jdFlagId);
  2139. this.btnLoading3 = false;
  2140. this.accompanyModal = false;
  2141. this.accompanyLoading = false;
  2142. this.cancel();
  2143. if (data.status == 200) {
  2144. if(this.currentDept.typeValue == 'recovery'){
  2145. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2146. this.showPromptModal("创建", true, "");
  2147. this.goodsLis = [];
  2148. this.getOrderList();
  2149. this.getDeptTaskType();
  2150. this.getTodayNum();
  2151. });
  2152. }else{
  2153. this.showPromptModal("创建", true, "");
  2154. this.goodsLis = [];
  2155. this.getOrderList();
  2156. this.getDeptTaskType();
  2157. this.getTodayNum();
  2158. }
  2159. } else if (data.status == 100042) {
  2160. this.showPromptModal("创建", false, data.msg);
  2161. this.getPatient(this.tabSearchCont);
  2162. } else if (data.status == 1000033) {
  2163. //重复建单那策略
  2164. this.repeatMsg = data.msg;
  2165. this.showDelModal(
  2166. this.accompanyPostData,
  2167. "accompany2",
  2168. this.accompanyYuyue
  2169. );
  2170. } else {
  2171. this.showPromptModal("创建", false, data.msg);
  2172. }
  2173. });
  2174. })
  2175. }
  2176. }
  2177. hideAccompanyModal(e) {
  2178. console.log(e);
  2179. if (e === "x") {
  2180. //关闭
  2181. this.accompanyModal = false;
  2182. return;
  2183. }
  2184. this.accompanyPostData.workOrder.isAccompany = 0;
  2185. this.cancenlLoading = true;
  2186. if (this.accompanyType == "patient") {
  2187. //患者列表直接建单
  2188. this.newOrderTimeFun(this.accompanyPostData.workOrder.taskType.id, () => {
  2189. this.hidePatientOrder();
  2190. this.accompanyModal = false;
  2191. this.cancenlLoading = false;
  2192. }, () => {
  2193. this.mainService
  2194. .postCustom(
  2195. "api",
  2196. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  2197. this.accompanyPostData
  2198. )
  2199. .subscribe((data) => {
  2200. this.message.remove(this.jdFlagId);
  2201. this.hidePatientOrder();
  2202. this.accompanyModal = false;
  2203. this.cancenlLoading = false;
  2204. if (data.status == 200) {
  2205. if(this.currentDept.typeValue == 'recovery'){
  2206. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2207. this.showPromptModal("创建", true, "");
  2208. this.goodsLis = [];
  2209. this.getOrderList();
  2210. this.getDeptTaskType();
  2211. this.getTodayNum();
  2212. });
  2213. }else{
  2214. this.showPromptModal("创建", true, "");
  2215. this.goodsLis = [];
  2216. this.getOrderList();
  2217. this.getDeptTaskType();
  2218. this.getTodayNum();
  2219. }
  2220. } else if (data.status == 100042) {
  2221. this.showPromptModal("创建", false, data.msg);
  2222. this.getPatient(this.tabSearchCont);
  2223. } else if (data.status == 1000033) {
  2224. //重复建单那策略
  2225. this.repeatMsg = data.msg;
  2226. this.showDelModal(
  2227. this.accompanyPostData,
  2228. "accompany3",
  2229. this.accompanyYuyue
  2230. );
  2231. } else {
  2232. this.showPromptModal("创建", false, data.msg);
  2233. }
  2234. });
  2235. })
  2236. } else if (this.accompanyType == "patient-yy") {
  2237. //患者列表预约建单
  2238. this.newOrderTimeFun(this.accompanyPostData.workOrder.taskType.id, () => {
  2239. this.btnLoading3 = false;
  2240. this.accompanyModal = false;
  2241. this.cancenlLoading = false;
  2242. this.cancel();
  2243. }, () => {
  2244. this.mainService
  2245. .postCustom(
  2246. "api",
  2247. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  2248. this.accompanyPostData
  2249. )
  2250. .subscribe((data) => {
  2251. this.message.remove(this.jdFlagId);
  2252. this.btnLoading3 = false;
  2253. this.accompanyModal = false;
  2254. this.cancenlLoading = false;
  2255. this.cancel();
  2256. if (data.status == 200) {
  2257. if(this.currentDept.typeValue == 'recovery'){
  2258. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2259. this.showPromptModal("创建", true, "");
  2260. this.goodsLis = [];
  2261. this.getOrderList();
  2262. this.getDeptTaskType();
  2263. this.getTodayNum();
  2264. });
  2265. }else{
  2266. this.showPromptModal("创建", true, "");
  2267. this.goodsLis = [];
  2268. this.getOrderList();
  2269. this.getDeptTaskType();
  2270. this.getTodayNum();
  2271. }
  2272. } else if (data.status == 100042) {
  2273. this.showPromptModal("创建", false, data.msg);
  2274. this.getPatient(this.tabSearchCont);
  2275. } else if (data.status == 1000033) {
  2276. //重复建单那策略
  2277. this.repeatMsg = data.msg;
  2278. this.showDelModal(
  2279. this.accompanyPostData,
  2280. "accompany4",
  2281. this.accompanyYuyue
  2282. );
  2283. } else {
  2284. this.showPromptModal("创建", false, data.msg);
  2285. }
  2286. });
  2287. })
  2288. }
  2289. }
  2290. // 切换患者送检检查项目
  2291. checkedShowMsg: any = {}; //患者送检检查项目对应展示信息
  2292. current_allowUrgent = false; //当前任务类型是否允许加急
  2293. currentTasktype; //当前选中的任务类型对象
  2294. cLoading = false;
  2295. historyCustomRemarks2 = [];
  2296. changeCheckedType() {
  2297. this.workOrderRemark2 = "";
  2298. this.customRemarks2 = [];
  2299. this.historyCustomRemarks2 = [];
  2300. this.isYyInspect = false;
  2301. this.linkCheckLisTrue = false;
  2302. this.clickYYFlag = false;
  2303. this.clickYYZyFlag = false;
  2304. this.currentTasktype = this.checkTypeLis.find(
  2305. (item) => item.id == this.patientForm.controls.checkedType.value
  2306. );
  2307. // 获取患者其他服务,护士端是否预约建单
  2308. let appointmentZyBuildFlag = this.checkTypeLis.filter(
  2309. (item) =>
  2310. item.id == this.patientForm.controls.checkedType.value &&
  2311. item.associationType.value == "patientTransport"
  2312. );
  2313. if (appointmentZyBuildFlag.length) {
  2314. this.appointmentZyBuildFlag =
  2315. appointmentZyBuildFlag[0].appointmentOtherSwitch == 1 ? "1" : "0";
  2316. console.log(this.appointmentZyBuildFlag, "seimin");
  2317. this.yyDateZy = new Date();
  2318. this.yyTimeZy = new Date();
  2319. let end = this.getLgNumber(this.yyTimeZy.getMinutes(), this.inspectAndPatientTransportConfig.timeMod);
  2320. this.yyTimeZy.setMinutes(end);
  2321. if(end === 0){
  2322. this.yyTimeZy.setHours(this.yyTimeZy.getHours() + 1);
  2323. }
  2324. } else {
  2325. this.appointmentBuildFlag =
  2326. this.currentTasktype.appointmentSwitch == 1 ? "1" : "0";
  2327. console.log(this.appointmentBuildFlag, "seimin");
  2328. }
  2329. console.log(this.patientForm.controls.checkedType.value, this.checkTypeLis);
  2330. this.current_allowUrgent =
  2331. this.checkTypeLis.find(
  2332. (item) => item.id == this.patientForm.controls.checkedType.value
  2333. ).allowUrgent == 1
  2334. ? true
  2335. : false;
  2336. // 判断这个任务类型是否允许加急 start
  2337. // 判断这个任务类型是否允许加急 end
  2338. let that = this;
  2339. let postData = {
  2340. taskTypeId: that.patientForm.controls.checkedType.value,
  2341. patientCode: that.patientMsg.patientCode,
  2342. };
  2343. this.cLoading = true;
  2344. that.mainService
  2345. .postCustom("nurse", "workOrder/buildTrip", postData)
  2346. .subscribe((data) => {
  2347. this.cLoading = false;
  2348. this.message.remove(this.maskFlag);
  2349. this.maskFlag = false;
  2350. this.patientModal = true;
  2351. that.checkedShowMsg = data;
  2352. if (that.checkedShowMsg.status != 200) {
  2353. that.isRemand = data.isRemand == 1 ? true : false;
  2354. }
  2355. that.goodsLis = [];
  2356. that.allowUrgent = "0"; //加急
  2357. that.urgentReason = ""; //加急原因
  2358. if (data.goods && data.goods.length) {
  2359. data.goods.forEach((e) => {
  2360. that.goodsLis.push({
  2361. label: e.name,
  2362. value: e["id"],
  2363. checked: false,
  2364. });
  2365. });
  2366. }
  2367. // 工单备注配置 start
  2368. that.isRemarks = data.remarksSwitch == 1;
  2369. if (data.remarksSwitch == 1) {
  2370. if (data.customRemarks === null || data.customRemarks === "") {
  2371. that.customRemarks2 = [];
  2372. } else {
  2373. that.customRemarks2 = data.customRemarks.split("$");
  2374. }
  2375. that.workOrderRemarkTips2 =
  2376. data.remarksPrompts || "请填写工单备注,不超过100个字符";
  2377. // let user = JSON.parse(localStorage.getItem("user"));
  2378. // that.mainService
  2379. // .postCustom("nurse", "workOrder/recentRemarks", {
  2380. // deptId: user.user.dept.id,
  2381. // taskTypeId: that.patientForm.controls.checkedType.value,
  2382. // })
  2383. // .subscribe((result) => {
  2384. // if (result.state == 200) {
  2385. // that.historyCustomRemarks2 = result.data;
  2386. // }
  2387. // });
  2388. }
  2389. // 工单备注配置 end
  2390. that.linkCheckLis = [];
  2391. if (data.status == 200 && data.data && data.data.length) {
  2392. let arr = [];
  2393. data.data.forEach((e) => {
  2394. arr.push({
  2395. execDeptId: e.execDept.id,
  2396. yyTime: e.yyTime,
  2397. priority: e.priority,
  2398. label:
  2399. (e.yyTime || "") +
  2400. " " +
  2401. (this.deptDisplay == 2
  2402. ? e.execDept.deptalias
  2403. : e.execDept.dept) +
  2404. " 进行 " +
  2405. (e.inspectName || "检查"),
  2406. value: e["id"],
  2407. checked: false,
  2408. });
  2409. });
  2410. that.linkCheckLis = arr;
  2411. }
  2412. });
  2413. }
  2414. // 需要预约建单-事件
  2415. yyInspectChange(e) {
  2416. if (this.currentTasktype.associationType.value === "inspect") {
  2417. //陪检
  2418. let obj = this.filterLinkCheckLis.find((item) => {
  2419. return (
  2420. new Date(item.yyTime).getTime() - new Date().getTime() >
  2421. this.leadTime * 60 * 1000
  2422. );
  2423. });
  2424. if (obj) {
  2425. this.showDateTime();
  2426. } else {
  2427. this.yyTime = null;
  2428. this.yyDate = new Date();
  2429. console.log(this.isYyInspect);
  2430. }
  2431. } else {
  2432. //转运
  2433. this.yyTimeZy = null;
  2434. this.yyDateZy = new Date();
  2435. }
  2436. }
  2437. //回显时间日期
  2438. showDateTime() {
  2439. //当前时间要大于生效时间
  2440. let isYyInspect = this.filterLinkCheckLis.every((item) => {
  2441. return (
  2442. new Date(item.yyTime).getTime() - new Date().getTime() >
  2443. this.leadTime * 60 * 1000
  2444. );
  2445. });
  2446. //如果勾选需要预约检查
  2447. if (isYyInspect) {
  2448. //筛选离当前时间最近的
  2449. let timeList = this.filterLinkCheckLis
  2450. .map((item) => new Date(item.yyTime).getTime())
  2451. .sort();
  2452. this.yyTime = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约时间,需要减去生效时间
  2453. this.yyDate = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约日期,需要减去生效时间
  2454. this.yyDateChange(this.yyTime);
  2455. } else {
  2456. this.yyTime = null;
  2457. this.yyDate = null;
  2458. }
  2459. }
  2460. // 患者送检检查项目-选择检查项目
  2461. linkCheckLisTrue = false; //是否有已选择(患者)
  2462. isInspectPriority = false; //选择的检查是否紧急(患者)
  2463. filterLinkCheckLis = []; //有预约时间并且选中的
  2464. isInspects = false; //勾选检车的时候是否多个检查多个检查科室
  2465. linkCheckLisChange(e) {
  2466. let flag = false; //检查是否紧急
  2467. let arr = []; //选中的索引
  2468. // 是否检查生成工单允许多个科室,1是,0否
  2469. if (this.currentTasktype.isMoreDept === 0) {
  2470. let arr = e.map((item) => item.execDeptId);
  2471. arr = Array.from(new Set(arr));
  2472. this.isInspects = arr.length > 1;
  2473. }
  2474. this.linkCheckLis.forEach((item, index) => {
  2475. if (e.length) {
  2476. //有选中的检查
  2477. e.forEach((v) => {
  2478. //检查是否有紧急度
  2479. if (v.priority == 1) {
  2480. flag = true;
  2481. }
  2482. //选中的检查设置checked
  2483. if (v.value == item.value) {
  2484. arr.push(index);
  2485. }
  2486. });
  2487. } else {
  2488. item.checked = false;
  2489. }
  2490. });
  2491. this.linkCheckLis.forEach((item, index) => {
  2492. item.checked = arr.includes(index);
  2493. });
  2494. console.log(e, this.linkCheckLis);
  2495. //检查有紧急度,则加急
  2496. if (flag) {
  2497. this.allowUrgent = "1";
  2498. this.urgentReason = "系统根据检查信息,自动进行加急";
  2499. } else {
  2500. this.allowUrgent = "0";
  2501. this.urgentReason = "";
  2502. }
  2503. this.clickYYFlag = false;
  2504. // 有预约时间并且选中的
  2505. this.filterLinkCheckLis = this.linkCheckLis.filter(
  2506. (item) => Boolean(item.yyTime) && item.checked
  2507. );
  2508. //有预约时间并且选中的检查数组不为空,并且预约建单的开关开启
  2509. if (this.filterLinkCheckLis.length && this.appointmentBuildFlag == "1") {
  2510. //当前时间要大于生效时间
  2511. this.isYyInspect = this.filterLinkCheckLis.every((item) => {
  2512. return (
  2513. new Date(item.yyTime).getTime() - new Date().getTime() >
  2514. this.leadTime * 60 * 1000
  2515. );
  2516. });
  2517. this.allowUrgentChange(this.allowUrgent);
  2518. if (this.allowUrgent == 0) {
  2519. //不加急状态下,回显时间
  2520. this.showDateTime();
  2521. }
  2522. } else {
  2523. //有预约时间并且选中的检查数组为空
  2524. this.isYyInspect = false;
  2525. this.yyTime = null;
  2526. this.yyDate = null;
  2527. }
  2528. this.linkCheckLisTrue = e.length > 0;
  2529. this.isInspectPriority = e.some((item) => item.priority == 1);
  2530. }
  2531. // 是否加急
  2532. allowUrgentChange(e) {
  2533. // this.urgentReasonValidator = (control: FormControl): { [s: string]: boolean } => {
  2534. // if (e == 1) {
  2535. // return { required: true };
  2536. // }
  2537. // };
  2538. if (e == 0) {
  2539. this.patientForm.get("urgentReason")!.clearValidators();
  2540. this.patientForm.get("urgentReason")!.markAsPristine();
  2541. } else {
  2542. this.patientForm.get("urgentReason")!.setValidators(Validators.required);
  2543. this.patientForm.get("urgentReason")!.markAsDirty();
  2544. }
  2545. this.patientForm.get("urgentReason")!.updateValueAndValidity();
  2546. if (this.isYyInspect) {
  2547. this.isYyInspect = e == 0;
  2548. if (!this.isYyInspect) {
  2549. this.yyDate = null;
  2550. this.yyDateZy = null;
  2551. this.yyTime = null;
  2552. this.yyTimeZy = null;
  2553. }
  2554. } else {
  2555. this.yyDate = null;
  2556. this.yyDateZy = null;
  2557. this.yyTime = null;
  2558. this.yyTimeZy = null;
  2559. }
  2560. }
  2561. // 禁用小时
  2562. disabledHours = (): number[] => {
  2563. let now = new Date();
  2564. let nHour = now.getHours();
  2565. let nMinute = now.getMinutes();
  2566. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  2567. return range(0, nHour + 1);
  2568. } else {
  2569. return range(0, nHour);
  2570. }
  2571. }
  2572. // 禁用分钟
  2573. disabledMinutes = (hour: number): number[] => {
  2574. let now = new Date();
  2575. let nHour = now.getHours();
  2576. let nMinute = now.getMinutes();
  2577. if (hour === nHour || hour === undefined) {
  2578. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  2579. } else {
  2580. return [];
  2581. }
  2582. }
  2583. // start和end之间能被n整除的所有数字集合
  2584. integralDivision(start:number, end:number, n:number): number[]{
  2585. let arr = [];
  2586. for(let i = start; i <= end; i++){
  2587. if(i % n === 0){
  2588. arr.push(i);
  2589. }
  2590. }
  2591. return arr;
  2592. }
  2593. // 快捷一键发起建单
  2594. shortcutMsg; //一键发起信息
  2595. buildMsg: any = {}; //一键发起返回信息
  2596. buildType: string = ""; //快捷建单类型
  2597. historyCustomRemarks = []; //历史快捷输入
  2598. // 打开一键发起建单模态框
  2599. newShortcutOrder(msg, type) {
  2600. this.workOrderRemark = "";
  2601. this.customRemarks = [];
  2602. this.historyCustomRemarks = [];
  2603. console.log(msg, type);
  2604. this.buildType = type;
  2605. this.shortcutMsg = msg;
  2606. this.initForm();
  2607. this.buildMsg = {};
  2608. let postData = {
  2609. taskTypeId: msg.id,
  2610. };
  2611. this.nLoading = true;
  2612. this.mainService
  2613. .postCustom("nurse", "workOrder/buildTrip", postData)
  2614. .subscribe((result) => {
  2615. this.buildMsg = result;
  2616. if (result.remarksSwitch == 1) {
  2617. if (result.customRemarks === null || result.customRemarks === "") {
  2618. this.customRemarks = [];
  2619. } else {
  2620. this.customRemarks = result.customRemarks.split("$");
  2621. }
  2622. this.workOrderRemarkTips =
  2623. result.remarksPrompts || "请填写工单备注,不超过100个字符";
  2624. let user = JSON.parse(localStorage.getItem("user"));
  2625. this.mainService
  2626. .postCustom("nurse", "workOrder/recentRemarks", {
  2627. deptId: user.user.dept.id,
  2628. taskTypeId: msg.id,
  2629. })
  2630. .subscribe((result1) => {
  2631. this.nLoading = false;
  2632. if (result1.state == 200) {
  2633. this.historyCustomRemarks = result1.data;
  2634. }
  2635. });
  2636. } else {
  2637. this.nLoading = false;
  2638. }
  2639. });
  2640. }
  2641. shortcutForm: FormGroup; //一键发起建单表单
  2642. bxForm: FormGroup; //报修表单
  2643. // 一键建单校验
  2644. // 起点科室校验
  2645. originOfficeShortCutValidator = (
  2646. control: FormControl
  2647. ): { [s: string]: boolean } => {
  2648. if (
  2649. this.shortcutForm &&
  2650. this.shortcutForm.value &&
  2651. !control.value &&
  2652. (this.buildMsg.status == 100013 || this.buildMsg.status == 100015)
  2653. ) {
  2654. return { required: true };
  2655. }
  2656. };
  2657. // 目标科室校验
  2658. targetOfficeShortCutValidator = (
  2659. control: FormControl
  2660. ): { [s: string]: boolean } => {
  2661. if (
  2662. this.shortcutForm &&
  2663. this.shortcutForm.value &&
  2664. !control.value &&
  2665. (this.buildMsg.status == 100014 || this.buildMsg.status == 100015)
  2666. ) {
  2667. return { required: true };
  2668. }
  2669. };
  2670. // 修改工号
  2671. userAccount = null;
  2672. changeAccount(e){
  2673. this.userAccount =this.accountList.find(v => v.id == e);
  2674. }
  2675. // 一键发起建单保存
  2676. loading5 = false;
  2677. confirmShortcut() {
  2678. var that = this;
  2679. for (const i in that.shortcutForm.controls) {
  2680. that.shortcutForm.controls[i].markAsDirty();
  2681. that.shortcutForm.controls[i].updateValueAndValidity();
  2682. }
  2683. console.log(that.shortcutForm);
  2684. if (that.shortcutForm.invalid) return;
  2685. that.loading5 = true;
  2686. let postData;
  2687. that.buildType = "other";
  2688. if (that.buildType == "other") {
  2689. if(this.buildMsg.reserveUserSwitch == 1 && !this.userAccount){
  2690. this.message.info('请选择工号!');
  2691. this.loading5 = false;
  2692. return;
  2693. }
  2694. // 其他
  2695. postData = {
  2696. workOrder: {
  2697. sourceId: SourceId.hushi,
  2698. workOrderRemark: this.userAccount ? `${this.userAccount.account}-${this.userAccount.name}:${this.workOrderRemark}` : this.workOrderRemark,
  2699. taskType: { id: that.shortcutMsg.id },
  2700. createDept: that.loginUserDeptId,
  2701. startDept: { id: that.buildMsg.startDept },
  2702. endDepts: [{ id: that.buildMsg.endDept }],
  2703. },
  2704. };
  2705. if (
  2706. (that.buildMsg.status == 100013 || that.buildMsg.status == 100015) &&
  2707. that.shortcutForm.value.originOffice
  2708. ) {
  2709. postData.workOrder.startDept.id = that.shortcutForm.value.originOffice;
  2710. }
  2711. if (that.shortcutForm.value.targetOffice) {
  2712. postData.workOrder["endDepts"] = [
  2713. { id: that.shortcutForm.value.targetOffice },
  2714. ];
  2715. } else {
  2716. postData.workOrder["endDepts"] = [
  2717. { id: that.buildMsg.end.end.list[0].id },
  2718. ];
  2719. }
  2720. }
  2721. console.log(postData);
  2722. this.newOrderTimeFun(postData.workOrder.taskType.id, () => {
  2723. that.loading5 = false;
  2724. }, () => {
  2725. that.mainService
  2726. .postCustom("api", this.shortcutMsg.reserveSwitch == 1 && this.currentDept.typeValue != 'recovery' && this.currentDept.typeValue != 'surgery' ? "reserveOrder" :"startOrder", postData)
  2727. .subscribe((data) => {
  2728. this.message.remove(this.jdFlagId);
  2729. that.loading5 = false;
  2730. if (data.status == 200 && that.buildType == "other") {
  2731. that.showPromptModal("创建", true, "", "other");
  2732. this.getTodayNum();
  2733. } else if (data.status == 200 && that.buildType == "bb") {
  2734. that.showPromptModal("创建", true, "", "bb");
  2735. this.getTodayNum();
  2736. } else if (that.buildType == "bb" && data.status == 100043) {
  2737. that.showPromptModal("创建", true, data.msg);
  2738. this.getTodayNum();
  2739. } else if (data.status == 1000033) {
  2740. //重复建单那策略
  2741. this.repeatMsg = data.msg;
  2742. this.showDelModal(postData, "other");
  2743. } else {
  2744. that.showPromptModal("创建", false, data.msg);
  2745. }
  2746. });
  2747. })
  2748. }
  2749. // ======================start===============================
  2750. // 快捷一键发起建单
  2751. shortcutModal: boolean = false; //检查信息一键建单模态框
  2752. shortcutMsg1; //一键发起信息
  2753. buildMsg1: any = {}; //一键发起返回信息
  2754. urgentFlag = false;
  2755. bLoading = false; //收取标本的loading
  2756. // 打开一键发起建单模态框,urgent为true的时候是紧急
  2757. historyCustomRemarks1 = [];
  2758. newShortcutOrder1(msg, type, urgent?) {
  2759. this.workOrderRemark1 = "";
  2760. this.customRemarks1 = [];
  2761. this.historyCustomRemarks1 = [];
  2762. console.log(msg, type);
  2763. this.urgentFlag = Boolean(urgent);
  2764. this.buildType = type;
  2765. this.shortcutMsg1 = msg;
  2766. this.initForm();
  2767. this.buildMsg1 = {};
  2768. let postData = {
  2769. taskTypeId: msg.id,
  2770. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  2771. };
  2772. this.bLoading = true;
  2773. this.mainService
  2774. .postCustom("nurse", "workOrder/buildTrip", postData)
  2775. .subscribe((result) => {
  2776. this.shortcutModal = true;
  2777. this.buildMsg1 = result;
  2778. if (result.remarksSwitch == 1) {
  2779. if (result.customRemarks === null || result.customRemarks === "") {
  2780. this.customRemarks1 = [];
  2781. } else {
  2782. this.customRemarks1 = result.customRemarks.split("$");
  2783. }
  2784. this.workOrderRemarkTips1 =
  2785. result.remarksPrompts || "请填写工单备注,不超过100个字符";
  2786. let user = JSON.parse(localStorage.getItem("user"));
  2787. this.mainService
  2788. .postCustom("nurse", "workOrder/recentRemarks", {
  2789. deptId: user.user.dept.id,
  2790. taskTypeId: msg.id,
  2791. })
  2792. .subscribe((result1) => {
  2793. this.bLoading = false;
  2794. if (result1.state == 200) {
  2795. this.historyCustomRemarks1 = result1.data;
  2796. }
  2797. });
  2798. } else {
  2799. this.bLoading = false;
  2800. }
  2801. });
  2802. }
  2803. hideShortcutOrder() {
  2804. this.shortcutModal = false;
  2805. }
  2806. shortcutForm1: FormGroup; //一键发起建单表单
  2807. // 一键建单校验
  2808. // 起点科室校验
  2809. originOfficeShortCutValidator1 = (
  2810. control: FormControl
  2811. ): { [s: string]: boolean } => {
  2812. if (
  2813. this.shortcutForm1 &&
  2814. this.shortcutForm1.value &&
  2815. !control.value &&
  2816. (this.buildMsg1.status == 100013 || this.buildMsg1.status == 100015)
  2817. ) {
  2818. return { required: true };
  2819. }
  2820. };
  2821. // 目标科室校验
  2822. targetOfficeShortCutValidator1 = (
  2823. control: FormControl
  2824. ): { [s: string]: boolean } => {
  2825. if (
  2826. this.shortcutForm1 &&
  2827. this.shortcutForm1.value &&
  2828. !control.value &&
  2829. (this.buildMsg1.status == 100014 || this.buildMsg1.status == 100015)
  2830. ) {
  2831. return { required: true };
  2832. }
  2833. };
  2834. // 建单判断时间-护士端建单通用方法
  2835. newOrderTimeFun(taskTypeId, fun1, fun2){
  2836. if(this.currentDept.typeValue != 'recovery' && this.currentDept.typeValue != 'surgery'){
  2837. let maskFlag = this.message.loading("正在加载中..", {
  2838. nzDuration: 0,
  2839. }).messageId;
  2840. this.mainService
  2841. .postCustom("api", "compareReserveDate", {taskTypeId})
  2842. .subscribe((data) => {
  2843. this.message.remove(maskFlag);
  2844. if(!data.data){
  2845. fun2.call(this);
  2846. }else{
  2847. fun1.call(this);
  2848. this.limitTimeModal = true;
  2849. this.limitTimeItem = {taskTypeId, fun1, fun2};
  2850. this.limitTimeInfo = data.data;
  2851. }
  2852. })
  2853. }else{
  2854. fun2.call(this);
  2855. }
  2856. }
  2857. limitTimeModal: boolean = false; //模态框
  2858. limitTimeInfo:string = '';
  2859. limitTimeItem: any = {};
  2860. hideLimitTimeModal() {
  2861. this.limitTimeModal = false;
  2862. }
  2863. // 确认
  2864. jdFlagId;
  2865. limitTimeLoading:boolean = false;
  2866. confirmLimitTime() {
  2867. console.log(this.limitTimeItem);
  2868. this.limitTimeModal = false;
  2869. this.jdFlagId = this.message.loading("正在加载中..", {
  2870. nzDuration: 0,
  2871. }).messageId;
  2872. this.limitTimeItem.fun2.call(this);
  2873. }
  2874. // 一键发起建单保存
  2875. confirmShortcut1() {
  2876. var that = this;
  2877. for (const i in that.shortcutForm1.controls) {
  2878. that.shortcutForm1.controls[i].markAsDirty();
  2879. that.shortcutForm1.controls[i].updateValueAndValidity();
  2880. }
  2881. console.log(that.shortcutForm1);
  2882. if (that.shortcutForm1.invalid) return;
  2883. that.btnLoading = true;
  2884. let postData;
  2885. if (that.buildType == "bb") {
  2886. // 标本
  2887. postData = {
  2888. urgent: this.urgentFlag ? 1 : 0,
  2889. workOrder: {
  2890. sourceId: SourceId.hushi,
  2891. workOrderRemark: this.workOrderRemark1,
  2892. taskType: { id: that.shortcutMsg1.id },
  2893. createDept: that.loginUserDeptId,
  2894. startDept: { id: that.loginUserDeptId },
  2895. },
  2896. };
  2897. }
  2898. console.log(postData);
  2899. this.newOrderTimeFun(postData.workOrder.taskType.id, () => {
  2900. this.hideShortcutOrder();
  2901. }, () => {
  2902. that.mainService
  2903. .postCustom("api", "startOrder", postData)
  2904. .subscribe((data) => {
  2905. this.message.remove(this.jdFlagId);
  2906. this.hideShortcutOrder();
  2907. console.log(that.buildType, data.status);
  2908. if (data.status == 200 && that.buildType == "other") {
  2909. that.showPromptModal("创建", true, "", "other");
  2910. this.getTodayNum();
  2911. } else if (data.status == 200 && that.buildType == "bb") {
  2912. that.showPromptModal("创建", true, "", "bb");
  2913. this.getTodayNum();
  2914. } else if (that.buildType == "bb" && data.status == 100043) {
  2915. that.showPromptModal("创建", true, data.msg);
  2916. this.getOrderList();
  2917. this.getSpecimenWorkOrderMsg();
  2918. this.getTodayNum();
  2919. } else if (data.status == 1000033) {
  2920. //重复建单那策略
  2921. this.repeatMsg = data.msg;
  2922. this.showDelModal(postData, "specimen");
  2923. } else {
  2924. that.showPromptModal("创建", false, data.msg);
  2925. }
  2926. });
  2927. });
  2928. }
  2929. repeatModal: boolean = false; //删除模态框
  2930. repeatMsg = "";
  2931. loadingRepeat = false;
  2932. repeatPostData;
  2933. sourceType;
  2934. isYuyue;
  2935. showDelModal(postData, sourceType, yuyue?) {
  2936. this.repeatModal = true;
  2937. this.repeatPostData = postData;
  2938. this.sourceType = sourceType;
  2939. this.isYuyue = yuyue ? yuyue : false;
  2940. }
  2941. hideRepeatModal() {
  2942. this.repeatModal = false;
  2943. this.btnLoading = false;
  2944. }
  2945. confirmRepeat() {
  2946. this.loadingRepeat = true;
  2947. this.repeatPostData.tipsCreateOder = 1;
  2948. this.newOrderTimeFun(this.repeatPostData.workOrder.taskType.id, () => {
  2949. this.loadingRepeat = false;
  2950. this.repeatModal = false;
  2951. }, () => {
  2952. this.mainService
  2953. .postCustom(
  2954. "api",
  2955. this.isYuyue ? "appointmentOrder" : "startOrder",
  2956. this.repeatPostData
  2957. )
  2958. .subscribe((data) => {
  2959. this.message.remove(this.jdFlagId);
  2960. this.loadingRepeat = false;
  2961. this.repeatModal = false;
  2962. if(this.currentDept.typeValue == 'recovery'){
  2963. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.repeatPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2964. this.confirmRepeatFun(data);
  2965. });
  2966. }else{
  2967. this.confirmRepeatFun(data);
  2968. }
  2969. });
  2970. })
  2971. }
  2972. confirmRepeatFun(data){
  2973. if (this.sourceType === "specimen") {
  2974. // 标本建单
  2975. if (data.status == 200 && this.buildType == "other") {
  2976. this.showPromptModal("创建", true, "", "other");
  2977. this.getTodayNum();
  2978. } else if (data.status == 200 && this.buildType == "bb") {
  2979. this.showPromptModal("创建", true, "", "bb");
  2980. this.getTodayNum();
  2981. } else if (this.buildType == "bb" && data.status == 100043) {
  2982. this.showPromptModal("创建", true, data.msg);
  2983. this.getOrderList();
  2984. this.getSpecimenWorkOrderMsg();
  2985. this.getTodayNum();
  2986. } else {
  2987. this.showPromptModal("创建", false, data.msg);
  2988. }
  2989. } else if (this.sourceType === "other") {
  2990. // 其他建单
  2991. if (data.status == 200 && this.buildType == "other") {
  2992. this.showPromptModal("创建", true, "", "other");
  2993. this.getTodayNum();
  2994. } else if (data.status == 200 && this.buildType == "bb") {
  2995. this.showPromptModal("创建", true, "", "bb");
  2996. this.getTodayNum();
  2997. } else if (this.buildType == "bb" && data.status == 100043) {
  2998. this.showPromptModal("创建", true, data.msg);
  2999. this.getTodayNum();
  3000. } else {
  3001. this.showPromptModal("创建", false, data.msg);
  3002. }
  3003. } else if (this.sourceType === "transport") {
  3004. // 转运
  3005. if (data.status == 200) {
  3006. this.showPromptModal("创建", true, "");
  3007. this.goodsLis = [];
  3008. this.getOrderList();
  3009. this.getDeptTaskType();
  3010. this.getTodayNum();
  3011. } else if (data.status == 100042) {
  3012. this.showPromptModal("创建", false, data.msg);
  3013. this.getPatient(this.tabSearchCont);
  3014. } else {
  3015. this.showPromptModal("创建", false, data.msg);
  3016. }
  3017. } else if (this.sourceType === "accompany1") {
  3018. // 陪检
  3019. if (data.status == 200) {
  3020. this.showPromptModal("创建", true, "");
  3021. this.goodsLis = [];
  3022. this.getOrderList();
  3023. this.getDeptTaskType();
  3024. this.getTodayNum();
  3025. } else if (data.status == 100042) {
  3026. this.showPromptModal("创建", false, data.msg);
  3027. this.getPatient(this.tabSearchCont);
  3028. } else {
  3029. this.showPromptModal("创建", false, data.msg);
  3030. }
  3031. } else if (this.sourceType === "accompany2") {
  3032. // 陪检
  3033. if (data.status == 200) {
  3034. this.showPromptModal("创建", true, "");
  3035. this.goodsLis = [];
  3036. this.getOrderList();
  3037. this.getDeptTaskType();
  3038. this.getTodayNum();
  3039. } else if (data.status == 100042) {
  3040. this.showPromptModal("创建", false, data.msg);
  3041. this.getPatient(this.tabSearchCont);
  3042. } else {
  3043. this.showPromptModal("创建", false, data.msg);
  3044. }
  3045. } else if (this.sourceType === "accompany3") {
  3046. // 陪检
  3047. if (data.status == 200) {
  3048. this.showPromptModal("创建", true, "");
  3049. this.goodsLis = [];
  3050. this.getOrderList();
  3051. this.getDeptTaskType();
  3052. this.getTodayNum();
  3053. } else if (data.status == 100042) {
  3054. this.showPromptModal("创建", false, data.msg);
  3055. this.getPatient(this.tabSearchCont);
  3056. } else {
  3057. this.showPromptModal("创建", false, data.msg);
  3058. }
  3059. } else if (this.sourceType === "accompany4") {
  3060. // 陪检
  3061. if (data.status == 200) {
  3062. this.showPromptModal("创建", true, "");
  3063. this.goodsLis = [];
  3064. this.getOrderList();
  3065. this.getDeptTaskType();
  3066. this.getTodayNum();
  3067. } else if (data.status == 100042) {
  3068. this.showPromptModal("创建", false, data.msg);
  3069. this.getPatient(this.tabSearchCont);
  3070. } else {
  3071. this.showPromptModal("创建", false, data.msg);
  3072. }
  3073. } else if (this.sourceType === "accompany5") {
  3074. // 陪检
  3075. if (data.status == 200) {
  3076. this.showPromptModal("创建", true, "");
  3077. this.goodsLis = [];
  3078. this.getOrderList();
  3079. this.getDeptTaskType();
  3080. this.getTodayNum();
  3081. } else if (data.status == 100042) {
  3082. this.showPromptModal("创建", false, data.msg);
  3083. this.getPatient(this.tabSearchCont);
  3084. } else {
  3085. this.showPromptModal("创建", false, data.msg);
  3086. }
  3087. }
  3088. }
  3089. // =======================end=================================
  3090. // 页面中间部分tab切换
  3091. checkedTableType: string = "other";
  3092. checkTable(type) {
  3093. this.checkedTableType = type;
  3094. if (type === "historySpecimen") {
  3095. this.getHistorySpecimen();
  3096. } else if (type === "historyDrugsbag") {
  3097. this.getHistoryDrugsbag();
  3098. } else if (type === "bxlb" && this.isShowBx && this.coopBtns.repairList) {
  3099. this.getBxlb();
  3100. this.getIncidentState();
  3101. this.getDegrees();
  3102. } else if (type === "kjbx" && this.isShowBx && this.coopBtns.quickReportForRepair) {
  3103. // this.getQuickBxlb();
  3104. this.getIncidentcategory();
  3105. // 获取报修的区域(所属院区)
  3106. // this.getArea();
  3107. // this.bxForm.controls.name.setValue(this.loginUser.name);
  3108. // this.bxForm.controls.phone.setValue(this.loginUser.phone);
  3109. // this.bxForm.controls.address.setValue(null);
  3110. this.bxForm.controls.content.setValue(null);
  3111. }
  3112. }
  3113. //提交报修
  3114. bxLoading = false;
  3115. submitBxForm() {
  3116. for (const i in this.bxForm.controls) {
  3117. this.bxForm.controls[i].markAsDirty();
  3118. this.bxForm.controls[i].updateValueAndValidity();
  3119. }
  3120. if (this.bxForm.invalid) return;
  3121. // if(!this.selectIncidentId){
  3122. // this.message.error("请选择故障现象!");
  3123. // return;
  3124. // }
  3125. this.bxLoading = true;
  3126. this.mainService.wxbx({}).subscribe((result) => {
  3127. if ((result as any).status == 200) {
  3128. let bxcode = (result as any).data; //生成微信报修号
  3129. let postData = {
  3130. verification: "true",
  3131. incident: {
  3132. branch:this.loginUser.currentHospital.id,
  3133. // contacts: this.loginUser.name,
  3134. deptId:this.loginUser.dept.id,
  3135. // contactsInformation: this.loginUser.phone,
  3136. // address: this.bxForm.controls.address.value,
  3137. // areaId: this.bxForm.controls.hospital.value,
  3138. // contacts: this.bxForm.controls.name.value,
  3139. // contactsInformation: this.bxForm.controls.phone.value,
  3140. description: this.bxForm.controls.content.value,
  3141. categoryId: this.selectIncidentId,
  3142. // placeId: this.bxForm.controls.building.value,
  3143. requester: { account: this.loginUser.account },
  3144. sourceType: "wechatUserIncident",
  3145. fileUrl: "url",
  3146. bxcode,
  3147. },
  3148. loginUser: {
  3149. account: this.loginUser.account,
  3150. id: this.loginUser.id,
  3151. },
  3152. };
  3153. this.mainService.addWxIncident(postData).subscribe((res) => {
  3154. this.bxLoading = false;
  3155. if ((res as any).state == 200) {
  3156. this.showPromptModal("提交", true, "");
  3157. this.checkTable("bxlb");
  3158. } else {
  3159. this.showPromptModal("提交", false, (res as any).msg);
  3160. }
  3161. });
  3162. } else {
  3163. this.bxLoading = false;
  3164. this.showPromptModal("提交", false, "");
  3165. }
  3166. });
  3167. }
  3168. // 意见箱表格数据
  3169. adviceList: any = [];
  3170. advicePageIndex: number = 1; //表格当前页码
  3171. advicePageSize: number = 10; //表格每页展示条数
  3172. adviceListLength: number = 10; //表格总数据量
  3173. adviceSearchInp: string = ""; //意见箱搜索
  3174. adviceLoading = false;
  3175. getAdvice() {
  3176. if(!this.coopBtns.suggestionBox){
  3177. return;
  3178. }
  3179. let that = this;
  3180. let postData = {
  3181. advice: {
  3182. content: that.adviceSearchInp || "",
  3183. creatDepartment: {
  3184. id: that.loginUserDeptId,
  3185. },
  3186. createUser: {
  3187. id: that.loginUser.id,
  3188. },
  3189. },
  3190. idx: that.advicePageIndex - 1 < 0 ? 0 : that.advicePageIndex - 1,
  3191. sum: that.advicePageSize,
  3192. };
  3193. this.adviceLoading = true;
  3194. that.mainService
  3195. .getFetchDataList("adviceCollection", "advice", postData)
  3196. .subscribe((data) => {
  3197. this.adviceLoading = false;
  3198. that.adviceList = data.list || [];
  3199. that.adviceListLength = data.totalNum || 0;
  3200. });
  3201. }
  3202. // 历史标本查询表格数据
  3203. historySpecimenList: any = [];
  3204. historySpecimenPageIndex: number = 1; //表格当前页码
  3205. historySpecimenPageSize: number = 10; //表格每页展示条数
  3206. historySpecimenListLength: number = 10; //表格总数据量
  3207. historySpecimenCodeSearchInp: string = ""; //标本编码搜索
  3208. historySpecimenParentSearchInp: string = ""; //患者信息搜索
  3209. hsLoading = false;
  3210. getHistorySpecimen(idx?) {
  3211. if (idx) {
  3212. this.historySpecimenPageIndex = 1;
  3213. }
  3214. let current = JSON.parse(localStorage.getItem("user"));
  3215. let postData = {
  3216. specimen: {
  3217. hosId: this.currentHospital.id,
  3218. sickRoom: {
  3219. id: current.user.dept.id,
  3220. },
  3221. scode:
  3222. this.historySpecimenCodeSearchInp === ""
  3223. ? null
  3224. : this.historySpecimenCodeSearchInp,
  3225. keyWord:
  3226. this.historySpecimenParentSearchInp === ""
  3227. ? null
  3228. : this.historySpecimenParentSearchInp,
  3229. },
  3230. idx: this.historySpecimenPageIndex - 1,
  3231. sum: this.historySpecimenPageSize,
  3232. };
  3233. this.hsLoading = true;
  3234. this.mainService
  3235. .getFetchDataList("simple/data", "specimen", postData)
  3236. .subscribe((data) => {
  3237. this.hsLoading = false;
  3238. this.historySpecimenList = data.list || [];
  3239. this.historySpecimenListLength = data.totalNum || 0;
  3240. });
  3241. }
  3242. // 历史药单查询表格数据
  3243. historyDrugsbagList: any = [];
  3244. historyDrugsbagPageIndex: number = 1; //表格当前页码
  3245. historyDrugsbagPageSize: number = 10; //表格每页展示条数
  3246. historyDrugsbagListLength: number = 10; //表格总数据量
  3247. historyDrugsbagCodeSearchInp: string = ""; //发药单号搜索
  3248. // historyDrugsbagParentSearchInp: string = ""; //患者信息搜索
  3249. hsDLoading = false;
  3250. getHistoryDrugsbag(idx?) {
  3251. if (idx) {
  3252. this.historyDrugsbagPageIndex = 1;
  3253. }
  3254. let current = JSON.parse(localStorage.getItem("user"));
  3255. let postData = {
  3256. drugsBag: {
  3257. target: {
  3258. id: current.user.dept.id,
  3259. },
  3260. packid:
  3261. this.historyDrugsbagCodeSearchInp === ""
  3262. ? ""
  3263. : this.historyDrugsbagCodeSearchInp,
  3264. platform: 2,
  3265. },
  3266. idx: this.historyDrugsbagPageIndex - 1,
  3267. sum: this.historyDrugsbagPageSize,
  3268. };
  3269. this.hsDLoading = true;
  3270. this.mainService
  3271. .getFetchDataList("api", "drugsBag", postData)
  3272. .subscribe((data) => {
  3273. this.hsDLoading = false;
  3274. this.historyDrugsbagList = data.list || [];
  3275. this.historyDrugsbagListLength = data.totalNum || 0;
  3276. });
  3277. }
  3278. // 报修列表查询表格数据
  3279. bxlbList: any = [];
  3280. bxlbPageIndex: number = 1; //表格当前页码
  3281. bxlbPageSize: number = 10; //表格每页展示条数
  3282. bxlbListLength: number = 10; //表格总数据量
  3283. bxlbCodeSearchInp: string = ""; //标本编码搜索
  3284. bxlbParentSearchInp: string = ""; //患者信息搜索
  3285. processing: number = 0; //处理中的数量
  3286. bxlbLoading = false;
  3287. getBxlb(idx?) {
  3288. if (idx) {
  3289. this.bxlbPageIndex = 1;
  3290. }
  3291. let current = JSON.parse(localStorage.getItem("user"));
  3292. this.bxlbLoading = true;
  3293. this.mainService
  3294. .listWxIncident({
  3295. deptId: current.user.dept.id,
  3296. // assignee: current.user.account,
  3297. state: this.incidentStateId?parseInt(this.incidentStateId):undefined,
  3298. idx: this.bxlbPageIndex - 1,
  3299. sum: this.bxlbPageSize,
  3300. })
  3301. .subscribe((data: any) => {
  3302. this.bxlbLoading = false;
  3303. this.bxlbList = data.data || [];
  3304. this.bxlbListLength = data.resultCount || 0;
  3305. this.processing = data.resultCount || 0;
  3306. });
  3307. }
  3308. //快速报修列表
  3309. quickBxlbLoading = false;
  3310. quickBxlbList = [];
  3311. getQuickBxlb() {
  3312. this.quickBxlbLoading = true;
  3313. this.mainService
  3314. .fetchListBx("incidentCategoryContent", { idx: 0, sum: 10 })
  3315. .subscribe((data: any) => {
  3316. this.quickBxlbLoading = false;
  3317. if (data.status == 200) {
  3318. this.quickBxlbList = data.list || [];
  3319. }
  3320. });
  3321. }
  3322. // 意见箱-查看模态框
  3323. adviceModal: boolean = false;
  3324. adviceDetailInfo: any = {}; //意见详情
  3325. adviceDetail(id) {
  3326. this.adviceModal = true;
  3327. this.mainService
  3328. .getFetchData("adviceCollection", "advice", id)
  3329. .subscribe((data) => {
  3330. this.adviceDetailInfo = data.data;
  3331. console.log(this.adviceDetailInfo);
  3332. });
  3333. }
  3334. hideAdvice() {
  3335. this.adviceModal = false;
  3336. }
  3337. // 意见收集
  3338. adviceSubModal: boolean = false;
  3339. adviceSubContent: string; //填写意见内容
  3340. coopAdviceInfo: any = {}; //当前编辑意见详情
  3341. addAdvice(data?) {
  3342. let that = this;
  3343. that.adviceSubContent = "";
  3344. if (data) {
  3345. that.coopAdviceInfo = data;
  3346. that.adviceSubContent = data.content;
  3347. }
  3348. that.adviceSubModal = true;
  3349. }
  3350. hideSubAdvice() {
  3351. this.adviceSubModal = false;
  3352. }
  3353. // 提交意见内容
  3354. confirmSubAdvice() {
  3355. let that = this;
  3356. if (!that.adviceSubContent) return;
  3357. that.btnLoading = true;
  3358. let postData = {
  3359. advice: {
  3360. creatDepartment: {
  3361. id: that.loginUserDeptId,
  3362. },
  3363. createUser: {
  3364. id: that.loginUser.id,
  3365. },
  3366. content: that.adviceSubContent,
  3367. },
  3368. };
  3369. if (that.coopAdviceInfo.id) {
  3370. postData.advice["id"] = that.coopAdviceInfo.id;
  3371. }
  3372. that.mainService
  3373. .postCustom(
  3374. "adviceCollection",
  3375. that.coopAdviceInfo.id ? "updData/advice" : "addData/advice",
  3376. postData
  3377. )
  3378. .subscribe((data) => {
  3379. if (data.status == 200) {
  3380. that.adviceSubModal = false;
  3381. that.showPromptModal(
  3382. that.coopAdviceInfo.id ? "编辑" : "新增",
  3383. true,
  3384. ""
  3385. );
  3386. that.coopAdviceInfo = {};
  3387. that.adviceSubContent = "";
  3388. that.getAdvice();
  3389. } else {
  3390. that.adviceSubModal = false;
  3391. that.showPromptModal(
  3392. that.coopAdviceInfo.id ? "编辑" : "新增",
  3393. false,
  3394. data.msg
  3395. );
  3396. that.adviceSubContent = "";
  3397. }
  3398. });
  3399. }
  3400. // 查看标本详情
  3401. detailModel: boolean = false;
  3402. loading33: boolean = false;
  3403. detailList: any = [];
  3404. // 选择急查或普查(1是急标,2是普标)
  3405. changeSpeDetail(speDetailType: number) {
  3406. this.detailModel = true;
  3407. let user = JSON.parse(localStorage.getItem("user"));
  3408. let postData = {
  3409. deptId: user.user.dept.id,
  3410. urgent: speDetailType,
  3411. };
  3412. this.loading33 = true;
  3413. this.mainService
  3414. .postCustom("nurse", "getSpecimenWorkOrderDetails", postData)
  3415. .subscribe((result) => {
  3416. this.loading33 = false;
  3417. if (result.status == 200) {
  3418. this.detailList = result.data || [];
  3419. }
  3420. });
  3421. }
  3422. // 隐藏查看标本详情弹层
  3423. hideSpeDetailModel() {
  3424. this.detailModel = false;
  3425. }
  3426. // 意见删除模态框
  3427. delAdviceModal: boolean = false;
  3428. delAdviceId: number; //删除意见id
  3429. delAdvice(id) {
  3430. this.delAdviceId = id;
  3431. this.delAdviceModal = true;
  3432. }
  3433. confirmDelAdvice() {
  3434. let that = this;
  3435. that.btnLoading = true;
  3436. let postData = [that.delAdviceId];
  3437. that.mainService
  3438. .postCustom("adviceCollection", "rmvData/advice", postData)
  3439. .subscribe((data) => {
  3440. if (data.status == 200) {
  3441. that.delAdviceModal = false;
  3442. that.showPromptModal("删除", true, "");
  3443. if (
  3444. that.adviceList.length == 1 &&
  3445. that.advicePageIndex ==
  3446. Math.ceil(that.adviceListLength / that.advicePageSize)
  3447. ) {
  3448. that.adviceListLength--;
  3449. that.advicePageIndex = Math.ceil(
  3450. that.adviceListLength / that.advicePageSize
  3451. );
  3452. }
  3453. that.getAdvice();
  3454. } else {
  3455. that.delAdviceModal = false;
  3456. that.showPromptModal("删除", false, data.msg);
  3457. }
  3458. });
  3459. }
  3460. hideDelAdviceModal() {
  3461. this.delAdviceModal = false;
  3462. }
  3463. // 工单列表下拉筛选
  3464. selectedType: null;
  3465. changeOrderSel(e) {
  3466. this.selectedType = e;
  3467. this.getOrderList();
  3468. }
  3469. // 工单列表工单状态下拉筛选
  3470. changeOrderState(e) {
  3471. this.getOrderList();
  3472. }
  3473. // 工单列表
  3474. orderList: any = [];
  3475. orderIdx: number = 1;
  3476. orderLength: number = 10;
  3477. OLoading: boolean = true;
  3478. getOrderList() {
  3479. let that = this;
  3480. that.orderList = [];
  3481. that.OLoading = true;
  3482. let postData: any = {
  3483. workOrder: {
  3484. createDept: JSON.parse(localStorage.getItem("user")).user.dept.id,
  3485. platform: 2,
  3486. searchDays: 2,
  3487. taskType: {},
  3488. },
  3489. idx: that.orderIdx - 1,
  3490. sum: 10,
  3491. };
  3492. if (that.selectedType && that.selectedType != -1) {
  3493. postData.workOrder.taskType["associationType"] = {
  3494. id: that.selectedType,
  3495. };
  3496. }
  3497. // 执行中包含状态:待抢单、待接单、待到达、待送达、执行中、定时预约
  3498. if (that.orderStateSelected == "1") {
  3499. //执行中
  3500. delete postData.workOrder.gdState;
  3501. postData.workOrder.nurseState = 1;
  3502. } else if (that.orderStateSelected == "2") {
  3503. //待评价
  3504. delete postData.workOrder.nurseState;
  3505. postData.workOrder.gdState = { id: "73" };
  3506. } else {
  3507. //全部
  3508. delete postData.workOrder.nurseState;
  3509. delete postData.workOrder.gdState;
  3510. }
  3511. that.mainService
  3512. .getFetchDataList("nurse", "workOrder", postData)
  3513. .subscribe((data) => {
  3514. that.orderList = data.list || [];
  3515. //显示三项
  3516. that.orderList.forEach((item) => {
  3517. if (item.record.length > 2) {
  3518. let i = item.record
  3519. .reverse()
  3520. .findIndex((step) => step.record.length > 0);
  3521. item.record.reverse();
  3522. i = item.record.length - 1 - i;
  3523. if (i < 2) {
  3524. item.record = item.record.slice(0, 3);
  3525. } else if (i > item.record.length - 2) {
  3526. item.record = item.record.slice(
  3527. item.record.length - 3,
  3528. item.record.length
  3529. );
  3530. } else {
  3531. item.record = item.record.slice(i - 1, i + 2);
  3532. }
  3533. }
  3534. });
  3535. that.orderLength = data.totalNum || 0;
  3536. that.OLoading = false;
  3537. });
  3538. }
  3539. // 撤销
  3540. coopId: number;
  3541. recallOrderModal: boolean = false;
  3542. // 打开撤销模态框
  3543. openRecallModal(id) {
  3544. this.coopId = id;
  3545. this.recallOrderModal = true;
  3546. }
  3547. // 确认撤销
  3548. confirmRec() {
  3549. let that = this;
  3550. that.btnLoading = true;
  3551. that.mainService.delOrder(that.coopId).subscribe((data) => {
  3552. that.closeRecallOrderModal();
  3553. if (data.status == 200) {
  3554. that.getOrderList();
  3555. that.changeInfo();
  3556. this.getTodayNum();
  3557. that.showPromptModal("撤销", true, "");
  3558. } else {
  3559. that.showPromptModal("撤销", false, data.msg);
  3560. }
  3561. });
  3562. }
  3563. // 关闭撤销模态框
  3564. closeRecallOrderModal() {
  3565. this.recallOrderModal = false;
  3566. }
  3567. // 评价
  3568. appraiseModal: boolean = false;
  3569. starNum: number = 5; //评价星
  3570. appraiseContent: string = ""; //评级
  3571. appraiseId: number;
  3572. showAppraise(id) {
  3573. this.appraiseId = id;
  3574. this.appraiseModal = true;
  3575. this.starNum = 5;
  3576. this.appraiseContent = "";
  3577. }
  3578. // 保存评价
  3579. confirmAppraise() {
  3580. console.log(this.starNum, this.appraiseContent);
  3581. let that = this;
  3582. if (!that.starNum) return;
  3583. that.btnLoading = true;
  3584. let id;
  3585. switch (that.starNum) {
  3586. case 1:
  3587. id = 358;
  3588. break;
  3589. case 2:
  3590. id = 357;
  3591. break;
  3592. case 3:
  3593. id = 356;
  3594. break;
  3595. case 4:
  3596. id = 355;
  3597. break;
  3598. case 5:
  3599. id = 354;
  3600. break;
  3601. }
  3602. let postData = {
  3603. serviceEvaluation: { id: id },
  3604. remark: that.appraiseContent,
  3605. };
  3606. this.mainService
  3607. .postCustom("nurse/workOrder", "evaluate/" + this.appraiseId, postData)
  3608. .subscribe((data) => {
  3609. that.hideAppraise();
  3610. if (data.status == 200) {
  3611. that.getOrderList();
  3612. that.showPromptModal("评价", true, "");
  3613. } else {
  3614. that.showPromptModal("评价", false, data.msg);
  3615. }
  3616. });
  3617. }
  3618. hideAppraise() {
  3619. this.appraiseModal = false;
  3620. }
  3621. // 报修评价
  3622. appraiseModalBx: boolean = false;
  3623. starNumBx: number = 5; //评价星
  3624. appraiseContentBx: string = ""; //评级
  3625. appraiseIdBx: number;
  3626. showAppraiseBx(id) {
  3627. this.appraiseIdBx = id;
  3628. this.appraiseModalBx = true;
  3629. this.starNumBx = 5;
  3630. this.appraiseContentBx = "";
  3631. }
  3632. // 保存评价
  3633. confirmAppraiseBx() {
  3634. console.log(this.starNumBx, this.appraiseContentBx);
  3635. if (!this.starNumBx) return;
  3636. this.btnLoading = true;
  3637. let id = this.degrees.find(v=>v.value == this.starNumBx).id;
  3638. let postData = {
  3639. degree: id,
  3640. degreeRemark: this.appraiseContentBx,
  3641. id: this.appraiseIdBx,
  3642. };
  3643. this.mainService
  3644. .degree(postData)
  3645. .subscribe((data:any) => {
  3646. this.hideAppraiseBx();
  3647. if (data.state == 200) {
  3648. this.getBxlb();
  3649. this.showPromptModal("评价", true, "");
  3650. } else {
  3651. this.showPromptModal("评价", false, "");
  3652. }
  3653. });
  3654. }
  3655. hideAppraiseBx() {
  3656. this.appraiseModalBx = false;
  3657. }
  3658. // 审核状态
  3659. checkStatusLis: any = [];
  3660. getCheckStatusLis() {
  3661. let that = this;
  3662. that.mainService.getDictionary("list", "check_status").subscribe((data) => {
  3663. that.checkStatusLis = data;
  3664. });
  3665. }
  3666. // 填写加急原因模态框
  3667. jiajiModal: boolean = false;
  3668. jiajiContent: string; //加急原因
  3669. jiajiId; //加急工单id
  3670. showJiaji(id) {
  3671. this.jiajiId = id;
  3672. this.jiajiModal = true;
  3673. this.jiajiContent = "";
  3674. }
  3675. hideJiaji() {
  3676. this.jiajiModal = false;
  3677. }
  3678. // 保存加急原因
  3679. confirmJiaji() {
  3680. let that = this;
  3681. let checkStatusId;
  3682. if (!that.jiajiContent) return;
  3683. that.btnLoading = true;
  3684. that.checkStatusLis.forEach((e) => {
  3685. if (e.value == 1) {
  3686. checkStatusId = e.id;
  3687. }
  3688. });
  3689. let postData = {
  3690. urgentDetails: {
  3691. workerOrder: that.jiajiId,
  3692. checkStatus: { id: checkStatusId },
  3693. urgentReason: that.jiajiContent,
  3694. },
  3695. };
  3696. that.mainService
  3697. .postCustom("workerOrder", "urge", postData)
  3698. .subscribe((data) => {
  3699. if (data.status == 200) {
  3700. that.showPromptModal("加急", true, "");
  3701. that.getOrderList();
  3702. that.hideJiaji();
  3703. } else {
  3704. that.showPromptModal("加急", false, data.msg);
  3705. }
  3706. });
  3707. }
  3708. // 查看工单详情
  3709. openDetails(data) {
  3710. if (data.taskType.associationType.value == 'specimen' || data.taskType.associationType.value == 'specimenPlan') {
  3711. // 标本类
  3712. this.router.navigateByUrl("nurse/detailSample/" + data.id);
  3713. } else if (data.taskType.associationType.value == 'inspect' || data.taskType.associationType.value == 'patientTransport') {
  3714. // 送患者
  3715. this.router.navigateByUrl("nurse/detailPatients/" + data.id);
  3716. } else if (data.taskType.associationType.value == 'drugsBag' || data.taskType.associationType.value == 'jPBag') {
  3717. // 药品配送/静配
  3718. this.router.navigateByUrl("nurse/detailDrug/" + data.id);
  3719. } else if (data.taskType.associationType.value == 'ordinary' && data.taskType.ordinaryField.value == 'blood') {
  3720. // 万能交接服务&&血制品
  3721. this.router.navigateByUrl("nurse/detailBlood/" + data.id);
  3722. } else {
  3723. // 其他
  3724. this.router.navigateByUrl("nurse/detailOthers/" + data.id);
  3725. }
  3726. }
  3727. // 派单
  3728. allotWorker(id, stateId) {
  3729. this.router.navigateByUrl("nurse/allotWorker/" + id + "/" + stateId);
  3730. }
  3731. // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
  3732. showPromptModal(con, success, promptInfo?, back?) {
  3733. this.btnLoading = false;
  3734. this.btnLoading1 = false;
  3735. this.promptModalShow = false;
  3736. this.promptContent = con;
  3737. this.ifSuccess = success;
  3738. this.promptInfo = promptInfo;
  3739. this.back = back;
  3740. setTimeout(() => {
  3741. this.promptModalShow = true;
  3742. }, 100);
  3743. }
  3744. // 回到系统管理
  3745. toMain() {
  3746. this.router.navigateByUrl("main");
  3747. }
  3748. // 查看工单
  3749. toOrder() {
  3750. this.router.navigateByUrl(`main/orderManagement`);
  3751. }
  3752. // 退出
  3753. logOut(): void {
  3754. let that = this;
  3755. // 假退出
  3756. localStorage.removeItem("user");
  3757. localStorage.removeItem("menu");
  3758. localStorage.removeItem("phones");
  3759. localStorage.removeItem("index");
  3760. that.router.navigateByUrl("login");
  3761. // 假退出
  3762. that.mainService.logOut().subscribe((data) => {
  3763. if (data.status == 200) {
  3764. localStorage.removeItem("user");
  3765. localStorage.removeItem("menu");
  3766. localStorage.removeItem("phones");
  3767. localStorage.removeItem("index");
  3768. that.router.navigateByUrl("login");
  3769. }
  3770. });
  3771. }
  3772. // 格式化时分秒
  3773. // (时间小于一分钟则显示秒,时间大于一分钟则显示分钟数,如超出一小时则显示小时和分钟。)time单位:秒
  3774. formatTime(time) {
  3775. let timeStr = "";
  3776. if (time >= 0 && time < 60) {
  3777. // 秒
  3778. timeStr = time + "秒";
  3779. } else if (time >= 60 && time < 3600) {
  3780. // 分钟
  3781. timeStr = Math.floor(time / 60) + "分钟";
  3782. } else if (time >= 3600) {
  3783. // 时 + 分
  3784. let h = "";
  3785. let m = "";
  3786. h = Math.floor(time / 3600) + "小时";
  3787. m = time % 3600 >= 60 ? Math.floor((time % 3600) / 60) + "分钟" : "";
  3788. timeStr = h + m;
  3789. }
  3790. return timeStr;
  3791. }
  3792. // 计算历史记录耗时
  3793. filterTime(step) {
  3794. let num = 0;
  3795. step.forEach((e) => {
  3796. num += e.difTime;
  3797. });
  3798. return this.formatTime(num / 1000);
  3799. }
  3800. // 截取意见内容(ie内核截取)
  3801. spliceContent(con) {
  3802. if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) {
  3803. return con.slice(0, 41) + "...";
  3804. } else {
  3805. return con;
  3806. }
  3807. }
  3808. @ViewChild("msgTemplate", { static: false }) msgTemplate: TemplateRef<any>; //消息通知模板
  3809. // 消息提醒
  3810. createBasicNotification(msgs): void {
  3811. this.notification.template(this.msgTemplate, {
  3812. nzDuration: 0,
  3813. nzData: msgs,
  3814. });
  3815. }
  3816. isShowNurseCode = false; //是否展开科室二维码
  3817. nurseCodeImg = ""; //图片
  3818. refreshQRCodeTime = 0; //刷新时间间隔
  3819. // 关闭科室二维码
  3820. closeNurseCode() {
  3821. this.isShowNurseCode = false;
  3822. clearInterval(this.timer);
  3823. this.timer = null;
  3824. }
  3825. // 展开科室二维码
  3826. timer = null;
  3827. showNurseCode() {
  3828. this.isShowNurseCode = true;
  3829. this.mainService.getDeptCode([this.loginUserDeptId]).subscribe((data) => {
  3830. if (data["status"] == 200) {
  3831. this.nurseCodeImg = data["data"][0].base64;
  3832. this.refreshQRCodeTime = data["data"][0].refreshQRCodeTime;
  3833. clearInterval(this.timer);
  3834. this.timer = setInterval(() => {
  3835. this.refreshQRCodeTime = Math.max(--this.refreshQRCodeTime, 0);
  3836. if (this.refreshQRCodeTime === 0) {
  3837. clearInterval(this.timer);
  3838. this.showNurseCode();
  3839. }
  3840. }, 1000);
  3841. }
  3842. });
  3843. }
  3844. // 右侧菜单
  3845. showLastItems: boolean = false;
  3846. // 下拉
  3847. fixedMenuXiala() {
  3848. this.showLastItems = true;
  3849. }
  3850. // 上拉
  3851. fixedMenuShangla() {
  3852. this.showLastItems = false;
  3853. }
  3854. mainRole: boolean = false; //回到系统管理权限
  3855. mainRoleBtnName = "回到系统管理"; //回到系统管理名字
  3856. initRole() {
  3857. let menus = JSON.parse(localStorage.getItem("menu"));
  3858. console.log("菜单数量" + menus.length);
  3859. if (menus.length >= 2) {
  3860. this.mainRole = true;
  3861. return;
  3862. }
  3863. }
  3864. // 切换右侧菜单Tab
  3865. fixedTab: string = "";
  3866. checkFixedTab(type: string) {
  3867. if (type == "toSystem") {
  3868. this.router.navigateByUrl("main");
  3869. }
  3870. if (this.fixedTab == type) {
  3871. this.fixedTab = "";
  3872. } else {
  3873. this.fixedTab = type;
  3874. }
  3875. }
  3876. //子传父接收
  3877. closeModelHs(e) {
  3878. this.hsPromptModalShow = JSON.parse(e).show;
  3879. this.changeShow = JSON.parse(e).changeShow;
  3880. }
  3881. //子传父接收
  3882. clearModelHs(e) {
  3883. if (JSON.parse(e).clear === true) {
  3884. clearInterval(this.timerCloseTime);
  3885. }
  3886. this.changeShow = JSON.parse(e).changeShow;
  3887. }
  3888. // 头部切换科室
  3889. changeKsNow() {
  3890. this.hsPromptModalShow = true;
  3891. clearInterval(this.timerCloseTime);
  3892. this.changeShow = false;
  3893. }
  3894. }