hushijiandan.component.ts 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286
  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 { WebsocketService } from "../../services/websocket.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 { format, getMinutes, setMinutes, setSeconds, addDays } from "date-fns";
  25. // 日期禁用
  26. function range(start: number, end: number): number[] {
  27. const result: number[] = [];
  28. for (let i = start; i < end; i++) {
  29. result.push(i);
  30. }
  31. return result;
  32. }
  33. @Component({
  34. selector: "app-hushijiandan",
  35. templateUrl: "./hushijiandan.component.html",
  36. styleUrls: ["./hushijiandan.component.less"],
  37. })
  38. export class HushijiandanComponent implements OnInit {
  39. @ViewChild("remarksEle", { static: false }) remarksEle: ElementRef;
  40. @ViewChild("osComponentRef1", {
  41. read: OverlayScrollbarsComponent,
  42. static: false,
  43. })
  44. osComponentRef1: OverlayScrollbarsComponent;
  45. @ViewChild("osComponentRef2", {
  46. read: OverlayScrollbarsComponent,
  47. static: false,
  48. })
  49. osComponentRef2: OverlayScrollbarsComponent;
  50. @ViewChild("osComponentRef3", {
  51. read: OverlayScrollbarsComponent,
  52. static: false,
  53. })
  54. osComponentRef3: OverlayScrollbarsComponent;
  55. @ViewChild("osComponentRef4", {
  56. read: OverlayScrollbarsComponent,
  57. static: false,
  58. })
  59. osComponentRef4: OverlayScrollbarsComponent;
  60. @ViewChild("osComponentRef6", {
  61. read: OverlayScrollbarsComponent,
  62. static: false,
  63. })
  64. osComponentRef6: OverlayScrollbarsComponent;
  65. @ViewChild("osComponentRef7", {
  66. read: OverlayScrollbarsComponent,
  67. static: false,
  68. })
  69. osComponentRef7: OverlayScrollbarsComponent;
  70. @ViewChild("osComponentRef8", {
  71. read: OverlayScrollbarsComponent,
  72. static: false,
  73. })
  74. osComponentRef8: OverlayScrollbarsComponent;
  75. @ViewChild("osComponentRef9", {
  76. read: OverlayScrollbarsComponent,
  77. static: false,
  78. })
  79. osComponentRef9: OverlayScrollbarsComponent;
  80. othersListOptions: any;
  81. sortableTimer = null;
  82. searchTabInpSubject = new Subject(); //左侧查患者信息和检查信息防抖
  83. otherSearchChangeSubject = new Subject(); //其他建单搜索防抖
  84. timeDefaultValue = setSeconds(new Date(), 0);
  85. constructor(
  86. private message: NzMessageService,
  87. private fb: FormBuilder,
  88. public router: Router,
  89. private mainService: MainService,
  90. private msg: NzMessageService,
  91. private notification: NzNotificationService,
  92. private webs: WebsocketService,
  93. private tool: ToolService
  94. ) {
  95. this.othersListOptions = {
  96. onUpdate: (event: any) => {
  97. // 触发一次排序
  98. clearTimeout(this.sortableTimer);
  99. this.sortableTimer = setTimeout(() => {
  100. let postData = {
  101. orders: [],
  102. };
  103. postData.orders = this.othersList.map((item, i) => {
  104. return {
  105. id: item.id,
  106. orders: i,
  107. };
  108. });
  109. this.mainService.sortTaskType(postData).subscribe((result) => {});
  110. }, 500);
  111. },
  112. };
  113. }
  114. // 关闭倒计时
  115. closeTime = 3;
  116. timerCloseTime = null;
  117. changeShow = true;
  118. currentHospital; //当前院区
  119. logTimer = null; //综合日志定时器
  120. logTime = 0; //综合日志自动刷新秒数
  121. logTimeConst = 30; //综合日志自动刷新秒数
  122. ngOnInit() {
  123. //防抖
  124. this.searchTabInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  125. this.getPatient(v);
  126. });
  127. this.otherSearchChangeSubject.pipe(debounceTime(500)).subscribe((v) => {
  128. this.getDeptTaskType(v);
  129. });
  130. this.currentHospital = this.tool.getCurrentHospital();
  131. this.changeKs();
  132. this.initLogin();
  133. this.getDeptTaskType();
  134. this.initForm();
  135. this.getAdvice();
  136. this.getHistorySpecimen();
  137. this.getOrderSelectList();
  138. this.getCheckStatusLis();
  139. this.refreshSpecimenWorkOrderMsg();
  140. this.initRole();
  141. this.getWebsocket();
  142. this.listDeptOrderRecord();
  143. this.logTime = this.logTimeConst;
  144. clearInterval(this.logTimer);
  145. this.logTimer = setInterval(() => {
  146. this.logTime--;
  147. if (this.logTime === 0) {
  148. this.logTime = this.logTimeConst;
  149. this.listDeptOrderRecord();
  150. }
  151. }, 1000);
  152. }
  153. ngOnDestroy() {
  154. console.log("关闭护士端", this.webs.ws);
  155. clearInterval(this.moveId);
  156. clearInterval(this.moveId1);
  157. clearInterval(this.msgTimerId);
  158. clearInterval(this.logTimer);
  159. this.webs.closeWs();
  160. }
  161. loginUser: any = localStorage.getItem("user")
  162. ? JSON.parse(localStorage.getItem("user")).user
  163. : null; //登录人信息
  164. loginUserDeptId: number = JSON.parse(localStorage.getItem("user")).user.dept
  165. .id; //登录人所属科室
  166. appointmentBuildFlag = "0"; //是否开启护士端预约建单-患者陪检
  167. appointmentZyBuildFlag = "0"; //是否开启护士端预约建单-患者其他
  168. leadTime = 0; //护士端预约建单生效时长
  169. followFlag = "0"; //是否开启护士端终点关注
  170. promptContent: string; //操作提示框提示信息
  171. ifSuccess: boolean; //操作成功/失败
  172. promptInfo: string; //操作结果提示信息
  173. back: string; //操作结果后回调标识
  174. promptModalShow: boolean; //操作提示框是否展示
  175. hsPromptModalShow: boolean = true; //护士端科室切换提示框是否展示
  176. deptTaskTypeRules: any = {}; //当前登录科室任务类型信息规则
  177. orderSelectList: any = []; //工单列表筛选选项
  178. orderSelected = "-1"; //工单列表下拉框选中
  179. orderStateSelected = "1"; //工单列表工单状态下拉框选中
  180. tabSearchCont: string = ""; //左侧tab搜索框内容
  181. pLoading: boolean = true; //患者信息loading
  182. patientList: any = []; //左侧tab患者信息list
  183. infoPageIdx: number = 1; //左侧tab页码
  184. infoLength: number = 5; //左侧tab信息总数
  185. specimenWorkOrderMsg: any = {}; //急标普标数量&信息
  186. jpDrugsWKOMsg: any = {}; //药品静配提示信息
  187. btnLoading: boolean = false; //确认按钮loading状态
  188. workOrderRemark = ""; //备注
  189. workOrderRemarkTips = ""; //备注提示
  190. customRemarks = []; //备注快速输入
  191. // 添加备注
  192. addRemarks(item) {
  193. this.remarksEle.nativeElement.focus();
  194. this.workOrderRemark += item;
  195. }
  196. //获取综合日志
  197. rLoading = false;
  198. listDeptOrderRecords: any = [];
  199. listDeptOrderRecord() {
  200. this.rLoading = true;
  201. this.mainService
  202. .listDeptOrderRecord({ deptId: this.loginUserDeptId })
  203. .subscribe((result) => {
  204. this.rLoading = false;
  205. if (result["status"] == 200) {
  206. this.listDeptOrderRecords = result["data"].slice(0, 15);
  207. }
  208. });
  209. }
  210. // 查看标本历史记录
  211. historyPromptModalShow = false; //标本历史记录弹窗开关
  212. scode = ""; //查看历史记录携带
  213. viewSpecimenHistory(data) {
  214. this.scode = data.scode;
  215. this.historyPromptModalShow = true;
  216. }
  217. // 关闭标本历史记录弹窗
  218. closeModelHistory(e) {
  219. this.historyPromptModalShow = JSON.parse(e).show;
  220. }
  221. // 护士端患者信息列表,鼠标移入姓名展示最近一条检查信息
  222. recentInfo = "";
  223. recentInfoTimer = null;
  224. recentInfoNum = 0;
  225. isRemand = true; //自动送回
  226. yyTime = null; //预约时间-患者列表
  227. yyTimeInspect = null; //预约时间-检查列表
  228. yyTimeZy = null; //预约时间-患者列表-患者其他服务
  229. getRecentInfo(patientCode) {
  230. this.recentInfo = "";
  231. clearTimeout(this.recentInfoTimer);
  232. this.recentInfoTimer = setTimeout(() => {
  233. this.recentInfoNum++;
  234. this.mainService.getRecentInfo({ patientCode }).subscribe((result) => {
  235. this.recentInfoNum--;
  236. if (result["status"] == 200 && this.recentInfoNum === 0) {
  237. this.recentInfo = result["data"]["info"];
  238. } else {
  239. this.recentInfo = "";
  240. }
  241. });
  242. }, 500);
  243. }
  244. // 获取患者陪检任务类型(只有一个)的信息
  245. getTaskTypeByInspection() {
  246. const list = {
  247. idx: 0,
  248. sum: 1,
  249. taskType: {
  250. hosIds: this.currentHospital.id + "",
  251. associationType: {
  252. id: 260,
  253. },
  254. },
  255. };
  256. return this.mainService.getFetchDataList("configuration", "taskType", list);
  257. }
  258. // 关闭其他建单保存结果
  259. closeModel(e) {
  260. console.log(e);
  261. if (e === "other") {
  262. this.getDeptTaskType("", "clear");
  263. this.getOrderList();
  264. this.getSpecimenWorkOrderMsg();
  265. } else if (e === "bb") {
  266. this.getOrderList();
  267. this.getSpecimenWorkOrderMsg();
  268. }
  269. }
  270. // 其他建单
  271. selectOtherId; //选中的id
  272. otherSearch = ""; //搜索的关键词
  273. oLoading = false;
  274. nLoading = false;
  275. otherClick(item) {
  276. console.log(item);
  277. this.selectOtherId = item.id;
  278. this.newShortcutOrder(item, "other");
  279. }
  280. //搜索
  281. otherNum = 0;
  282. otherSearchChange() {
  283. this.otherSearchChangeSubject.next(this.otherSearch);
  284. }
  285. // 切换科室
  286. changeKs() {
  287. this.hsPromptModalShow = true;
  288. this.closeTime = 3;
  289. clearInterval(this.timerCloseTime);
  290. this.timerCloseTime = setInterval(() => {
  291. this.closeTime = Math.max(--this.closeTime, -1);
  292. if (this.closeTime === -1) {
  293. this.hsPromptModalShow = false;
  294. clearInterval(this.timerCloseTime);
  295. }
  296. }, 1000);
  297. }
  298. // 判断登录是否已失效
  299. initLogin() {
  300. let that = this;
  301. if (!localStorage.getItem("user")) {
  302. that.msg.error("您的登录已失效,请重新登录!", {
  303. nzDuration: 3000,
  304. });
  305. setTimeout(() => {
  306. that.router.navigateByUrl("login");
  307. }, 2000);
  308. return;
  309. }
  310. }
  311. // 连接websocket
  312. getWebsocket() {
  313. let that = this;
  314. this.webs
  315. .connectWs(http.nurseWs, { userCount: that.loginUser.account })
  316. .subscribe((data) => {
  317. if (data && data.content) {
  318. that.createBasicNotification(data);
  319. }
  320. });
  321. }
  322. // 每隔一分钟刷新标本信息
  323. msgTimerId: any;
  324. refreshSpecimenWorkOrderMsg() {
  325. this.msgTimerId = setInterval(() => {
  326. this.getSpecimenWorkOrderMsg();
  327. }, 60000);
  328. }
  329. // 工单列表筛选
  330. getOrderSelectList() {
  331. let that = this;
  332. that.mainService
  333. .getDictionary("list", "association_types")
  334. .subscribe((data) => {
  335. that.orderSelectList = data || [];
  336. });
  337. }
  338. // 急标普标数量
  339. getSpecimenWorkOrderMsg() {
  340. let that = this;
  341. that.mainService
  342. .postCustom("nurse", "getSpecimenWorkOrderMsg", {
  343. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  344. })
  345. .subscribe((data) => {
  346. that.specimenWorkOrderMsg = data;
  347. });
  348. }
  349. // 药品静配提示信息
  350. drugJpLoading = true;
  351. getJpDrugsWKOMsg() {
  352. let that = this;
  353. that.mainService
  354. .postCustom("nurse", "getJpDrugsWKOMsg", {})
  355. .subscribe((data) => {
  356. this.drugJpLoading = false;
  357. that.jpDrugsWKOMsg = data.data ? data.data : {};
  358. console.log(that.jpDrugsWKOMsg);
  359. if (
  360. that.jpDrugsWKOMsg.drugsInfoList &&
  361. that.jpDrugsWKOMsg.drugsInfoList.length
  362. ) {
  363. that.startSwiper(that.jpDrugsWKOMsg.drugsInfoList.length);
  364. }
  365. if (
  366. that.jpDrugsWKOMsg.jpInfoList &&
  367. that.jpDrugsWKOMsg.jpInfoList.length
  368. ) {
  369. that.startSwiper1(that.jpDrugsWKOMsg.jpInfoList.length);
  370. }
  371. });
  372. }
  373. // swiper 轮播图
  374. swiperTop: number = 0;
  375. moveId: any;
  376. index: number = 0;
  377. startSwiper(length) {
  378. let that = this;
  379. clearInterval(that.moveId);
  380. setInterval(() => {
  381. that.index++;
  382. clearInterval(that.moveId);
  383. that.moveId = setInterval(() => {
  384. if (that.swiperTop > -44 * that.index) {
  385. that.swiperTop--;
  386. }
  387. if (that.swiperTop <= length * -44) {
  388. that.swiperTop = 0;
  389. that.index = 0;
  390. clearInterval(that.moveId);
  391. }
  392. }, 20);
  393. }, 2000);
  394. }
  395. swiperTop1: number = 0;
  396. moveId1: any;
  397. index1: number = 0;
  398. startSwiper1(length) {
  399. let that = this;
  400. clearInterval(that.moveId1);
  401. setInterval(() => {
  402. that.index1++;
  403. clearInterval(that.moveId1);
  404. that.moveId1 = setInterval(() => {
  405. if (that.swiperTop1 > -44 * that.index1) {
  406. that.swiperTop1--;
  407. }
  408. if (that.swiperTop1 <= length * -44) {
  409. that.swiperTop1 = 0;
  410. that.index1 = 0;
  411. clearInterval(that.moveId1);
  412. }
  413. }, 20);
  414. }, 2000);
  415. }
  416. // 关注患者
  417. follow(data) {
  418. this.showCommonModal(
  419. data,
  420. data.focusPatient === 0
  421. ? "您将设置患者【" +
  422. data.patientName +
  423. "】为重点关注,后期此患者的相关检查将会自动建单通知支助中心"
  424. : "您将取消设置患者【" +
  425. data.patientName +
  426. "】为重点关注,后期此患者的相关检查将不会自动建单通知支助中心"
  427. );
  428. }
  429. // 通用提示模态框
  430. commonModal: boolean = false; //模态框
  431. loading4 = false;
  432. tipsMsg1: string; //提示框信息
  433. coop: any; //当前操作列
  434. showCommonModal(data: any, tipsMsg1: string) {
  435. this.commonModal = true;
  436. this.coop = data;
  437. this.tipsMsg1 = tipsMsg1;
  438. }
  439. // 隐藏模态框
  440. hideCommonModal() {
  441. this.commonModal = false;
  442. }
  443. // 确认
  444. confirmCommon() {
  445. this.commonModal = false;
  446. let postData = {
  447. patient: {
  448. id: this.coop.id,
  449. focusPatient: this.coop.focusPatient === 0 ? 1 : 0,
  450. },
  451. };
  452. this.loading4 = true;
  453. this.mainService.changeFollow(postData).subscribe(
  454. (result) => {
  455. this.loading4 = false;
  456. if (result["status"] == 200) {
  457. this.showPromptModal(
  458. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  459. true,
  460. ""
  461. );
  462. this.getPatient(this.tabSearchCont);
  463. } else {
  464. this.showPromptModal(
  465. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  466. false,
  467. ""
  468. );
  469. }
  470. },
  471. (err) => {
  472. this.loading4 = false;
  473. this.showPromptModal("操作", false, "");
  474. }
  475. );
  476. }
  477. // 获取当前登录人科室任务类型信息
  478. othersList: any = []; // 其他一键建单列表
  479. bbMsg: any = {}; //标本一键建单
  480. patientMsgList: any = []; // 患者转运,患者陪检一键建单
  481. tabFlag = true; //页面初始化获取一次患者陪检的任务类型信息
  482. allowUrgentFlag = false; //检查列表的患者陪检类型是否允许加急
  483. getDeptTaskType(search?, clear?) {
  484. let that = this;
  485. this.otherNum++;
  486. this.oLoading = true;
  487. let postData = {
  488. deptId: that.loginUserDeptId,
  489. };
  490. if (search !== undefined) {
  491. postData["taskName"] = search;
  492. }
  493. that.mainService
  494. .postCustom("nurse", "getDeptTaskType", postData)
  495. .subscribe((data) => {
  496. this.otherNum--;
  497. if (this.otherNum === 0) {
  498. this.oLoading = false;
  499. }
  500. if (search === undefined) {
  501. that.deptTaskTypeRules = data.data;
  502. that.getOrderList();
  503. if (that.deptTaskTypeRules.openInspection) {
  504. // 陪检权限
  505. if (this.tabFlag) {
  506. this.tabFlag = false;
  507. this.getTaskTypeByInspection().subscribe((result) => {
  508. console.log(result);
  509. if (result.list && result.list.length > 0) {
  510. this.appointmentBuildFlag =
  511. result.list[0].appointmentSwitch + ""; //是否开启护士端预约建单
  512. this.leadTime = result.list[0].appointmentTime; //是否开启护士端预约建单
  513. this.followFlag = result.list[0].focusSwitch + ""; //是否开启护士端终点关注
  514. this.allowUrgentFlag =
  515. result.list[0].allowUrgent == 1 ? true : false; //是否允许加急(检查列表)
  516. } else {
  517. this.appointmentBuildFlag = "0"; //是否开启护士端预约建单
  518. this.leadTime = 0; //是否开启护士端预约建单
  519. this.followFlag = "0"; //是否开启护士端终点关注
  520. this.allowUrgentFlag = false; //是否允许加急(检查列表)
  521. }
  522. this.pLoading = true;
  523. that.getPatient();
  524. });
  525. } else {
  526. that.getPatient();
  527. }
  528. }
  529. if (that.deptTaskTypeRules.openSpecimen) {
  530. // 标本权限
  531. that.getSpecimenWorkOrderMsg();
  532. }
  533. if (
  534. that.deptTaskTypeRules.openStaticDistribution ||
  535. that.deptTaskTypeRules.openDrugsBag
  536. ) {
  537. // 药品静配权限
  538. that.getJpDrugsWKOMsg();
  539. }
  540. }
  541. if (data.data.allTaskTypes) {
  542. that.othersList = [];
  543. that.patientMsgList = [];
  544. data.data.allTaskTypes.forEach((e) => {
  545. if (e.associationType.id == 259) {
  546. that.othersList.push(e);
  547. } else if (e.associationType.id == 256) {
  548. that.bbMsg = e;
  549. } else if (
  550. e.associationType.id == 255 ||
  551. e.associationType.id == 260
  552. ) {
  553. that.patientMsgList.push(e);
  554. }
  555. });
  556. if (clear === "clear") {
  557. this.otherSearch = "";
  558. this.workOrderRemark = "";
  559. this.customRemarks = [];
  560. this.historyCustomRemarks = [];
  561. this.selectOtherId = that.othersList.length
  562. ? that.othersList[0].id
  563. : null;
  564. let obj = that.othersList.find(
  565. (item) => item.id == this.selectOtherId
  566. );
  567. obj && this.otherClick(obj);
  568. }
  569. console.log(this.selectOtherId);
  570. if (!this.selectOtherId) {
  571. if (that.othersList.length) {
  572. this.selectOtherId = that.othersList[0].id;
  573. let obj = that.othersList.find(
  574. (item) => item.id == this.selectOtherId
  575. );
  576. obj && this.otherClick(obj);
  577. } else {
  578. this.selectOtherId = null;
  579. }
  580. }
  581. }
  582. });
  583. }
  584. // 目标科室输入搜索
  585. searchDept(type, msg, e) {
  586. this.getDeptList(type, msg, e);
  587. }
  588. // 获取科室
  589. getDeptList(type, msg, key?): void {
  590. // 返回值的status是201 则是默认发起科室
  591. // 返回值的status是202 则是固定科室范围
  592. // 返回值的status是203 则是固定科室
  593. // 返回值的status是204 则是自主填写
  594. // 返回值的status是205 则是固定科室类型
  595. if (
  596. (type == "start" && msg.start.start.departmentStrategy == 202) ||
  597. (type == "target" && msg.end.end.departmentStrategy == 202)
  598. ) {
  599. return; //固定科室范围禁用搜索
  600. }
  601. let postData = {
  602. idx: 0,
  603. sum: 50,
  604. department: {
  605. searchType: 1,
  606. },
  607. };
  608. if (key) {
  609. postData.department["keyWord"] = key;
  610. }
  611. if (type == "start" && msg.start.start.departmentStrategy == 205) {
  612. postData.department["type"] = { id: msg.start.start.startTypeId };
  613. } else if (type == "target" && msg.end.end.departmentStrategy == 205) {
  614. postData.department["type"] = { id: msg.end.end.endTypeId };
  615. }
  616. if (type == "start") {
  617. postData.department["ids"] = msg.start.deptIds || "";
  618. } else if (type == "target") {
  619. postData.department["ids"] = msg.end.deptIds || "";
  620. }
  621. this.mainService
  622. .getFetchDataList("data", "department", postData)
  623. .subscribe((data) => {
  624. if (type == "target") {
  625. msg.end.end.list = data.list;
  626. } else if (type == "start") {
  627. msg.start.start.list = data.list;
  628. }
  629. });
  630. }
  631. // 切换左侧tab
  632. changeInfo() {
  633. if (!this.deptTaskTypeRules.openInspection) return;
  634. this.infoPageIdx = 1;
  635. this.getPatient();
  636. }
  637. // 获取患者信息
  638. snum = 0;
  639. getPatient(e?) {
  640. let that = this;
  641. that.pLoading = true;
  642. let postData = {
  643. idx: that.infoPageIdx - 1,
  644. sum: 9999,
  645. };
  646. // 患者信息
  647. postData["patient"] = {
  648. keyWord: e ? e : that.tabSearchCont,
  649. };
  650. postData["patient"]["department"] = { id: that.loginUserDeptId };
  651. this.snum++;
  652. that.mainService
  653. .getFetchDataList("nurse", "patient", postData)
  654. .subscribe((data) => {
  655. this.snum--;
  656. if (data.list.length > 0) {
  657. data.list.forEach((item) => {
  658. if (item.focusPatient === undefined) {
  659. item.focusPatient = 0;
  660. }
  661. });
  662. }
  663. that.patientList = data.list || [];
  664. if (this.snum === 0) {
  665. that.pLoading = false;
  666. }
  667. that.infoLength = data.totalNum || 0;
  668. });
  669. }
  670. // tab输入搜索节流阀
  671. searchTabInp(e) {
  672. if (!this.deptTaskTypeRules.openInspection) return;
  673. this.searchTabInpSubject.next(e);
  674. }
  675. // 一键建单确认弹框
  676. confirmSub: boolean = false;
  677. confirmPostData: any = {}; //确认提交数据
  678. confirmYuyue: boolean = false; //确认预约
  679. confirmInfo: string = "";
  680. btnLoading3 = false;
  681. confirm() {
  682. if (this.confirmYuyue) {
  683. this.confirmPostData.workOrder.yyTime =
  684. format(new Date(this.yyTime), "yyyy-MM-dd HH:mm") + ":00";
  685. }
  686. //是否需要医护陪同检查
  687. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  688. //特级护理或一级护理
  689. if (
  690. this.patientMsg.careLevel.value === "0" ||
  691. this.patientMsg.careLevel.value === "1"
  692. ) {
  693. this.btnLoading = false;
  694. this.btnLoading1 = false;
  695. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  696. return;
  697. }
  698. }
  699. if (this.patientMsg.illnessState && this.currentTasktype.isAccompany == 1) {
  700. //病危或病重
  701. if (
  702. this.patientMsg.illnessState.value === "2" ||
  703. this.patientMsg.illnessState.value === "3"
  704. ) {
  705. this.btnLoading = false;
  706. this.btnLoading1 = false;
  707. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  708. return;
  709. }
  710. }
  711. this.btnLoading3 = true;
  712. this.confirmPostData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  713. this.mainService
  714. .postCustom(
  715. "api",
  716. this.confirmYuyue ? "appointmentOrder" : "startOrder",
  717. this.confirmPostData
  718. )
  719. .subscribe((data) => {
  720. this.btnLoading3 = false;
  721. this.cancel();
  722. if (data.status == 200) {
  723. this.showPromptModal("创建", true, "");
  724. this.goodsLis = [];
  725. this.getOrderList();
  726. this.getDeptTaskType();
  727. } else {
  728. this.showPromptModal("创建", false, data.msg);
  729. }
  730. });
  731. }
  732. cancel() {
  733. this.confirmSub = false;
  734. this.confirmPostData = {};
  735. this.confirmYuyue = false;
  736. this.btnLoading = false;
  737. }
  738. patientForm: FormGroup; //患者信息一键建单表单
  739. //患者送检检查项目
  740. checkTypeLis: any = [];
  741. // 患者信息一键建单关联检查
  742. linkCheckLis: any = [];
  743. goodsLis: any = []; //携带设备
  744. allowUrgent: any = "0"; //加急
  745. urgentReason: any = ""; //加急原因
  746. // 初始化form表单
  747. initForm() {
  748. // 初始化患者信息一键建单表单
  749. this.patientForm = this.fb.group({
  750. checkedType: [null, [Validators.required]],
  751. goods: [null],
  752. linkCheck: [null, []],
  753. targetOffice: [null, [this.targetOfficeValidator]],
  754. originOffice: [null, [this.originOfficeValidator]],
  755. allowUrgent: [null], //加急
  756. urgentReason: [null], //加急原因
  757. });
  758. // 初始化一键发起建单表单
  759. this.shortcutForm = this.fb.group({
  760. targetOffice: [null, [this.targetOfficeShortCutValidator]],
  761. originOffice: [null, [this.originOfficeShortCutValidator]],
  762. });
  763. // 初始化一键发起建单表单
  764. this.shortcutForm1 = this.fb.group({
  765. targetOffice: [null, [this.targetOfficeShortCutValidator1]],
  766. originOffice: [null, [this.originOfficeShortCutValidator1]],
  767. });
  768. }
  769. //创建自定义校验规则dateValidator,用于复选框组校验时调用。
  770. // 起点科室校验
  771. originOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  772. if (
  773. this.patientForm &&
  774. this.patientForm.value &&
  775. this.checkedShowMsg.status != 200 &&
  776. !control.value &&
  777. (this.checkedShowMsg.status == 100015 ||
  778. this.checkedShowMsg.status == 100013)
  779. ) {
  780. return { required: true };
  781. }
  782. };
  783. // 目标科室校验
  784. targetOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  785. if (
  786. this.patientForm &&
  787. this.patientForm.value &&
  788. this.checkedShowMsg.status != 200 &&
  789. !control.value &&
  790. (this.checkedShowMsg.status == 100015 ||
  791. this.checkedShowMsg.status == 100014)
  792. ) {
  793. return { required: true };
  794. }
  795. };
  796. // 患者信息一键建单
  797. patientModal: boolean = false; //患者信息一键建单模态框
  798. patientMsg; //患者信息
  799. // 打开患者信息一键建单模态框
  800. maskFlag: any = false;
  801. newPatientOrder(msg) {
  802. this.yyTime = null;
  803. this.yyTimeZy = null;
  804. let that = this;
  805. that.initForm();
  806. that.checkedShowMsg = {};
  807. that.patientMsg = msg;
  808. this.maskFlag = this.message.loading("正在加载中..", {
  809. nzDuration: 0,
  810. }).messageId;
  811. that.mainService
  812. .postCustom("configuration", "deptTSPTaskType", {})
  813. .subscribe((data) => {
  814. that.checkTypeLis = data.data;
  815. // 默认选中患者陪检
  816. that.checkTypeLis.forEach((e) => {
  817. if (e.associationType.value == "inspect") {
  818. that.patientForm.controls.checkedType.setValue(e.id);
  819. that.patientForm.value.checkedType = e.id;
  820. }
  821. });
  822. this.changeCheckedType();
  823. });
  824. }
  825. yyTimeChange(e) {
  826. if (this.yyTime) {
  827. if (getMinutes(this.yyTime) != 30) {
  828. this.yyTime = setMinutes(this.yyTime, 0);
  829. }
  830. } else {
  831. this.nextDay = false;
  832. }
  833. this.clickYYFlag = false;
  834. }
  835. yyTimeZyChange(e) {
  836. if (this.yyTimeZy) {
  837. if (getMinutes(this.yyTimeZy) != 30) {
  838. this.yyTimeZy = setMinutes(this.yyTimeZy, 0);
  839. }
  840. } else {
  841. this.nextDayZy = false;
  842. }
  843. this.clickYYZyFlag = false;
  844. }
  845. hidePatientOrder() {
  846. this.patientModal = false;
  847. this.clickYYFlag = false;
  848. this.clickYYZyFlag = false;
  849. }
  850. // 次日-陪检
  851. nextDay = false;
  852. nextDayChange(e) {
  853. if (this.yyTime) {
  854. if (e) {
  855. this.yyTime = addDays(this.yyTime, 1);
  856. this.disabledHours = () => [];
  857. this.disabledMinutes = (hour) => [];
  858. } else {
  859. // this.yyTime = addDays(this.yyTime, -1);
  860. this.yyTime = null;
  861. this.disabledHours = () => {
  862. let now = new Date();
  863. let nHour = now.getHours();
  864. let nMinute = now.getMinutes();
  865. if (nMinute > 30) {
  866. return range(0, nHour + 1);
  867. } else {
  868. return range(0, nHour);
  869. }
  870. };
  871. this.disabledMinutes = (hour) => {
  872. let now = new Date();
  873. let nHour = now.getHours();
  874. let nMinute = now.getMinutes();
  875. if (hour === nHour || hour === undefined) {
  876. if (nMinute == 0) {
  877. return [];
  878. } else if (nMinute <= 30 && nMinute > 0) {
  879. return [0];
  880. } else {
  881. return [0, 30];
  882. }
  883. } else {
  884. return [];
  885. }
  886. };
  887. }
  888. }
  889. }
  890. // 次日-陪检
  891. nextDayZy = false;
  892. nextDayZyChange(e) {
  893. if (this.yyTimeZy) {
  894. if (e) {
  895. this.yyTimeZy = addDays(this.yyTimeZy, 1);
  896. this.disabledHours = () => [];
  897. this.disabledMinutes = (hour) => [];
  898. } else {
  899. console.log("狗血");
  900. // this.yyTimeZy = addDays(this.yyTimeZy, -1);
  901. this.yyTimeZy = null;
  902. this.disabledHours = () => {
  903. let now = new Date();
  904. let nHour = now.getHours();
  905. let nMinute = now.getMinutes();
  906. if (nMinute > 30) {
  907. return range(0, nHour + 1);
  908. } else {
  909. return range(0, nHour);
  910. }
  911. };
  912. this.disabledMinutes = (hour) => {
  913. let now = new Date();
  914. let nHour = now.getHours();
  915. let nMinute = now.getMinutes();
  916. if (hour === nHour || hour === undefined) {
  917. if (nMinute == 0) {
  918. return [];
  919. } else if (nMinute <= 30 && nMinute > 0) {
  920. return [0];
  921. } else {
  922. return [0, 30];
  923. }
  924. } else {
  925. return [];
  926. }
  927. };
  928. }
  929. }
  930. }
  931. // 预约建单
  932. btnLoading1 = false;
  933. confirmPatient1(type) {
  934. this.confirmPatient(type);
  935. }
  936. // 患者信息保存
  937. clickYYFlag = false; //是否点击预约建单-患者陪检
  938. clickYYZyFlag = false; //是否点击预约建单-患者其他
  939. confirmPatient(yuyue?) {
  940. if (yuyue === "patient-yuyue") {
  941. this.clickYYFlag = true;
  942. } else {
  943. this.clickYYFlag = false;
  944. }
  945. if (yuyue === "patient-zy-yuyue") {
  946. this.clickYYZyFlag = true;
  947. } else {
  948. this.clickYYZyFlag = false;
  949. }
  950. // 选项是患者转运
  951. let flag = this.checkTypeLis.some((item) => {
  952. return (
  953. item.id == this.patientForm.controls.checkedType.value &&
  954. item.associationType.id == 255
  955. );
  956. });
  957. //预约时间-患者陪检不能为空
  958. if (
  959. (!this.yyTime && !flag && yuyue) ||
  960. (!this.yyTimeZy && flag && yuyue === "patient-zy-yuyue")
  961. ) {
  962. return;
  963. }
  964. var that = this;
  965. for (const i in that.patientForm.controls) {
  966. that.patientForm.controls[i].markAsDirty();
  967. that.patientForm.controls[i].updateValueAndValidity();
  968. }
  969. if (that.patientForm.invalid) {
  970. return;
  971. }
  972. console.log(that.patientForm);
  973. if (yuyue) {
  974. this.confirmYuyue = true;
  975. this.btnLoading1 = true;
  976. } else {
  977. this.confirmYuyue = false;
  978. this.btnLoading = true;
  979. }
  980. let postData: any = {
  981. workOrder: {
  982. taskType: { id: that.patientForm.controls.checkedType.value },
  983. startDept: { id: that.checkedShowMsg.startDept },
  984. endDepts: [{ id: that.checkedShowMsg.endDept }],
  985. createDept: that.loginUserDeptId,
  986. patient: {
  987. patientCode: that.patientMsg.patientCode,
  988. },
  989. },
  990. };
  991. if (
  992. (that.checkedShowMsg.status == 100013 ||
  993. that.checkedShowMsg.status == 100015) &&
  994. that.patientForm.value.originOffice
  995. ) {
  996. postData.workOrder.startDept.id = that.patientForm.value.originOffice;
  997. }
  998. if (that.patientForm.value.targetOffice) {
  999. postData.workOrder["endDepts"] = [
  1000. { id: that.patientForm.value.targetOffice },
  1001. ];
  1002. } else if (flag) {
  1003. postData.workOrder["endDepts"] = [
  1004. { id: that.checkedShowMsg.end.end.list[0].id },
  1005. ];
  1006. }
  1007. let checkedArr = [];
  1008. let yy = false; //是否有预约时间
  1009. if (
  1010. that.patientForm.value.linkCheck &&
  1011. that.patientForm.value.linkCheck.length
  1012. ) {
  1013. that.patientForm.value.linkCheck.forEach((e) => {
  1014. if (e.checked) {
  1015. checkedArr.push({ id: e.value });
  1016. if (e.yyTime) {
  1017. yy = true;
  1018. }
  1019. }
  1020. });
  1021. }
  1022. // 携带设备
  1023. let goods = "";
  1024. if (that.patientForm.value.goods && that.patientForm.value.goods.length) {
  1025. that.patientForm.value.goods.forEach((e) => {
  1026. if (e.checked) {
  1027. goods += e.value + ",";
  1028. }
  1029. });
  1030. goods = goods.slice(0, goods.length - 1);
  1031. }
  1032. postData.workOrder["goods"] = goods;
  1033. if (!yuyue && that.current_allowUrgent && this.allowUrgent == 1) {
  1034. postData.workOrder["urgentDetails"] = {
  1035. checkStatus: { id: 329 },
  1036. urgentReason: that.urgentReason,
  1037. };
  1038. } else {
  1039. delete postData.workOrder["urgentDetails"];
  1040. }
  1041. if (
  1042. yy &&
  1043. that.checkedShowMsg.status == 200 &&
  1044. that.patientForm.value.linkCheck &&
  1045. checkedArr.length
  1046. ) {
  1047. // 有预约时间
  1048. postData.workOrder["checkList"] = checkedArr;
  1049. that.hidePatientOrder();
  1050. that.confirmSub = true;
  1051. that.confirmPostData = postData;
  1052. that.confirmInfo = "您确认建单吗?";
  1053. } else {
  1054. if (!yy && that.checkedShowMsg.status == 200) {
  1055. postData.workOrder["checkList"] = checkedArr;
  1056. } else {
  1057. delete postData.workOrder["checkList"];
  1058. // 添加预约时间
  1059. if (yuyue) {
  1060. postData.workOrder.yyTime =
  1061. format(new Date(this.yyTimeZy), "yyyy-MM-dd HH:mm") + ":00";
  1062. }
  1063. }
  1064. if (that.checkedShowMsg.status != 200) {
  1065. postData.workOrder["isRemand"] = this.isRemand ? 1 : 0;
  1066. }
  1067. //是否需要医护陪同检查
  1068. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  1069. //特级护理或一级护理
  1070. if (
  1071. this.patientMsg.careLevel.value === "0" ||
  1072. this.patientMsg.careLevel.value === "1"
  1073. ) {
  1074. this.btnLoading = false;
  1075. this.btnLoading1 = false;
  1076. this.accompany(postData, yuyue, "patient");
  1077. return;
  1078. }
  1079. }
  1080. if (
  1081. this.patientMsg.illnessState &&
  1082. this.currentTasktype.isAccompany == 1
  1083. ) {
  1084. //病危或病重
  1085. if (
  1086. this.patientMsg.illnessState.value === "2" ||
  1087. this.patientMsg.illnessState.value === "3"
  1088. ) {
  1089. this.btnLoading = false;
  1090. this.btnLoading1 = false;
  1091. this.accompany(postData, yuyue, "patient");
  1092. return;
  1093. }
  1094. }
  1095. postData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  1096. if (!yuyue) {
  1097. postData.workOrder.platform = 2;
  1098. }
  1099. that.mainService
  1100. .postCustom("api", yuyue ? "appointmentOrder" : "startOrder", postData)
  1101. .subscribe((data) => {
  1102. that.hidePatientOrder();
  1103. if (data.status == 200) {
  1104. that.showPromptModal("创建", true, "");
  1105. that.goodsLis = [];
  1106. that.getOrderList();
  1107. that.getDeptTaskType();
  1108. } else if (data.status == 100042) {
  1109. that.showPromptModal("创建", true, data.msg);
  1110. } else {
  1111. that.showPromptModal("创建", false, data.msg);
  1112. }
  1113. });
  1114. }
  1115. }
  1116. // 是否需要护士医生陪同模态框
  1117. accompanyModal: boolean = false;
  1118. accompanyLoading: boolean = false;
  1119. cancenlLoading: boolean = false;
  1120. accompanyPostData = null;
  1121. accompanyYuyue;
  1122. accompanyType = "";
  1123. accompany(postData, yuyue, type) {
  1124. this.accompanyModal = true;
  1125. this.accompanyPostData = postData;
  1126. this.accompanyYuyue = yuyue;
  1127. this.accompanyType = type;
  1128. }
  1129. confirmAccompany() {
  1130. this.accompanyPostData.workOrder.isAccompany = 1;
  1131. this.accompanyLoading = true;
  1132. if (this.accompanyType == "patient") {
  1133. //患者列表直接建单
  1134. this.mainService
  1135. .postCustom(
  1136. "api",
  1137. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  1138. this.accompanyPostData
  1139. )
  1140. .subscribe((data) => {
  1141. this.hidePatientOrder();
  1142. this.accompanyModal = false;
  1143. this.accompanyLoading = false;
  1144. if (data.status == 200) {
  1145. this.showPromptModal("创建", true, "");
  1146. this.goodsLis = [];
  1147. this.getOrderList();
  1148. this.getDeptTaskType();
  1149. } else if (data.status == 100042) {
  1150. this.showPromptModal("创建", true, data.msg);
  1151. } else {
  1152. this.showPromptModal("创建", false, data.msg);
  1153. }
  1154. });
  1155. } else if (this.accompanyType == "patient-yy") {
  1156. //患者列表预约建单
  1157. this.mainService
  1158. .postCustom(
  1159. "api",
  1160. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  1161. this.accompanyPostData
  1162. )
  1163. .subscribe((data) => {
  1164. this.btnLoading3 = false;
  1165. this.accompanyModal = false;
  1166. this.accompanyLoading = false;
  1167. this.cancel();
  1168. if (data.status == 200) {
  1169. this.showPromptModal("创建", true, "");
  1170. this.goodsLis = [];
  1171. this.getOrderList();
  1172. this.getDeptTaskType();
  1173. } else {
  1174. this.showPromptModal("创建", false, data.msg);
  1175. }
  1176. });
  1177. }
  1178. }
  1179. hideAccompanyModal(e) {
  1180. console.log(e);
  1181. if (e === "x") {
  1182. //关闭
  1183. this.accompanyModal = false;
  1184. return;
  1185. }
  1186. this.accompanyPostData.workOrder.isAccompany = 0;
  1187. this.cancenlLoading = true;
  1188. if (this.accompanyType == "patient") {
  1189. //患者列表直接建单
  1190. this.mainService
  1191. .postCustom(
  1192. "api",
  1193. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  1194. this.accompanyPostData
  1195. )
  1196. .subscribe((data) => {
  1197. this.hidePatientOrder();
  1198. this.accompanyModal = false;
  1199. this.cancenlLoading = false;
  1200. if (data.status == 200) {
  1201. this.showPromptModal("创建", true, "");
  1202. this.goodsLis = [];
  1203. this.getOrderList();
  1204. this.getDeptTaskType();
  1205. } else if (data.status == 100042) {
  1206. this.showPromptModal("创建", true, data.msg);
  1207. } else {
  1208. this.showPromptModal("创建", false, data.msg);
  1209. }
  1210. });
  1211. } else if (this.accompanyType == "patient-yy") {
  1212. //患者列表预约建单
  1213. this.mainService
  1214. .postCustom(
  1215. "api",
  1216. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  1217. this.accompanyPostData
  1218. )
  1219. .subscribe((data) => {
  1220. this.btnLoading3 = false;
  1221. this.accompanyModal = false;
  1222. this.cancenlLoading = false;
  1223. this.cancel();
  1224. if (data.status == 200) {
  1225. this.showPromptModal("创建", true, "");
  1226. this.goodsLis = [];
  1227. this.getOrderList();
  1228. this.getDeptTaskType();
  1229. } else {
  1230. this.showPromptModal("创建", false, data.msg);
  1231. }
  1232. });
  1233. }
  1234. }
  1235. // 切换患者送检检查项目
  1236. checkedShowMsg: any = {}; //患者送检检查项目对应展示信息
  1237. current_allowUrgent = false; //当前任务类型是否允许加急
  1238. currentTasktype; //当前选中的任务类型对象
  1239. cLoading = false;
  1240. changeCheckedType() {
  1241. this.linkCheckLisTrue = false;
  1242. this.clickYYFlag = false;
  1243. this.clickYYZyFlag = false;
  1244. this.nextDay = false;
  1245. this.nextDayZy = false;
  1246. this.currentTasktype = this.checkTypeLis.find(
  1247. (item) => item.id == this.patientForm.controls.checkedType.value
  1248. );
  1249. // 获取患者其他服务,护士端是否预约建单
  1250. let appointmentZyBuildFlag = this.checkTypeLis.filter(
  1251. (item) =>
  1252. item.id == this.patientForm.controls.checkedType.value &&
  1253. item.associationType.id == 255
  1254. );
  1255. if (appointmentZyBuildFlag.length) {
  1256. this.appointmentZyBuildFlag =
  1257. appointmentZyBuildFlag[0].appointmentOtherSwitch == 1 ? "1" : "0";
  1258. } else {
  1259. this.appointmentZyBuildFlag = "0";
  1260. }
  1261. console.log(this.patientForm.controls.checkedType.value, this.checkTypeLis);
  1262. this.current_allowUrgent =
  1263. this.checkTypeLis.find(
  1264. (item) => item.id == this.patientForm.controls.checkedType.value
  1265. ).allowUrgent == 1
  1266. ? true
  1267. : false;
  1268. // 判断这个任务类型是否允许加急 start
  1269. // 判断这个任务类型是否允许加急 end
  1270. let that = this;
  1271. let postData = {
  1272. taskTypeId: that.patientForm.controls.checkedType.value,
  1273. patientCode: that.patientMsg.patientCode,
  1274. };
  1275. this.cLoading = true;
  1276. that.mainService
  1277. .postCustom("nurse", "workOrder/buildTrip", postData)
  1278. .subscribe((data) => {
  1279. this.cLoading = false;
  1280. this.message.remove(this.maskFlag);
  1281. this.maskFlag = false;
  1282. this.patientModal = true;
  1283. that.checkedShowMsg = data;
  1284. if (that.checkedShowMsg.status != 200) {
  1285. that.isRemand = data.isRemand == 1 ? true : false;
  1286. }
  1287. that.goodsLis = [];
  1288. that.allowUrgent = "0"; //加急
  1289. that.urgentReason = ""; //加急原因
  1290. if (data.goods && data.goods.length) {
  1291. data.goods.forEach((e) => {
  1292. that.goodsLis.push({
  1293. label: e.name,
  1294. value: e["id"],
  1295. checked: false,
  1296. });
  1297. });
  1298. }
  1299. that.linkCheckLis = [];
  1300. if (data.status == 200 && data.data && data.data.length) {
  1301. let arr = [];
  1302. data.data.forEach((e) => {
  1303. arr.push({
  1304. yyTime: e.yyTime,
  1305. priority: e.priority,
  1306. label:
  1307. (e.yyTime || "") +
  1308. " " +
  1309. e.execDept.dept +
  1310. " 进行 " +
  1311. (e.inspectName || "检查"),
  1312. value: e["id"],
  1313. checked: false,
  1314. });
  1315. });
  1316. that.linkCheckLis = arr;
  1317. }
  1318. });
  1319. }
  1320. // 患者送检检查项目-选择检查项目
  1321. linkCheckLisTrue = false; //是否有已选择(患者)
  1322. isInspectPriority = false; //选择的检查是否紧急(患者)
  1323. hasTime = false; //是否有已选择,并且是否有预约时间(患者)
  1324. lessTime = false; //预约时间列表中预约时间少于生效时长,则是false
  1325. linkCheckLisChange(e) {
  1326. console.log(e, this.linkCheckLis);
  1327. let flag = false; //检查是否紧急
  1328. this.linkCheckLis.forEach((item) => {
  1329. e.forEach((v) => {
  1330. if (v.priority == 1) {
  1331. flag = true;
  1332. }
  1333. item.checked = v.value == item.value;
  1334. });
  1335. });
  1336. if (flag) {
  1337. this.allowUrgent = "1";
  1338. this.urgentReason = "系统根据检查信息,自动进行加急";
  1339. } else {
  1340. this.allowUrgent = "0";
  1341. this.urgentReason = "";
  1342. }
  1343. this.clickYYFlag = false;
  1344. let linkCheckLis = this.linkCheckLis.filter(
  1345. (item) => Boolean(item.yyTime) && item.checked
  1346. );
  1347. this.lessTime = linkCheckLis.every((item) => {
  1348. return (
  1349. new Date(item.yyTime).getTime() - new Date().getTime() >
  1350. this.leadTime * 60 * 1000
  1351. );
  1352. });
  1353. //回显预约时间2021年5月10日
  1354. if (this.lessTime && linkCheckLis.length) {
  1355. let timeList = linkCheckLis
  1356. .map((item) => new Date(item.yyTime).getTime())
  1357. .sort();
  1358. this.yyTime = new Date(timeList[0] - this.leadTime * 60 * 1000);
  1359. }
  1360. this.linkCheckLisTrue = e.length > 0;
  1361. this.isInspectPriority = e.some((item) => item.priority == 1);
  1362. if (!this.linkCheckLisTrue) {
  1363. this.hasTime = false;
  1364. } else {
  1365. this.hasTime = this.linkCheckLis.some(
  1366. (item) => Boolean(item.yyTime) && item.checked
  1367. );
  1368. }
  1369. console.log(
  1370. this.linkCheckLisTrue,
  1371. this.hasTime,
  1372. this.lessTime,
  1373. this.appointmentBuildFlag,
  1374. this.allowUrgent,
  1375. this.isInspectPriority,
  1376. this.checkedShowMsg
  1377. );
  1378. }
  1379. // 禁用小时
  1380. disabledHours(): number[] {
  1381. let now = new Date();
  1382. let nHour = now.getHours();
  1383. let nMinute = now.getMinutes();
  1384. if (nMinute > 30) {
  1385. return range(0, nHour + 1);
  1386. } else {
  1387. return range(0, nHour);
  1388. }
  1389. }
  1390. // 禁用分钟
  1391. disabledMinutes(hour: number): number[] {
  1392. let now = new Date();
  1393. let nHour = now.getHours();
  1394. let nMinute = now.getMinutes();
  1395. if (hour === nHour || hour === undefined) {
  1396. if (nMinute == 0) {
  1397. return [];
  1398. } else if (nMinute <= 30 && nMinute > 0) {
  1399. return [0];
  1400. } else {
  1401. return [0, 30];
  1402. }
  1403. } else {
  1404. return [];
  1405. }
  1406. }
  1407. // 快捷一键发起建单
  1408. shortcutMsg; //一键发起信息
  1409. buildMsg: any = {}; //一键发起返回信息
  1410. buildType: string = ""; //快捷建单类型
  1411. historyCustomRemarks = []; //历史快捷输入
  1412. // 打开一键发起建单模态框
  1413. newShortcutOrder(msg, type) {
  1414. this.workOrderRemark = "";
  1415. this.customRemarks = [];
  1416. this.historyCustomRemarks = [];
  1417. console.log(msg, type);
  1418. this.buildType = type;
  1419. this.shortcutMsg = msg;
  1420. this.initForm();
  1421. this.buildMsg = {};
  1422. let postData = {
  1423. taskTypeId: msg.id,
  1424. };
  1425. this.nLoading = true;
  1426. this.mainService
  1427. .postCustom("nurse", "workOrder/buildTrip", postData)
  1428. .subscribe((result) => {
  1429. this.buildMsg = result;
  1430. if (result.remarksSwitch == 1) {
  1431. if (result.customRemarks === null || result.customRemarks === "") {
  1432. this.customRemarks = [];
  1433. } else {
  1434. this.customRemarks = result.customRemarks.split("$");
  1435. }
  1436. this.workOrderRemarkTips =
  1437. result.remarksPrompts || "请填写工单备注,不超过100个字符";
  1438. let user = JSON.parse(localStorage.getItem("user"));
  1439. this.mainService
  1440. .postCustom("nurse", "workOrder/recentRemarks", {
  1441. deptId: user.user.dept.id,
  1442. taskTypeId: msg.id,
  1443. })
  1444. .subscribe((result1) => {
  1445. this.nLoading = false;
  1446. if (result1.state == 200) {
  1447. this.historyCustomRemarks = result1.data;
  1448. }
  1449. });
  1450. } else {
  1451. this.nLoading = false;
  1452. }
  1453. });
  1454. }
  1455. shortcutForm: FormGroup; //一键发起建单表单
  1456. // 一键建单校验
  1457. // 起点科室校验
  1458. originOfficeShortCutValidator = (
  1459. control: FormControl
  1460. ): { [s: string]: boolean } => {
  1461. if (
  1462. this.shortcutForm &&
  1463. this.shortcutForm.value &&
  1464. !control.value &&
  1465. (this.buildMsg.status == 100013 || this.buildMsg.status == 100015)
  1466. ) {
  1467. return { required: true };
  1468. }
  1469. };
  1470. // 目标科室校验
  1471. targetOfficeShortCutValidator = (
  1472. control: FormControl
  1473. ): { [s: string]: boolean } => {
  1474. if (
  1475. this.shortcutForm &&
  1476. this.shortcutForm.value &&
  1477. !control.value &&
  1478. (this.buildMsg.status == 100014 || this.buildMsg.status == 100015)
  1479. ) {
  1480. return { required: true };
  1481. }
  1482. };
  1483. // 一键发起建单保存
  1484. loading5 = false;
  1485. confirmShortcut() {
  1486. var that = this;
  1487. for (const i in that.shortcutForm.controls) {
  1488. that.shortcutForm.controls[i].markAsDirty();
  1489. that.shortcutForm.controls[i].updateValueAndValidity();
  1490. }
  1491. console.log(that.shortcutForm);
  1492. if (that.shortcutForm.invalid) return;
  1493. that.loading5 = true;
  1494. let postData;
  1495. that.buildType = "other";
  1496. if (that.buildType == "other") {
  1497. // 其他
  1498. postData = {
  1499. workOrder: {
  1500. workOrderRemark: this.workOrderRemark,
  1501. taskType: { id: that.shortcutMsg.id },
  1502. createDept: that.loginUserDeptId,
  1503. startDept: { id: that.buildMsg.startDept },
  1504. endDepts: [{ id: that.buildMsg.endDept }],
  1505. },
  1506. };
  1507. if (
  1508. (that.buildMsg.status == 100013 || that.buildMsg.status == 100015) &&
  1509. that.shortcutForm.value.originOffice
  1510. ) {
  1511. postData.workOrder.startDept.id = that.shortcutForm.value.originOffice;
  1512. }
  1513. if (that.shortcutForm.value.targetOffice) {
  1514. postData.workOrder["endDepts"] = [
  1515. { id: that.shortcutForm.value.targetOffice },
  1516. ];
  1517. } else {
  1518. postData.workOrder["endDepts"] = [
  1519. { id: that.buildMsg.end.end.list[0].id },
  1520. ];
  1521. }
  1522. }
  1523. console.log(postData);
  1524. that.mainService
  1525. .postCustom("api", "startOrder", postData)
  1526. .subscribe((data) => {
  1527. that.loading5 = false;
  1528. if (data.status == 200 && that.buildType == "other") {
  1529. that.showPromptModal("创建", true, "", "other");
  1530. } else if (data.status == 200 && that.buildType == "bb") {
  1531. that.showPromptModal("创建", true, "", "bb");
  1532. } else if (that.buildType == "bb" && data.status == 100043) {
  1533. that.showPromptModal("创建", true, data.msg);
  1534. } else {
  1535. that.showPromptModal("创建", false, data.msg);
  1536. }
  1537. });
  1538. }
  1539. // ======================start===============================
  1540. // 快捷一键发起建单
  1541. shortcutModal: boolean = false; //检查信息一键建单模态框
  1542. shortcutMsg1; //一键发起信息
  1543. buildMsg1: any = {}; //一键发起返回信息
  1544. urgentFlag = false;
  1545. // 打开一键发起建单模态框,urgent为true的时候是紧急
  1546. newShortcutOrder1(msg, type, urgent?) {
  1547. console.log(msg, type);
  1548. this.urgentFlag = Boolean(urgent);
  1549. this.buildType = type;
  1550. this.shortcutMsg1 = msg;
  1551. this.initForm();
  1552. this.buildMsg1 = {};
  1553. let postData = {
  1554. taskTypeId: msg.id,
  1555. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  1556. };
  1557. this.mainService
  1558. .postCustom("nurse", "workOrder/buildTrip", postData)
  1559. .subscribe((data) => {
  1560. this.shortcutModal = true;
  1561. this.buildMsg1 = data;
  1562. });
  1563. }
  1564. hideShortcutOrder() {
  1565. this.shortcutModal = false;
  1566. }
  1567. shortcutForm1: FormGroup; //一键发起建单表单
  1568. // 一键建单校验
  1569. // 起点科室校验
  1570. originOfficeShortCutValidator1 = (
  1571. control: FormControl
  1572. ): { [s: string]: boolean } => {
  1573. if (
  1574. this.shortcutForm1 &&
  1575. this.shortcutForm1.value &&
  1576. !control.value &&
  1577. (this.buildMsg1.status == 100013 || this.buildMsg1.status == 100015)
  1578. ) {
  1579. return { required: true };
  1580. }
  1581. };
  1582. // 目标科室校验
  1583. targetOfficeShortCutValidator1 = (
  1584. control: FormControl
  1585. ): { [s: string]: boolean } => {
  1586. if (
  1587. this.shortcutForm1 &&
  1588. this.shortcutForm1.value &&
  1589. !control.value &&
  1590. (this.buildMsg1.status == 100014 || this.buildMsg1.status == 100015)
  1591. ) {
  1592. return { required: true };
  1593. }
  1594. };
  1595. // 一键发起建单保存
  1596. confirmShortcut1() {
  1597. var that = this;
  1598. for (const i in that.shortcutForm1.controls) {
  1599. that.shortcutForm1.controls[i].markAsDirty();
  1600. that.shortcutForm1.controls[i].updateValueAndValidity();
  1601. }
  1602. console.log(that.shortcutForm1);
  1603. if (that.shortcutForm1.invalid) return;
  1604. that.btnLoading = true;
  1605. let postData;
  1606. if (that.buildType == "bb") {
  1607. // 标本
  1608. postData = {
  1609. urgent: this.urgentFlag ? 1 : 0,
  1610. workOrder: {
  1611. taskType: { id: that.shortcutMsg1.id },
  1612. createDept: that.loginUserDeptId,
  1613. startDept: { id: that.loginUserDeptId },
  1614. },
  1615. };
  1616. }
  1617. console.log(postData);
  1618. that.mainService
  1619. .postCustom("api", "startOrder", postData)
  1620. .subscribe((data) => {
  1621. this.hideShortcutOrder();
  1622. console.log(that.buildType, data.status);
  1623. if (data.status == 200 && that.buildType == "other") {
  1624. that.showPromptModal("创建", true, "", "other");
  1625. } else if (data.status == 200 && that.buildType == "bb") {
  1626. that.showPromptModal("创建", true, "", "bb");
  1627. } else if (that.buildType == "bb" && data.status == 100043) {
  1628. that.showPromptModal("创建", true, data.msg);
  1629. this.getOrderList();
  1630. this.getSpecimenWorkOrderMsg();
  1631. } else {
  1632. that.showPromptModal("创建", false, data.msg);
  1633. }
  1634. });
  1635. }
  1636. // =======================end=================================
  1637. // 页面中间部分tab切换
  1638. checkedTableType: string = "other";
  1639. checkTable(type) {
  1640. this.checkedTableType = type;
  1641. }
  1642. // 意见箱表格数据
  1643. adviceList: any = [];
  1644. advicePageIndex: number = 1; //表格当前页码
  1645. advicePageSize: number = 10; //表格每页展示条数
  1646. adviceListLength: number = 10; //表格总数据量
  1647. adviceSearchInp: string = ""; //意见箱搜索
  1648. adviceLoading = false;
  1649. getAdvice() {
  1650. let that = this;
  1651. let postData = {
  1652. advice: {
  1653. content: that.adviceSearchInp || "",
  1654. creatDepartment: {
  1655. id: that.loginUserDeptId,
  1656. },
  1657. createUser: {
  1658. id: that.loginUser.id,
  1659. },
  1660. },
  1661. idx: that.advicePageIndex - 1 < 0 ? 0 : that.advicePageIndex - 1,
  1662. sum: that.advicePageSize,
  1663. };
  1664. this.adviceLoading = true;
  1665. that.mainService
  1666. .getFetchDataList("adviceCollection", "advice", postData)
  1667. .subscribe((data) => {
  1668. this.adviceLoading = false;
  1669. that.adviceList = data.list || [];
  1670. that.adviceListLength = data.totalNum || 0;
  1671. });
  1672. }
  1673. // 历史标本查询表格数据
  1674. historySpecimenList: any = [];
  1675. historySpecimenPageIndex: number = 1; //表格当前页码
  1676. historySpecimenPageSize: number = 10; //表格每页展示条数
  1677. historySpecimenListLength: number = 10; //表格总数据量
  1678. historySpecimenCodeSearchInp: string = ""; //标本编码搜索
  1679. historySpecimenParentSearchInp: string = ""; //患者信息搜索
  1680. hsLoading = false;
  1681. getHistorySpecimen(idx?) {
  1682. if (idx) {
  1683. this.historySpecimenPageIndex = 1;
  1684. }
  1685. let current = JSON.parse(localStorage.getItem("user"));
  1686. let postData = {
  1687. specimen: {
  1688. hosId: this.currentHospital.id,
  1689. sickRoom: {
  1690. id: current.user.dept.id,
  1691. },
  1692. scode:
  1693. this.historySpecimenCodeSearchInp === ""
  1694. ? null
  1695. : this.historySpecimenCodeSearchInp,
  1696. keyWord:
  1697. this.historySpecimenParentSearchInp === ""
  1698. ? null
  1699. : this.historySpecimenParentSearchInp,
  1700. },
  1701. idx: this.historySpecimenPageIndex - 1,
  1702. sum: this.historySpecimenPageSize,
  1703. };
  1704. this.hsLoading = true;
  1705. this.mainService
  1706. .getFetchDataList("simple/data", "specimen", postData)
  1707. .subscribe((data) => {
  1708. this.hsLoading = false;
  1709. this.historySpecimenList = data.list || [];
  1710. this.historySpecimenListLength = data.totalNum || 0;
  1711. });
  1712. }
  1713. // 意见箱-查看模态框
  1714. adviceModal: boolean = false;
  1715. adviceDetailInfo: any = {}; //意见详情
  1716. adviceDetail(id) {
  1717. this.adviceModal = true;
  1718. this.mainService
  1719. .getFetchData("adviceCollection", "advice", id)
  1720. .subscribe((data) => {
  1721. this.adviceDetailInfo = data.data;
  1722. console.log(this.adviceDetailInfo);
  1723. });
  1724. }
  1725. hideAdvice() {
  1726. this.adviceModal = false;
  1727. }
  1728. // 意见收集
  1729. adviceSubModal: boolean = false;
  1730. adviceSubContent: string; //填写意见内容
  1731. coopAdviceInfo: any = {}; //当前编辑意见详情
  1732. addAdvice(data?) {
  1733. let that = this;
  1734. that.adviceSubContent = "";
  1735. if (data) {
  1736. that.coopAdviceInfo = data;
  1737. that.adviceSubContent = data.content;
  1738. }
  1739. that.adviceSubModal = true;
  1740. }
  1741. hideSubAdvice() {
  1742. this.adviceSubModal = false;
  1743. }
  1744. // 提交意见内容
  1745. confirmSubAdvice() {
  1746. let that = this;
  1747. if (!that.adviceSubContent) return;
  1748. that.btnLoading = true;
  1749. let postData = {
  1750. advice: {
  1751. creatDepartment: {
  1752. id: that.loginUserDeptId,
  1753. },
  1754. createUser: {
  1755. id: that.loginUser.id,
  1756. },
  1757. content: that.adviceSubContent,
  1758. },
  1759. };
  1760. if (that.coopAdviceInfo.id) {
  1761. postData.advice["id"] = that.coopAdviceInfo.id;
  1762. }
  1763. that.mainService
  1764. .postCustom(
  1765. "adviceCollection",
  1766. that.coopAdviceInfo.id ? "updData/advice" : "addData/advice",
  1767. postData
  1768. )
  1769. .subscribe((data) => {
  1770. if (data.status == 200) {
  1771. that.adviceSubModal = false;
  1772. that.showPromptModal(
  1773. that.coopAdviceInfo.id ? "编辑" : "新增",
  1774. true,
  1775. ""
  1776. );
  1777. that.coopAdviceInfo = {};
  1778. that.adviceSubContent = "";
  1779. that.getAdvice();
  1780. } else {
  1781. that.adviceSubModal = false;
  1782. that.showPromptModal(
  1783. that.coopAdviceInfo.id ? "编辑" : "新增",
  1784. false,
  1785. data.msg
  1786. );
  1787. that.adviceSubContent = "";
  1788. }
  1789. });
  1790. }
  1791. // 查看标本详情
  1792. detailModel: boolean = false;
  1793. loading33: boolean = false;
  1794. detailList: any = [];
  1795. // 选择急查或普查(1是急标,2是普标)
  1796. changeSpeDetail(speDetailType: number) {
  1797. this.detailModel = true;
  1798. let user = JSON.parse(localStorage.getItem("user"));
  1799. let postData = {
  1800. deptId: user.user.dept.id,
  1801. urgent: speDetailType,
  1802. };
  1803. this.loading33 = true;
  1804. this.mainService
  1805. .postCustom("nurse", "getSpecimenWorkOrderDetails", postData)
  1806. .subscribe((result) => {
  1807. this.loading33 = false;
  1808. if (result.status == 200) {
  1809. this.detailList = result.data || [];
  1810. }
  1811. });
  1812. }
  1813. // 隐藏查看标本详情弹层
  1814. hideSpeDetailModel() {
  1815. this.detailModel = false;
  1816. }
  1817. // 意见删除模态框
  1818. delAdviceModal: boolean = false;
  1819. delAdviceId: number; //删除意见id
  1820. delAdvice(id) {
  1821. this.delAdviceId = id;
  1822. this.delAdviceModal = true;
  1823. }
  1824. confirmDelAdvice() {
  1825. let that = this;
  1826. that.btnLoading = true;
  1827. let postData = [that.delAdviceId];
  1828. that.mainService
  1829. .postCustom("adviceCollection", "rmvData/advice", postData)
  1830. .subscribe((data) => {
  1831. if (data.status == 200) {
  1832. that.delAdviceModal = false;
  1833. that.showPromptModal("删除", true, "");
  1834. if (
  1835. that.adviceList.length == 1 &&
  1836. that.advicePageIndex ==
  1837. Math.ceil(that.adviceListLength / that.advicePageSize)
  1838. ) {
  1839. that.adviceListLength--;
  1840. that.advicePageIndex = Math.ceil(
  1841. that.adviceListLength / that.advicePageSize
  1842. );
  1843. }
  1844. that.getAdvice();
  1845. } else {
  1846. that.delAdviceModal = false;
  1847. that.showPromptModal("删除", false, data.msg);
  1848. }
  1849. });
  1850. }
  1851. hideDelAdviceModal() {
  1852. this.delAdviceModal = false;
  1853. }
  1854. // 工单列表下拉筛选
  1855. selectedType: null;
  1856. changeOrderSel(e) {
  1857. this.selectedType = e;
  1858. this.getOrderList();
  1859. }
  1860. // 工单列表工单状态下拉筛选
  1861. changeOrderState(e) {
  1862. this.getOrderList();
  1863. }
  1864. // 工单列表
  1865. orderList: any = [];
  1866. orderIdx: number = 1;
  1867. orderLength: number = 10;
  1868. OLoading: boolean = true;
  1869. getOrderList() {
  1870. let that = this;
  1871. that.orderList = [];
  1872. that.OLoading = true;
  1873. let postData: any = {
  1874. workOrder: {
  1875. createDept: JSON.parse(localStorage.getItem("user")).user.dept.id,
  1876. platform: 2,
  1877. searchDays: 2,
  1878. taskType: {},
  1879. },
  1880. idx: that.orderIdx - 1,
  1881. sum: 10,
  1882. };
  1883. if (that.selectedType && that.selectedType != -1) {
  1884. postData.workOrder.taskType["associationType"] = {
  1885. id: that.selectedType,
  1886. };
  1887. }
  1888. // 执行中包含状态:待抢单、待接单、待到达、待送达、执行中、定时预约
  1889. if (that.orderStateSelected == "1") {
  1890. //执行中
  1891. delete postData.workOrder.gdState;
  1892. postData.workOrder.nurseState = 1;
  1893. } else if (that.orderStateSelected == "2") {
  1894. //待评价
  1895. delete postData.workOrder.nurseState;
  1896. postData.workOrder.gdState = { id: "73" };
  1897. } else {
  1898. //全部
  1899. delete postData.workOrder.nurseState;
  1900. delete postData.workOrder.gdState;
  1901. }
  1902. that.mainService
  1903. .getFetchDataList("nurse", "workOrder", postData)
  1904. .subscribe((data) => {
  1905. that.orderList = data.list || [];
  1906. //显示三项
  1907. that.orderList.forEach((item) => {
  1908. if (item.record.length > 2) {
  1909. let i = item.record
  1910. .reverse()
  1911. .findIndex((step) => step.record.length > 0);
  1912. item.record.reverse();
  1913. i = item.record.length - 1 - i;
  1914. if (i < 2) {
  1915. item.record = item.record.slice(0, 3);
  1916. } else if (i > item.record.length - 2) {
  1917. item.record = item.record.slice(
  1918. item.record.length - 3,
  1919. item.record.length
  1920. );
  1921. } else {
  1922. item.record = item.record.slice(i - 1, i + 2);
  1923. }
  1924. }
  1925. });
  1926. that.orderLength = data.totalNum || 0;
  1927. that.OLoading = false;
  1928. });
  1929. }
  1930. // 撤销
  1931. coopId: number;
  1932. recallOrderModal: boolean = false;
  1933. // 打开撤销模态框
  1934. openRecallModal(id) {
  1935. this.coopId = id;
  1936. this.recallOrderModal = true;
  1937. }
  1938. // 确认撤销
  1939. confirmRec() {
  1940. let that = this;
  1941. that.btnLoading = true;
  1942. that.mainService.delOrder(that.coopId).subscribe((data) => {
  1943. that.closeRecallOrderModal();
  1944. if (data.status == 200) {
  1945. that.getOrderList();
  1946. that.changeInfo();
  1947. that.showPromptModal("撤销", true, "");
  1948. } else {
  1949. that.showPromptModal("撤销", false, data.msg);
  1950. }
  1951. });
  1952. }
  1953. // 关闭撤销模态框
  1954. closeRecallOrderModal() {
  1955. this.recallOrderModal = false;
  1956. }
  1957. // 评价
  1958. appraiseModal: boolean = false;
  1959. starNum: number = 5; //评价星
  1960. appraiseContent: string = ""; //评级
  1961. appraiseId: number;
  1962. showAppraise(id) {
  1963. this.appraiseId = id;
  1964. this.appraiseModal = true;
  1965. this.starNum = 5;
  1966. this.appraiseContent = "";
  1967. }
  1968. // 保存评价
  1969. confirmAppraise() {
  1970. console.log(this.starNum, this.appraiseContent);
  1971. let that = this;
  1972. if (!that.starNum) return;
  1973. that.btnLoading = true;
  1974. let id;
  1975. switch (that.starNum) {
  1976. case 1:
  1977. id = 358;
  1978. break;
  1979. case 2:
  1980. id = 357;
  1981. break;
  1982. case 3:
  1983. id = 356;
  1984. break;
  1985. case 4:
  1986. id = 355;
  1987. break;
  1988. case 5:
  1989. id = 354;
  1990. break;
  1991. }
  1992. let postData = {
  1993. serviceEvaluation: { id: id },
  1994. remark: that.appraiseContent,
  1995. };
  1996. this.mainService
  1997. .postCustom("nurse/workOrder", "evaluate/" + this.appraiseId, postData)
  1998. .subscribe((data) => {
  1999. that.hideAppraise();
  2000. if (data.status == 200) {
  2001. that.getOrderList();
  2002. that.showPromptModal("评价", true, "");
  2003. } else {
  2004. that.showPromptModal("评价", false, data.msg);
  2005. }
  2006. });
  2007. }
  2008. hideAppraise() {
  2009. this.appraiseModal = false;
  2010. }
  2011. // 审核状态
  2012. checkStatusLis: any = [];
  2013. getCheckStatusLis() {
  2014. let that = this;
  2015. that.mainService.getDictionary("list", "check_status").subscribe((data) => {
  2016. that.checkStatusLis = data;
  2017. });
  2018. }
  2019. // 填写加急原因模态框
  2020. jiajiModal: boolean = false;
  2021. jiajiContent: string; //加急原因
  2022. jiajiId; //加急工单id
  2023. showJiaji(id) {
  2024. this.jiajiId = id;
  2025. this.jiajiModal = true;
  2026. this.jiajiContent = "";
  2027. }
  2028. hideJiaji() {
  2029. this.jiajiModal = false;
  2030. }
  2031. // 保存加急原因
  2032. confirmJiaji() {
  2033. let that = this;
  2034. let checkStatusId;
  2035. if (!that.jiajiContent) return;
  2036. that.btnLoading = true;
  2037. that.checkStatusLis.forEach((e) => {
  2038. if (e.value == 1) {
  2039. checkStatusId = e.id;
  2040. }
  2041. });
  2042. let postData = {
  2043. urgentDetails: {
  2044. workerOrder: that.jiajiId,
  2045. checkStatus: { id: checkStatusId },
  2046. urgentReason: that.jiajiContent,
  2047. },
  2048. };
  2049. that.mainService
  2050. .postCustom("workerOrder", "urge", postData)
  2051. .subscribe((data) => {
  2052. if (data.status == 200) {
  2053. that.showPromptModal("加急", true, "");
  2054. that.getOrderList();
  2055. that.hideJiaji();
  2056. } else {
  2057. that.showPromptModal("加急", false, data.msg);
  2058. }
  2059. });
  2060. }
  2061. // 查看工单详情
  2062. openDetails(id, typeId) {
  2063. if (typeId == 256 || typeId == 380) {
  2064. // 标本类
  2065. this.router.navigateByUrl("nurse/detailSample/" + id);
  2066. } else if (typeId == 260 || typeId == 255) {
  2067. // 患者陪检/患者转运
  2068. this.router.navigateByUrl("nurse/detailPatients/" + id);
  2069. } else if (typeId == 257 || typeId == 258) {
  2070. // 药品配送/静配
  2071. this.router.navigate(["nurse/detailDrug/" + id]);
  2072. } else {
  2073. // 其他
  2074. this.router.navigateByUrl("nurse/detailOthers/" + id);
  2075. }
  2076. }
  2077. // 派单
  2078. allotWorker(id, stateId) {
  2079. this.router.navigateByUrl("nurse/allotWorker/" + id + "/" + stateId);
  2080. }
  2081. // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
  2082. showPromptModal(con, success, promptInfo?, back?) {
  2083. this.btnLoading = false;
  2084. this.btnLoading1 = false;
  2085. this.promptModalShow = false;
  2086. this.promptContent = con;
  2087. this.ifSuccess = success;
  2088. this.promptInfo = promptInfo;
  2089. this.back = back;
  2090. setTimeout(() => {
  2091. this.promptModalShow = true;
  2092. }, 100);
  2093. }
  2094. // 回到系统管理
  2095. toMain() {
  2096. this.router.navigateByUrl("main");
  2097. }
  2098. // 退出
  2099. logOut(): void {
  2100. let that = this;
  2101. that.mainService.logOut().subscribe((data) => {
  2102. if (data.status == 200) {
  2103. localStorage.removeItem("user");
  2104. localStorage.removeItem("menu");
  2105. localStorage.removeItem("phones");
  2106. localStorage.removeItem("index");
  2107. that.router.navigateByUrl("login");
  2108. }
  2109. });
  2110. }
  2111. // 格式化时分秒
  2112. // (时间小于一分钟则显示秒,时间大于一分钟则显示分钟数,如超出一小时则显示小时和分钟。)time单位:秒
  2113. formatTime(time) {
  2114. let timeStr = "";
  2115. if (time >= 0 && time < 60) {
  2116. // 秒
  2117. timeStr = time + "秒";
  2118. } else if (time >= 60 && time < 3600) {
  2119. // 分钟
  2120. timeStr = Math.floor(time / 60) + "分钟";
  2121. } else if (time >= 3600) {
  2122. // 时 + 分
  2123. let h = "";
  2124. let m = "";
  2125. h = Math.floor(time / 3600) + "小时";
  2126. m = time % 3600 >= 60 ? Math.floor((time % 3600) / 60) + "分钟" : "";
  2127. timeStr = h + m;
  2128. }
  2129. return timeStr;
  2130. }
  2131. // 计算历史记录耗时
  2132. filterTime(step) {
  2133. let num = 0;
  2134. step.forEach((e) => {
  2135. num += e.difTime;
  2136. });
  2137. return this.formatTime(num / 1000);
  2138. }
  2139. // 截取意见内容(ie内核截取)
  2140. spliceContent(con) {
  2141. if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) {
  2142. return con.slice(0, 41) + "...";
  2143. } else {
  2144. return con;
  2145. }
  2146. }
  2147. @ViewChild("msgTemplate", { static: false }) msgTemplate: TemplateRef<any>; //消息通知模板
  2148. // 消息提醒
  2149. createBasicNotification(msgs): void {
  2150. this.notification.template(this.msgTemplate, {
  2151. nzDuration: 0,
  2152. nzData: msgs,
  2153. });
  2154. }
  2155. isShowNurseCode = false; //是否展开科室二维码
  2156. nurseCodeImg = ""; //图片
  2157. refreshQRCodeTime = 0; //刷新时间间隔
  2158. // 关闭科室二维码
  2159. closeNurseCode() {
  2160. this.isShowNurseCode = false;
  2161. clearInterval(this.timer);
  2162. this.timer = null;
  2163. }
  2164. // 展开科室二维码
  2165. timer = null;
  2166. showNurseCode() {
  2167. this.isShowNurseCode = true;
  2168. this.mainService.getDeptCode([this.loginUserDeptId]).subscribe((data) => {
  2169. if (data["status"] == 200) {
  2170. this.nurseCodeImg = data["data"][0].base64;
  2171. this.refreshQRCodeTime = data["data"][0].refreshQRCodeTime;
  2172. clearInterval(this.timer);
  2173. this.timer = setInterval(() => {
  2174. this.refreshQRCodeTime = Math.max(--this.refreshQRCodeTime, 0);
  2175. if (this.refreshQRCodeTime === 0) {
  2176. clearInterval(this.timer);
  2177. this.showNurseCode();
  2178. }
  2179. }, 1000);
  2180. }
  2181. });
  2182. }
  2183. // 右侧菜单
  2184. showLastItems: boolean = false;
  2185. // 下拉
  2186. fixedMenuXiala() {
  2187. this.showLastItems = true;
  2188. }
  2189. // 上拉
  2190. fixedMenuShangla() {
  2191. this.showLastItems = false;
  2192. }
  2193. mainRole: boolean = false; //回到系统管理权限
  2194. initRole() {
  2195. let menus = JSON.parse(localStorage.getItem("menu"));
  2196. let that = this;
  2197. console.log("菜单数量" + menus.length);
  2198. if (menus.length >= 2) {
  2199. that.mainRole = true;
  2200. return;
  2201. }
  2202. }
  2203. // 切换右侧菜单Tab
  2204. fixedTab: string = "";
  2205. checkFixedTab(type: string) {
  2206. if (type == "toSystem") {
  2207. this.router.navigateByUrl("main");
  2208. }
  2209. if (this.fixedTab == type) {
  2210. this.fixedTab = "";
  2211. } else {
  2212. this.fixedTab = type;
  2213. }
  2214. }
  2215. //子传父接收
  2216. closeModelHs(e) {
  2217. this.hsPromptModalShow = JSON.parse(e).show;
  2218. this.changeShow = JSON.parse(e).changeShow;
  2219. }
  2220. //子传父接收
  2221. clearModelHs(e) {
  2222. if (JSON.parse(e).clear === true) {
  2223. clearInterval(this.timerCloseTime);
  2224. }
  2225. this.changeShow = JSON.parse(e).changeShow;
  2226. }
  2227. // 头部切换科室
  2228. changeKsNow() {
  2229. this.hsPromptModalShow = true;
  2230. clearInterval(this.timerCloseTime);
  2231. this.changeShow = false;
  2232. }
  2233. }