hushijiandan.component.ts 92 KB

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