Sfoglia il codice sorgente

服务台预约建单

seimin 11 mesi fa
parent
commit
8acbf4e276

+ 129 - 1
src/app/views/fuwutai/fuwutai.component.html

@@ -2362,6 +2362,67 @@
2362 2362
                           </nz-form-item>
2363 2363
                         </div>
2364 2364
                       </div>
2365
+                      <!-- 预约建单时间-患者其他服务--start -->
2366
+                      <div nz-col [nzSpan]="24" style="height: 83px" class="pos">
2367
+                        <!-- 需要预约检查 -->
2368
+                        <nz-form-item class="pos-item">
2369
+                          <nz-form-control>
2370
+                            <label
2371
+                              nz-checkbox
2372
+                              [(ngModel)]="isYyInspect"
2373
+                              (ngModelChange)="yyInspectChange($event)"
2374
+                              [ngModelOptions]="{ standalone: true }"
2375
+                              style="font-weight: bold"
2376
+                              >需要预约检查</label
2377
+                            >
2378
+                          </nz-form-control>
2379
+                        </nz-form-item>
2380
+                        <!-- 预约建单时间-患者其他服务 -->
2381
+                        <nz-form-item class="yyTime" [ngClass]="{yyTimeError: (!yyTimeZy || !yyDateZy) && clickYYZyFlag}">
2382
+                          <nz-form-label [nzSm]="24" [nzXs]="24">预约建单时间</nz-form-label>
2383
+                          <nz-form-control [nzSm]="24" [nzXs]="24">
2384
+                            <nz-date-picker
2385
+                              [nzDisabled]="!isYyInspect"
2386
+                              [(ngModel)]="yyDateZy"
2387
+                              (ngModelChange)="yyDateChange($event)"
2388
+                              [ngModelOptions]="{ standalone: true }"
2389
+                              [nzAllowClear]="false"
2390
+                              [nzDisabledDate]="disabledyyDateZy"
2391
+                              [nzShowToday]="false"
2392
+                            ></nz-date-picker>
2393
+                            <nz-time-picker
2394
+                              [nzDisabled]="!isYyInspect || !yyDateZy"
2395
+                              class="ml8"
2396
+                              nzFormat="HH:mm"
2397
+                              [nzMinuteStep]="inspectAndPatientTransportConfig.timeMod"
2398
+                              [nzSecondStep]="60"
2399
+                              [(ngModel)]="yyTimeZy"
2400
+                              (ngModelChange)="yyTimeZyChange($event)"
2401
+                              [ngModelOptions]="{ standalone: true }"
2402
+                              [nzDisabledHours]="disabledHours"
2403
+                              [nzDisabledMinutes]="disabledMinutes"
2404
+                              [nzAllowEmpty]="false"
2405
+                            >
2406
+                            </nz-time-picker>
2407
+                            <button
2408
+                              [disabled]="!isYyInspect || (isYyInspect && !yyDateZy)"
2409
+                              nz-button
2410
+                              nzType="primary"
2411
+                              class="ml8"
2412
+                              (click)="nextDayZy()"
2413
+                            >
2414
+                              下一日
2415
+                            </button>
2416
+                          </nz-form-control>
2417
+                          <div
2418
+                            class="red w100"
2419
+                            *ngIf="(!yyTimeZy || !yyDateZy) && clickYYZyFlag"
2420
+                          >
2421
+                            请填写预约建单时间!
2422
+                          </div>
2423
+                        </nz-form-item>
2424
+                      </div>
2425
+                      <!-- 预约建单时间-患者其他服务--end -->
2365 2426
                     </div>
2366 2427
                   </form>
2367 2428
                 </div>
@@ -2589,6 +2650,73 @@
2589 2650
                           </nz-form-control>
2590 2651
                         </nz-form-item>
2591 2652
                       </div>
2653
+                      <!-- 预约建单时间-其他临床服务--start -->
2654
+                      <div nz-col [nzSpan]="24" style="height: 83px" class="pos">
2655
+                        <!-- 需要预约检查 -->
2656
+                        <nz-form-item class="pos-item">
2657
+                          <nz-form-control>
2658
+                            <label
2659
+                              nz-checkbox
2660
+                              [(ngModel)]="isYyInspect"
2661
+                              (ngModelChange)="yyInspectChange($event)"
2662
+                              [ngModelOptions]="{ standalone: true }"
2663
+                              style="font-weight: bold"
2664
+                              >需要预约检查</label
2665
+                            >
2666
+                          </nz-form-control>
2667
+                        </nz-form-item>
2668
+                        <!-- 预约建单时间 -->
2669
+                        <nz-form-item
2670
+                          class="yyTime"
2671
+                          [ngClass]="{ yyTimeError: (!yyTime || !yyDate) && clickYYFlag }"
2672
+                        >
2673
+                          <nz-form-label [nzSm]="24" [nzXs]="24"
2674
+                            >预约建单时间</nz-form-label
2675
+                          >
2676
+                          <nz-form-control [nzSm]="24" [nzXs]="24">
2677
+                            <nz-date-picker
2678
+                              [nzDisabled]="!isYyInspect"
2679
+                              [(ngModel)]="yyDate"
2680
+                              (ngModelChange)="yyDateChange($event)"
2681
+                              [ngModelOptions]="{ standalone: true }"
2682
+                              [nzAllowClear]="false"
2683
+                              [nzDisabledDate]="disabledyyDate"
2684
+                              [nzShowToday]="false"
2685
+                            >
2686
+                            </nz-date-picker>
2687
+                            <nz-time-picker
2688
+                              [nzDisabled]="!isYyInspect || !yyDate"
2689
+                              class="ml8"
2690
+                              nzFormat="HH:mm"
2691
+                              [nzMinuteStep]="inspectAndPatientTransportConfig.timeMod"
2692
+                              [nzSecondStep]="60"
2693
+                              [(ngModel)]="yyTime"
2694
+                              (ngModelChange)="yyTimeChange($event)"
2695
+                              [ngModelOptions]="{ standalone: true }"
2696
+                              [nzDisabledHours]="disabledHours"
2697
+                              [nzDisabledMinutes]="disabledMinutes"
2698
+                              [nzAllowEmpty]="false"
2699
+                            >
2700
+                            </nz-time-picker>
2701
+                            <button
2702
+                              [disabled]="!isYyInspect || (isYyInspect && !yyDate)"
2703
+                              nz-button
2704
+                              nzType="primary"
2705
+                              class="ml8"
2706
+                              (click)="nextDay()"
2707
+                            >
2708
+                              下一日
2709
+                            </button>
2710
+                          </nz-form-control>
2711
+                          <div
2712
+                            class="red w100"
2713
+                            *ngIf="(!yyTime || !yyDate) && clickYYFlag"
2714
+                          >
2715
+                            请填写预约建单时间!
2716
+                          </div>
2717
+                        </nz-form-item>
2718
+                      </div>
2719
+                      <!-- 预约建单时间-其他临床服务--end -->
2592 2720
                     </div>
2593 2721
                   </form>
2594 2722
                 </div>
@@ -2981,7 +3109,7 @@
2981 3109
           (click)="newOrderOk()"
2982 3110
           [nzLoading]="isOkLoading"
2983 3111
         >
2984
-          确认
3112
+          {{isYyInspect ? '预约建单' :'直接建单'}}
2985 3113
         </button>
2986 3114
         <button
2987 3115
           class="btn cancel"

+ 26 - 0
src/app/views/fuwutai/fuwutai.component.less

@@ -27,6 +27,32 @@
27 27
     flex-direction: column;
28 28
     min-height: 180px;
29 29
   }
30
+  .pos {
31
+    position: relative;
32
+
33
+    .yyTimeError {
34
+      ::ng-deep .ant-time-picker-input,
35
+      ::ng-deep .ant-calendar-picker-input {
36
+        border: 1px solid red !important;
37
+      }
38
+    }
39
+
40
+    .yyTime {
41
+      display: flex;
42
+      align-items: center;
43
+      flex-direction: column;
44
+    }
45
+
46
+    .pos-item {
47
+      position: absolute;
48
+      left: 110px;
49
+      top: -10px;
50
+      z-index: 9;
51
+    }
52
+    .ant-form-item-label{
53
+      text-align: left;
54
+    }
55
+  }
30 56
   .transport-1_round_solid,
31 57
   .transport-2_round_solid,
32 58
   .transport-3_round_solid {

+ 226 - 2
src/app/views/fuwutai/fuwutai.component.ts

@@ -20,6 +20,17 @@ import { Subject } from "rxjs";
20 20
 import { debounceTime } from "rxjs/operators";
21 21
 import { SourceId } from "src/app/type/types";
22 22
 import { ToolService } from 'src/app/services/tool.service';
23
+import { addDays, differenceInCalendarDays, getHours, getMinutes, setMinutes, parse, format } from 'date-fns';
24
+
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
+
23 34
 @Component({
24 35
   selector: "app-fuwutai",
25 36
   templateUrl: "./fuwutai.component.html",
@@ -376,8 +387,18 @@ export class FuwutaiComponent implements OnInit {
376 387
           )
377 388
         : [];
378 389
       goods = goods.map((current) => current.value).join();
390
+
391
+      // 预约日期
392
+      let yyTime1;
393
+      if(this.isYyInspect && this.currentTabIndex == '255'){
394
+        let yyDateZy = (typeof this.yyDateZy === 'object') ? new Date(this.yyDateZy) : parse(this.yyDateZy, 'yyyy-MM-dd HH:mm:ss', new Date());
395
+        let yyTimeZy = (typeof this.yyTimeZy === 'object') ? new Date(this.yyTimeZy) : parse(this.yyTimeZy, 'yyyy-MM-dd HH:mm:ss', new Date());
396
+        yyTime1 = format(yyDateZy, "yyyy-MM-dd") + " " + format(yyTimeZy, "HH:mm") + ":00";
397
+      }
398
+
379 399
       let postData = {
380 400
         workOrder: {
401
+          yyTime: yyTime1,
381 402
           sourceId: SourceId.fuwutai,
382 403
           taskType: {
383 404
             id: this.validateFormZy.controls.taskType.value,
@@ -465,8 +486,17 @@ export class FuwutaiComponent implements OnInit {
465 486
         return;
466 487
       }
467 488
     }
489
+
490
+    // 预约日期
491
+    let yyTime1;
492
+    if(this.isYyInspect && this.currentTabIndex == '259'){
493
+      let yyDate = (typeof this.yyDate === 'object') ? new Date(this.yyDate) : parse(this.yyDate, 'yyyy-MM-dd HH:mm:ss', new Date());
494
+      let yyTime = (typeof this.yyTime === 'object') ? new Date(this.yyTime) : parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date());
495
+      yyTime1 = format(yyDate, "yyyy-MM-dd") + " " + format(yyTime, "HH:mm") + ":00";
496
+    }
468 497
     let postData = {
469 498
       workOrder: {
499
+        yyTime: yyTime1,
470 500
         sourceId: SourceId.fuwutai,
471 501
         workOrderRemark: this.validateFormQt.controls.workOrderRemark.value,
472 502
         taskType: {
@@ -1288,6 +1318,15 @@ export class FuwutaiComponent implements OnInit {
1288 1318
   deathTasktypeId; //获取这个写死的任务类型的id,送病人回病房
1289 1319
   deathTasktypeIdPatient; //获取这个写死的任务类型的id,转出院记录
1290 1320
   async showNewOrder(des?, phone?) {
1321
+    // 预约相关重置
1322
+    this.yyDateZy = new Date();
1323
+    this.yyDate = new Date();
1324
+    this.yyTimeZy = null;
1325
+    this.yyTime = null;
1326
+    this.isYyInspect = false;
1327
+    this.clickYYZyFlag = false;
1328
+    this.clickYYFlag = false;
1329
+
1291 1330
     // 送病人回病房
1292 1331
     let deathTasktypeResult: any = await this.getConfigTasktype();
1293 1332
     this.getConfigTasktypeLoading = false;
@@ -1763,8 +1802,161 @@ export class FuwutaiComponent implements OnInit {
1763 1802
         }
1764 1803
       });
1765 1804
   }
1805
+  // 获取大于x,并且是n的倍数的数字
1806
+  getLgNumber(x: number, n:number): number{
1807
+    for(let i = x; i < 60; i++){
1808
+      if(i % n === 0){
1809
+        return i;
1810
+      }
1811
+    }
1812
+    return 0;
1813
+  }
1814
+  // 禁用小时
1815
+  disabledHours = (): number[] => {
1816
+    let now = new Date();
1817
+    let nHour = now.getHours();
1818
+    let nMinute = now.getMinutes();
1819
+    if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
1820
+      return range(0, nHour + 1);
1821
+    } else {
1822
+      return range(0, nHour);
1823
+    }
1824
+  }
1825
+  // 禁用分钟
1826
+  disabledMinutes = (hour: number): number[] => {
1827
+    let now = new Date();
1828
+    let nHour = now.getHours();
1829
+    let nMinute = now.getMinutes();
1830
+    if (hour === nHour || hour === undefined) {
1831
+      return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
1832
+    } else {
1833
+      return [];
1834
+    }
1835
+  }
1836
+
1837
+  // start和end之间能被n整除的所有数字集合
1838
+  integralDivision(start:number, end:number, n:number): number[]{
1839
+    let arr = [];
1840
+    for(let i = start; i <= end; i++){
1841
+      if(i % n === 0){
1842
+        arr.push(i);
1843
+      }
1844
+    }
1845
+    return arr;
1846
+  }
1847
+  //修改预约建单时间的日期
1848
+  yyDateChange(e) {
1849
+    // 获取年月日
1850
+    let yyDate = new Date(e);
1851
+    let year = yyDate.getFullYear();
1852
+    let month = yyDate.getMonth();
1853
+    let date = yyDate.getDate();
1854
+    // 获取当前时间的年月日
1855
+    let now = new Date();
1856
+    let nYear = now.getFullYear();
1857
+    let nMonth = now.getMonth();
1858
+    let nDate = now.getDate();
1859
+    if (year != nYear || month != nMonth || date != nDate) {
1860
+      this.disabledHours = () => [];
1861
+      this.disabledMinutes = (hour) => [];
1862
+    } else {
1863
+      // 禁用小时
1864
+      this.disabledHours = () => {
1865
+        let now = new Date();
1866
+        let nHour = now.getHours();
1867
+        let nMinute = now.getMinutes();
1868
+        if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
1869
+          return range(0, nHour + 1);
1870
+        } else {
1871
+          return range(0, nHour);
1872
+        }
1873
+      };
1874
+      // 禁用分钟
1875
+      this.disabledMinutes = (hour) => {
1876
+        let now = new Date();
1877
+        let nHour = now.getHours();
1878
+        let nMinute = now.getMinutes();
1879
+        if (hour === nHour || hour === undefined) {
1880
+          return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
1881
+        } else {
1882
+          return [];
1883
+        }
1884
+      };
1885
+    }
1886
+  }
1887
+  // 下一日(患者其他服务)
1888
+  nextDayZy() {
1889
+    this.yyDateZy = addDays(this.yyDateZy, 1);
1890
+    this.yyDateChange(this.yyDateZy);
1891
+  }
1892
+  // 禁用日期(患者其他服务)
1893
+  disabledyyDateZy = (current: Date): boolean => {
1894
+    return differenceInCalendarDays(current, new Date()) < 0;
1895
+  };
1896
+  // 禁用日期(其他)
1897
+  disabledyyDate = (current: Date): boolean => {
1898
+    return differenceInCalendarDays(current, new Date()) < 0;
1899
+  };
1900
+  yyTimeZyChange(e) {
1901
+    if (this.yyTimeZy) {
1902
+      let now = new Date();
1903
+      // 禁用日期(转运)
1904
+      if (getHours(this.yyTimeZy) < getHours(now)) {
1905
+        this.disabledyyDateZy = (current: Date): boolean => {
1906
+          return differenceInCalendarDays(current, new Date()) < 1;
1907
+        };
1908
+      } else {
1909
+        this.disabledyyDateZy = (current: Date): boolean => {
1910
+          return differenceInCalendarDays(current, new Date()) < 0;
1911
+        };
1912
+      }
1913
+      let end = this.getLgNumber(getMinutes(this.yyTimeZy), this.inspectAndPatientTransportConfig.timeMod);
1914
+      this.yyTimeZy = setMinutes(this.yyTimeZy, end);
1915
+    }
1916
+    this.clickYYZyFlag = false;
1917
+  }
1918
+  yyTimeChange(e) {
1919
+    if (this.yyTime) {
1920
+      let now = new Date();
1921
+      // 禁用日期(其他)
1922
+      if (getHours(this.yyTime) < getHours(now)) {
1923
+        this.disabledyyDate = (current: Date): boolean => {
1924
+          return differenceInCalendarDays(current, new Date()) < 1;
1925
+        };
1926
+      } else {
1927
+        this.disabledyyDate = (current: Date): boolean => {
1928
+          return differenceInCalendarDays(current, new Date()) < 0;
1929
+        };
1930
+      }
1931
+      let end = this.getLgNumber(getMinutes(this.yyTime), this.inspectAndPatientTransportConfig.timeMod);
1932
+      this.yyTime = setMinutes(this.yyTime, end);
1933
+    }
1934
+    this.clickYYFlag = false;
1935
+  }
1936
+  // 需要预约建单-事件
1937
+  yyInspectChange(e) {
1938
+    if (this.currentTasktype.associationType.value === "other") {
1939
+      //其他临床服务
1940
+      this.yyTime = null;
1941
+      this.yyDate = new Date();
1942
+      console.log(this.isYyInspect);
1943
+    } else if (this.currentTasktype.associationType.value === "patientTransport") {
1944
+      //患者其他服务
1945
+      this.yyTimeZy = null;
1946
+      this.yyDateZy = new Date();
1947
+    }
1948
+  }
1766 1949
   // 转运类型选中类型(单选)触发
1767 1950
   goodsNow; //携带的物品列表
1951
+  yyDateZy = null; //预约日期-患者其他服务
1952
+  yyDate = null; //预约日期-其他临床服务
1953
+  yyTimeZy = null; //预约时间-患者其他服务
1954
+  yyTime = null; //预约时间-其他临床服务
1955
+  inspectAndPatientTransportConfig:any = {timeMod: 30};
1956
+  isYyInspect = false; //需要预约检查
1957
+  clickYYZyFlag = false; //是否点击预约建单-患者其他服务
1958
+  clickYYFlag = false; //是否点击预约建单-其他临床服务
1959
+  currentTasktype = null; //当前选中的任务类型对象
1768 1960
   radioChangeZy(value) {
1769 1961
     //任务类型id
1770 1962
     if (value === "" || value === null) {
@@ -1779,8 +1971,15 @@ export class FuwutaiComponent implements OnInit {
1779 1971
     // 返回值的status是204 则让前端自己调用科室搜索接口
1780 1972
     // 返回值的status是205 则是固定科室类型,会返回科室列表
1781 1973
     // 返回值的status是206 则是默认患者所在科室,把患者所在科室作为值
1782
-    this.mainService.getdeptList(value).subscribe((data) => {
1974
+    this.mainService.getdeptList(value).subscribe((data:any) => {
1783 1975
       this.deptZyList = data;
1976
+      // 预约start
1977
+      this.currentTasktype = data.taskType;
1978
+      this.isYyInspect = false;
1979
+      this.clickYYZyFlag = false;
1980
+      this.yyDateZy = new Date();
1981
+      this.yyTimeZy = null;
1982
+      // 预约end
1784 1983
       console.log(this.deptZyList);
1785 1984
       // 起点科室
1786 1985
       if (data["startStatus"] == 201 || data["startStatus"] == 206) {
@@ -1851,8 +2050,15 @@ export class FuwutaiComponent implements OnInit {
1851 2050
     // 返回值的status是203 则是固定科室,会返回单个科室
1852 2051
     // 返回值的status是204 则让前端自己调用科室搜索接口
1853 2052
     // 返回值的status是205 则是固定科室类型,会返回科室列表
1854
-    this.mainService.getdeptList(value).subscribe((data) => {
2053
+    this.mainService.getdeptList(value).subscribe((data:any) => {
1855 2054
       this.deptQtList = data;
2055
+      // 预约start
2056
+      this.currentTasktype = data.taskType;
2057
+      this.isYyInspect = false;
2058
+      this.clickYYFlag = false;
2059
+      this.yyDate = new Date();
2060
+      this.yyTime = null;
2061
+      // 预约end
1856 2062
       this.deptQtList.taskType.customRemarks = this.deptQtList.taskType
1857 2063
         .customRemarks
1858 2064
         ? this.deptQtList.taskType.customRemarks.split("$")
@@ -1891,6 +2097,24 @@ export class FuwutaiComponent implements OnInit {
1891 2097
   //新建工单->确定提交
1892 2098
   isGoLoading = false;
1893 2099
   newOrderOk(go?): void {
2100
+    if (this.isYyInspect && this.currentTabIndex == '259') {
2101
+      this.clickYYFlag = true;
2102
+    } else {
2103
+      this.clickYYFlag = false;
2104
+    }
2105
+    if (this.isYyInspect && this.currentTabIndex == '255') {
2106
+      this.clickYYZyFlag = true;
2107
+    } else {
2108
+      this.clickYYZyFlag = false;
2109
+    }
2110
+
2111
+    if (
2112
+      (!this.yyTime && this.currentTabIndex == '259' && this.isYyInspect) ||
2113
+      (!this.yyTimeZy && this.currentTabIndex == '255' && this.isYyInspect)
2114
+    ) {
2115
+      return;
2116
+    }
2117
+
1894 2118
     if (go !== "go") {
1895 2119
       this.isOkLoading = true;
1896 2120
     } else {