|
@@ -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 {
|