hushijiandan.component.ts 108 KB

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