Browse Source

合并代码

seimin 9 months ago
parent
commit
6363990ef3
37 changed files with 5376 additions and 3 deletions
  1. 5 0
      src/app/app-routing.module.ts
  2. 17 0
      src/app/services/main.service.ts
  3. 9 0
      src/app/services/tool.service.ts
  4. 24 0
      src/app/views/admin-office-prescription/admin-office-prescription-routing.module.ts
  5. 222 0
      src/app/views/admin-office-prescription/admin-office-prescription.component.html
  6. 233 0
      src/app/views/admin-office-prescription/admin-office-prescription.component.less
  7. 868 0
      src/app/views/admin-office-prescription/admin-office-prescription.component.ts
  8. 19 0
      src/app/views/admin-office-prescription/admin-office-prescription.module.ts
  9. 14 0
      src/app/views/big-transfusion-set/big-transfusion-set-routing.module.ts
  10. 49 0
      src/app/views/big-transfusion-set/big-transfusion-set.component.html
  11. 94 0
      src/app/views/big-transfusion-set/big-transfusion-set.component.less
  12. 195 0
      src/app/views/big-transfusion-set/big-transfusion-set.component.ts
  13. 17 0
      src/app/views/big-transfusion-set/big-transfusion-set.module.ts
  14. 20 0
      src/app/views/dispensing-batch/dispensing-batch-routing.module.ts
  15. 203 0
      src/app/views/dispensing-batch/dispensing-batch.component.html
  16. 260 0
      src/app/views/dispensing-batch/dispensing-batch.component.less
  17. 770 0
      src/app/views/dispensing-batch/dispensing-batch.component.ts
  18. 19 0
      src/app/views/dispensing-batch/dispensing-batch.module.ts
  19. 17 0
      src/app/views/dispensing-detail/dispensing-detail-routing.module.ts
  20. 142 0
      src/app/views/dispensing-detail/dispensing-detail.component.html
  21. 385 0
      src/app/views/dispensing-detail/dispensing-detail.component.less
  22. 386 0
      src/app/views/dispensing-detail/dispensing-detail.component.ts
  23. 19 0
      src/app/views/dispensing-detail/dispensing-detail.module.ts
  24. 17 0
      src/app/views/drug-cloud/drug-cloud-routing.module.ts
  25. 127 0
      src/app/views/drug-cloud/drug-cloud.component.html
  26. 251 0
      src/app/views/drug-cloud/drug-cloud.component.less
  27. 323 0
      src/app/views/drug-cloud/drug-cloud.component.ts
  28. 19 0
      src/app/views/drug-cloud/drug-cloud.module.ts
  29. 15 0
      src/app/views/drug-info/drug-info-routing.module.ts
  30. 184 0
      src/app/views/drug-info/drug-info.component.html
  31. 130 0
      src/app/views/drug-info/drug-info.component.less
  32. 271 0
      src/app/views/drug-info/drug-info.component.ts
  33. 19 0
      src/app/views/drug-info/drug-info.module.ts
  34. 25 0
      src/app/views/main/main-routing.module.ts
  35. 5 0
      src/app/views/main/main.component.html
  36. 2 2
      src/app/views/office-detail/office-detail.component.html
  37. 1 1
      src/app/views/office-detail/office-detail.component.ts

+ 5 - 0
src/app/app-routing.module.ts

@@ -83,6 +83,11 @@ const routes: Routes = [
83 83
     path: 'washingBatchView',
84 84
     loadChildren: () => import('./views/washing-batch-view/washing-batch-view.module').then(m => m.WashingBatchViewModule),
85 85
   },
86
+	{
87
+	  // 发药批次-配置
88
+	  path: 'dispensingDetail/:id',
89
+	  loadChildren: () => import('./views/dispensing-detail/dispensing-detail.module').then(m => m.DispensingDetailModule),
90
+	},
86 91
   // 洗涤批次视图
87 92
   {
88 93
     path: 'inspectionPlanConfig/:id',

+ 17 - 0
src/app/services/main.service.ts

@@ -817,4 +817,21 @@ export class MainService {
817 817
 	    headers: this.headers,
818 818
 	  });
819 819
 	}
820
+	// 科室发药单打印
821
+	transfusionPrint(model, id): any {
822
+	  return this.http.get(host.host + `/simple/data/fetchData/${model}/${id}`);
823
+	}
824
+	// 科室发药配送建单
825
+	transfusionBuildOrder(data): any {
826
+	  return this.http.post(host.host + "/infusion/solutions/createOrTakeOrder", data, {
827
+	    headers: this.headers,
828
+	  });
829
+	}
830
+	// 发药批次-配置科室删除
831
+	transfusionConfigDeptDel(data): any {
832
+	  return this.http.post(host.host + "/infusion/solutions/remove", data, {
833
+	    headers: this.headers,
834
+	  });
835
+	}
836
+	
820 837
 }

+ 9 - 0
src/app/services/tool.service.ts

@@ -158,6 +158,15 @@ export class ToolService {
158 158
         case "editNum":
159 159
           coopBtns.editNum = true; //矫正重量
160 160
           break;
161
+				case "establish":
162
+				  coopBtns.establish = true; //配送建单
163
+				  break;
164
+				case "historyRecord":
165
+				  coopBtns.historyRecord = true; //历史记录
166
+				  break;
167
+				case "batchPrint":
168
+				  coopBtns.batchPrint = true; //发药并打印
169
+				  break;
161 170
         case "config":
162 171
           coopBtns.config = true; //配置
163 172
           break;

+ 24 - 0
src/app/views/admin-office-prescription/admin-office-prescription-routing.module.ts

@@ -0,0 +1,24 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { AdminOfficePrescriptionComponent } from './admin-office-prescription.component';
4
+
5
+
6
+const routes: Routes = [
7
+  {
8
+    path: '',
9
+    component: AdminOfficePrescriptionComponent,
10
+    children: [
11
+      {
12
+        // 查看详情
13
+        path: 'officeDetail/:id',
14
+        loadChildren: () => import('../office-detail/office-detail.module').then(m => m.OfficeDetailModule),
15
+      }
16
+    ]
17
+  }
18
+];
19
+
20
+@NgModule({
21
+  imports: [RouterModule.forChild(routes)],
22
+  exports: [RouterModule]
23
+})
24
+export class AdminOfficePrescriptionRoutingModule { }

+ 222 - 0
src/app/views/admin-office-prescription/admin-office-prescription.component.html

@@ -0,0 +1,222 @@
1
+<div class="list-template">
2
+  <div class="list-template__content">
3
+    <div class="list-template__top" nz-row>
4
+      <div nz-col nzLg='20' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <span class="label">申请科室:</span>
7
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" (nzOnSearch)="changeInp($event)" nzServerSearch nzShowSearch nzAllowClear nzPlaceHolder="请选择申请科室" [(ngModel)]="department">
8
+            <ng-container *ngFor="let option of hospitals1">
9
+              <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
10
+            </ng-container>
11
+            <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
12
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
13
+            </nz-option>
14
+          </nz-select>
15
+        </div>
16
+        <div class="list-template__searchItem">
17
+          <span class="label">批次号:</span>
18
+          <input nz-input class="formItem" [(ngModel)]="batchNumber" placeholder="请输入批次号" nzSize="default" />
19
+        </div>
20
+        <div class="list-template__searchItem">
21
+          <span class="label">创建时间:</span>
22
+          <nz-range-picker [(ngModel)]="dateRange" nzFormat="yyyy-MM-dd"
23
+					(ngModelChange)="changeDate($event)"></nz-range-picker>
24
+        </div>
25
+      </div>
26
+      <div nz-col nzLg="4" class="list-template__btns">
27
+        <button class="btn default" (click)='search()'>搜索</button>
28
+        <button class="btn default ml8" (click)='reset()'>重置</button>
29
+      </div>
30
+    </div>
31
+    <div class="list-template__bottom">
32
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
33
+        [nzLoading]="loading1">
34
+        <thead>
35
+          <tr class="thead">
36
+            <th nzWidth="10%">单号|创建时间</th>
37
+            <th nzWidth="10%">批次号</th>
38
+            <th nzWidth="10%">申请科室</th>
39
+            <th nzWidth="7%">总件数</th>
40
+            <th nzWidth="7%">品类数</th>
41
+            <th nzWidth="7%">消耗总价</th>
42
+            <th nzWidth="7%">实发总价</th>
43
+            <th nzWidth="10%">取药药房</th>
44
+						<th nzWidth="7%">是否已建单</th>
45
+						<th nzWidth="6%">状态</th>
46
+            <th nzWidth="18%">操作</th>
47
+          </tr>
48
+        </thead>
49
+        <tbody v-if="listOfData && listOfData.length>0">
50
+          <tr *ngFor="let data of listOfData" (click)="selectedListData(data.id)">
51
+            <td>
52
+							<div>{{ data.packingNo}}</div>
53
+							<div>{{ data.createTime|date:'yyyy-MM-dd HH:mm'}}</div>
54
+						</td>
55
+            <td>{{ data.batch?data.batch.batchNo:'-' }}</td>
56
+            <td>{{ data.applyDeptDTO?data.applyDeptDTO.dept :'-' }}</td>
57
+            <td>{{ data.totalCount||'0' }}</td>
58
+            <td>{{data.kindCount||'0'}}</td>
59
+            <td>{{ data.expendPrice ||'0' }}</td>
60
+            <td>{{ data.actualPrice || '0'}}</td>
61
+            <td>{{ data.pharmacyDTO?data.pharmacyDTO.dept:'-'}}</td>
62
+						<td>{{ data.createOrder==1?'是':'否'}}</td>
63
+						<td>{{ data.orderState.name}}</td>
64
+            <td>
65
+              <div class="coop">
66
+                <span *ngIf="coopBtns.look" (click)="detail($event,data.id)">查看</span>
67
+                <span *ngIf="coopBtns.print" (click)="print($event, data, data.id)">打印</span>
68
+                <span *ngIf="coopBtns.establish && ( data.createOrder=='0' || data.createOrder==null)" (click)="addDateModal(data)">配送建单</span>
69
+              </div>
70
+            </td>
71
+          </tr>
72
+        </tbody>
73
+      </nz-table>
74
+      <div class="list-template__pagination">
75
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
76
+          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
77
+        </nz-pagination>
78
+      </div>
79
+    </div>
80
+  </div>
81
+
82
+  <!-- 新增/编辑模态框 -->
83
+  <div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
84
+    <div class="modalBody">
85
+      <div class="title">科室发药单-查看<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
86
+      </div>
87
+      <overlay-scrollbars #osComponentRef1 class="content">
88
+        <div class="list-template__bottom">
89
+          <nz-table class="list-template__nzTable" [nzData]="viewData" nzSize="middle" [nzShowPagination]="false"
90
+            [nzLoading]="loading1">
91
+            <thead>
92
+              <tr class="thead">
93
+								<th nzWidth="10%">药品标识</th>
94
+                <th nzWidth="10%">药品名称</th>
95
+                <th nzWidth="10%">规格</th>
96
+                <th nzWidth="10%">消耗数量</th>
97
+                <th nzWidth="10%">实发数量</th>
98
+                <th nzWidth="10%">包装规格</th>
99
+                <th nzWidth="10%">发药药箱</th>
100
+                <th nzWidth="10%">原库存数</th>
101
+                <th nzWidth="10%">计算后库存</th>
102
+        				<th nzWidth="10%">增减</th>
103
+              </tr>
104
+            </thead>
105
+            <tbody>
106
+              <tr *ngFor="let data of viewData">
107
+								<td>{{ data.drugsInfoDTO?data.drugsInfoDTO.drugCode:'无' }}</td>
108
+                <td>{{ data.drugsInfoDTO?data.drugsInfoDTO.drugName:'无' }}</td>
109
+                <td>{{ data.drugsInfoDTO?data.drugsInfoDTO.specs:'无' }}</td>
110
+                <td>{{ data.expendCount||'0' }}</td>
111
+                <td>{{ data.actualCount||'0' }}</td>
112
+                <td>{{ data.drugsInfoDTO?data.drugsInfoDTO.packingSpecs:'0' }}</td>
113
+                <td>{{ data.cartonNum || '0' }}</td>
114
+                <td>{{ data.formerInventory || '0' }}</td>
115
+                <td>{{ data.afterInventory || '0'}}</td>
116
+        				<td>{{ data.addSub || '0' }}</td>
117
+              </tr>
118
+            </tbody>
119
+          </nz-table>
120
+        <!--  <div class="list-template__pagination">
121
+            <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
122
+              (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
123
+            </nz-pagination>
124
+          </div> -->
125
+        </div>
126
+      </overlay-scrollbars>
127
+      <div class="display_flex justify-content_flex-center">
128
+        <button class="btn" nz-button nzType="primary" (click)="hideModal()">知道了</button>
129
+      </div>
130
+    </div>
131
+  </div>
132
+  <!-- 删除模态框 -->
133
+  <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
134
+    (confirmDelEvent)="confirmDel()" content="您确认要删除科室吗?"></app-dialog-delete>
135
+
136
+  <!-- 启用停用模态框 -->
137
+  <app-dialog-delete [delModal]="delModal1" (hideDelModalEvent)="hideDelModal1()" [btnLoading]="btnLoading"
138
+    (confirmDelEvent)="confirmDel1()" [content]="'您确认要建立配送工单吗?'"></app-dialog-delete>
139
+
140
+  <!-- 打印 -->
141
+  <div id="report" style="display: none;">
142
+		<div class="monad" 
143
+				*ngIf="rowData"
144
+				style="padding: 10px;
145
+				border: 1px solid #e7e7e7;
146
+				border-radius: 5px;">
147
+			<div class="monad-title" 
148
+				style="text-align: center;
149
+				font-weight: 700;
150
+				font-size: 16px;
151
+				border-bottom: 1px solid #e7e7e7;
152
+				padding-bottom: 10px;">
153
+				大输液发药单-{{rowData.applyDeptDTO?rowData.applyDeptDTO.dept:''}}
154
+			</div>
155
+			<div class="monad-sign" style="display: flex;line-height: 40px;font-size: 14px;">
156
+				<div style="margin-right: 15px;">日期:{{rowData.createTime|date:'yyyy-MM-dd HH:mm'}}</div>
157
+				<div style="margin-right: 15px;">批次号:{{rowData.batch?rowData.batch.batchNo:'-'}}</div>
158
+				<div style="margin-right: 15px;">单号:{{rowData.packingNo}}</div>
159
+			</div>
160
+			<div style="border: 1px solid #e7e7e7;border-bottom: none;font-size: 14px;">
161
+				<div class="thead" style="display: flex;">
162
+					<div style="text-align: center;width: 40%;height: 40px;
163
+					line-height: 40px;
164
+					border-right: 1px solid #e7e7e7;
165
+					border-bottom: 1px solid #e7e7e7;">药品名称</div>
166
+					
167
+					<div style="text-align: center;width: 20%;height: 40px;
168
+					line-height: 40px;
169
+					border-right: 1px solid #e7e7e7;
170
+					border-bottom: 1px solid #e7e7e7;">规格</div>
171
+					
172
+					<div style="text-align: center;width: 10%;height: 40px;
173
+					line-height: 40px;
174
+					border-right: 1px solid #e7e7e7;
175
+					border-bottom: 1px solid #e7e7e7;">总量</div>
176
+					
177
+					<div style="text-align: center;width: 10%;height: 40px;
178
+					line-height: 40px;
179
+					border-right: 1px solid #e7e7e7;
180
+					border-bottom: 1px solid #e7e7e7;">箱数</div>
181
+					
182
+					<div style="text-align: center;width: 20%;height: 40px;
183
+					line-height: 40px;border-bottom: 1px solid #e7e7e7;">取药药房</div>
184
+				</div>
185
+				<div *ngFor="let data of codes" style="display: flex;">
186
+					<div style="text-align: center;width: 40%;height: 40px;
187
+					line-height: 40px;
188
+					border-right: 1px solid #e7e7e7;
189
+					border-bottom: 1px solid #e7e7e7;">{{ data.drugsInfoDTO.drugName }}</div>
190
+					
191
+					<div style="text-align: center;width: 20%;height: 40px;
192
+					line-height: 40px;
193
+					border-right: 1px solid #e7e7e7;
194
+					border-bottom: 1px solid #e7e7e7;">{{ data.drugsInfoDTO.specs }}</div>
195
+					
196
+					<div style="text-align: center;width: 10%;height: 40px;
197
+					line-height: 40px;
198
+					border-right: 1px solid #e7e7e7;
199
+					border-bottom: 1px solid #e7e7e7;">{{ data.actualCount }}</div>
200
+					
201
+					<div style="text-align: center;width: 10%;height: 40px;
202
+					line-height: 40px;
203
+					border-right: 1px solid #e7e7e7;
204
+					border-bottom: 1px solid #e7e7e7;">{{ data.cartonNum }}</div>
205
+					
206
+					<div style="text-align: center;width: 20%;height: 40px;
207
+					line-height: 40px;border-bottom: 1px solid #e7e7e7;">{{ data.deptName }}</div>
208
+				</div>
209
+			</div>
210
+		</div>
211
+  </div>
212
+
213
+</div>
214
+<!-- 操作成功/失败提示框 -->
215
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
216
+  [info]="promptInfo"></app-prompt-modal>
217
+
218
+<!-- 查看详情 -->
219
+<router-outlet></router-outlet>
220
+<!-- 遮罩 -->
221
+<app-mask *ngIf="maskFlag"></app-mask>
222
+<app-excel-import [isShow]="isShow" (hideFormHand)="hideExcelImport($event)" *ngIf="isShow" (submitFormHand)="submitExcelImport($event)"></app-excel-import>

+ 233 - 0
src/app/views/admin-office-prescription/admin-office-prescription.component.less

@@ -0,0 +1,233 @@
1
+@import "../../../../src/theme.less";
2
+:host {
3
+  .add-button {
4
+    margin: 0 auto 16px !important;
5
+  }
6
+  .targetDept {
7
+    overflow: hidden;
8
+    // width: 90px;
9
+    text-overflow: ellipsis;
10
+    white-space: nowrap;
11
+  }
12
+  .dynamic {
13
+    margin-bottom: 16px;
14
+    display: flex;
15
+    align-items: center;
16
+    input {
17
+      width: 90%;
18
+    }
19
+    i {
20
+      margin-left: 8px;
21
+      cursor: pointer;
22
+      font-size: 18px;
23
+    }
24
+  }
25
+}
26
+
27
+.save {
28
+  position: fixed;
29
+  left: 0;
30
+  top: 0;
31
+  width: 100%;
32
+  height: 100%;
33
+  background: rgba(0, 0, 0, 0.4);
34
+  z-index: 99;
35
+
36
+  .modalBody {
37
+    width: 350px;
38
+    background: #fff;
39
+    border-radius: 5px;
40
+    padding: 10px 20px;
41
+    color: #333;
42
+
43
+    .title {
44
+      width: 100%;
45
+      text-align: center;
46
+      font-size: 18px;
47
+      position: relative;
48
+
49
+      i {
50
+        position: absolute;
51
+        right: 0;
52
+        top: 0;
53
+        font-size: 20px;
54
+        color: #666;
55
+        cursor: pointer;
56
+        padding: 0 5px;
57
+      }
58
+    }
59
+
60
+    .content {
61
+      width: 100%;
62
+      height: 117px;
63
+      background: #f9fafb;
64
+      border: 1px solid #e5e9ed;
65
+      border-radius: 5px;
66
+      overflow: hidden;
67
+      margin-top: 12px;
68
+
69
+      div {
70
+        text-align: center;
71
+        margin: 0;
72
+
73
+        &.icon {
74
+          margin-top: 17px;
75
+
76
+          i {
77
+            color: #34b349;
78
+            font-size: 30px !important;
79
+
80
+            &.transport-wenhao {
81
+              color: #f5a523;
82
+            }
83
+
84
+            &.transport-shibai {
85
+              color: #ff3a52;
86
+            }
87
+          }
88
+        }
89
+
90
+        &.defeat {
91
+          color: #333;
92
+          font-size: 18px;
93
+        }
94
+
95
+        &:nth-child(3) {
96
+          font-size: 14px;
97
+          color: #666;
98
+        }
99
+      }
100
+    }
101
+
102
+    button {
103
+      margin-top: 10px;
104
+
105
+      &.btn {
106
+        margin-left: 8px;
107
+      }
108
+    }
109
+  }
110
+
111
+  // 新增
112
+  &.add {
113
+    .modalBody {
114
+      width: 80%;
115
+      height: auto;
116
+
117
+      .content {
118
+        width: 100%;
119
+        height: auto;
120
+        padding: 19px 14px 0 14px;
121
+        max-height: 500px;
122
+        overflow-y: auto;
123
+				
124
+				.list-template__bottom {
125
+				  background: #f9fafb;
126
+				  border: 1px solid #e5e9ed;
127
+				  border-radius: 8px;
128
+				  padding-bottom: 56px;
129
+				  position: relative;
130
+				  .list-template__nzTable {
131
+				    padding: 16px 16px 0;
132
+				
133
+				    .thead {
134
+				      background-image: linear-gradient(to right, @bg-start, @bg-end);
135
+				
136
+				      th {
137
+				        background: transparent;
138
+				        color: #fff;
139
+				        text-align: center;
140
+				      }
141
+				    }
142
+				
143
+				    .ant-table-body {
144
+				      border-bottom: 1px solid #e5e9ed;
145
+				    }
146
+				
147
+				    .ant-table-tbody {
148
+				      tr {
149
+				        text-align: center;
150
+				        color: #333;
151
+				
152
+				        td {
153
+				          border: none;
154
+				
155
+				          &.tab_hover:hover{
156
+				            text-decoration: underline;
157
+				            cursor: pointer;
158
+				          }
159
+				
160
+				          .coop {
161
+				            button{
162
+				              color: #333;
163
+				            }
164
+				            span,button {
165
+				              display: inline-block;
166
+				              padding: 0 8px;
167
+				              cursor: pointer;
168
+				              position: relative;
169
+				
170
+				              &::after {
171
+				                content: "|";
172
+				                position: absolute;
173
+				                top: 0;
174
+				                right: 0;
175
+				              }
176
+				
177
+				              &:hover,
178
+				              &:active {
179
+				                color: @primary-color;
180
+				              }
181
+				
182
+				              &:nth-last-child(1) {
183
+				                &::after {
184
+				                  content: "";
185
+				                }
186
+				              }
187
+				            }
188
+				          }
189
+				        }
190
+				      }
191
+				    }
192
+				  }
193
+				  .list-template__pagination {
194
+				    height: 56px;
195
+				    display: flex;
196
+				    align-items: center;
197
+				    position: absolute;
198
+				    right: 8px;
199
+				  }
200
+				}
201
+				
202
+        .addForm {
203
+          .ant-form-item {
204
+            margin-bottom: 14px;
205
+
206
+            .ant-form-item-label {
207
+              line-height: 14px;
208
+              text-align: left;
209
+            }
210
+          }
211
+        }
212
+
213
+        .editForm {
214
+          .ant-form-item {
215
+            margin-bottom: 14px;
216
+
217
+            .ant-form-item-label {
218
+              line-height: 0;
219
+              text-align: left;
220
+            }
221
+          }
222
+        }
223
+      }
224
+
225
+      button {
226
+        &:nth-child(1) {
227
+          margin-right: 20px;
228
+        }
229
+      }
230
+    }
231
+  }
232
+}
233
+

+ 868 - 0
src/app/views/admin-office-prescription/admin-office-prescription.component.ts

@@ -0,0 +1,868 @@
1
+import { Component, OnInit, ViewChild} from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import {
4
+  FormBuilder,
5
+  Validators,
6
+  FormGroup,
7
+  FormControl,
8
+} from "@angular/forms";
9
+
10
+import { MainService } from "../../services/main.service";
11
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
12
+import { ToolService } from "../../services/tool.service";
13
+import { format, startOfDay, endOfDay } from "date-fns";
14
+import { NzMessageService } from "ng-zorro-antd";
15
+import { Subject } from "rxjs";
16
+import { debounceTime, filter } from "rxjs/operators";
17
+import host from "../../../assets/js/http";
18
+import { HttpRequest, HttpResponse, HttpClient } from '@angular/common/http';
19
+
20
+@Component({
21
+  selector: "app-admin-office-prescription",
22
+  templateUrl: "./admin-office-prescription.component.html",
23
+  styleUrls: ["./admin-office-prescription.component.less"],
24
+})
25
+export class AdminOfficePrescriptionComponent implements OnInit{
26
+  @ViewChild("osComponentRef1", {
27
+    read: OverlayScrollbarsComponent,
28
+    static: false,
29
+  })
30
+  osComponentRef1: OverlayScrollbarsComponent;
31
+  constructor(
32
+    private message: NzMessageService,
33
+    private fb: FormBuilder,
34
+    private route: ActivatedRoute,
35
+    private router: Router,
36
+    private mainService: MainService,
37
+    private tool: ToolService,
38
+    private http: HttpClient,
39
+  ) {}
40
+	
41
+  ngOnInit() {
42
+    this.searchParentDeptSubject.pipe(debounceTime(500)).subscribe((e) => {
43
+      // this.getAllParentdepart(v).subscribe((result) => {
44
+      //   this.isLoading = false;
45
+      //   if (result.status == 200) {
46
+      //     this.allParentdepart = result.list;
47
+      //   }
48
+      // });
49
+			this.isDeptLoading = true;
50
+			this.getDeparts(e);
51
+    });
52
+		this.hosId = this.tool.getCurrentHospital().id;
53
+    this.coopBtns = this.tool.initCoopBtns(this.route);
54
+    this.initForm();
55
+    this.getAllHospital();
56
+    // this.getType();
57
+    // this.getDeptHandoverType();
58
+  }
59
+  listOfData: any[] = []; //表格数据
60
+  promptContent: string; //操作提示框提示信息
61
+  ifSuccess: boolean; //操作成功/失败
62
+  promptInfo: string; //操作结果提示信息
63
+  promptModalShow: boolean; //操作提示框是否展示
64
+  modal: boolean = false; //新增/编辑模态框
65
+  add: boolean; //true:新增;false:编辑
66
+  validateForm: FormGroup; //新增/编辑表单
67
+  coopId: number; //表格中执行操作的id
68
+  department: ""; //所属科室
69
+	hosId: number; 
70
+	dateRange;//时间
71
+  batchNumber; //批次号
72
+  num; //编码
73
+  deptalias; //别名
74
+  type; //类型
75
+  deptHandoverType; //类型
76
+  pageIndex: number = 1; //页码
77
+  listLength: number = 10; //总条数
78
+  pageSize: number = 10; //每页条数
79
+  btnLoading: boolean = false; //确认按钮loading状态
80
+  printLoading: boolean = false; //批量打印按钮loading状态
81
+  deptPhones: any = []; //新添加的科室电话列表
82
+  isAddDeptsPhone = true; //添加新的科室电话是否禁用
83
+  deptsPhoneId = 1; //科室电话自增id
84
+  allParentdepart: any = []; //所有的父级科室列表
85
+  hospitals1: any = []; //科室列表(搜索)
86
+	rowData: object = {}; //打印选择列表
87
+  searchParentDeptSubject = new Subject();
88
+  // 初始化增删改按钮
89
+  coopBtns: any = {};
90
+	viewData: any = []; //科室单查看数据
91
+  // 模板导出
92
+  excelExport(){
93
+    this.maskFlag = this.message.loading("下载模板中..", {
94
+      nzDuration: 0,
95
+    }).messageId;
96
+    this.mainService.exportExcel("department", {}).subscribe(
97
+      (data) => {
98
+        this.message.remove(this.maskFlag);
99
+        this.maskFlag = false;
100
+        this.message.success('下载模板成功');
101
+        var file = new Blob([data], {
102
+          type: "application/vnd.ms-excel",
103
+        });
104
+        //trick to download store a file having its URL
105
+        var fileURL = URL.createObjectURL(file);
106
+        var a = document.createElement("a");
107
+        a.href = fileURL;
108
+        a.target = "_blank";
109
+        a.download = "科室导入模板.xls";
110
+        document.body.appendChild(a);
111
+        a.click();
112
+      },
113
+      (err) => {
114
+        this.message.remove(this.maskFlag);
115
+        this.maskFlag = false;
116
+        this.message.error('下载模板失败');
117
+      }
118
+    );
119
+  }
120
+
121
+  // 导入---start
122
+  // model-取消
123
+  isShow = false;
124
+  hideExcelImport() {
125
+    this.isShow = false;
126
+  }
127
+  // 触发
128
+  excelImport() {
129
+    this.isShow = true;
130
+  }
131
+  submitExcelImport({fileList}){
132
+    this.isShow = false;
133
+    const formData = new FormData();
134
+    fileList.forEach((file: any) => {
135
+      formData.append('file', file);
136
+    });
137
+    this.maskFlag = this.message.loading("正在导入中..", {
138
+      nzDuration: 0,
139
+    }).messageId;
140
+    const req = new HttpRequest('Post', host.host + '/user/data/importExcel/department', formData, {
141
+      reportProgress: true
142
+    });
143
+    this.http
144
+      .request(req)
145
+      .pipe(filter(e => e instanceof HttpResponse))
146
+      .subscribe(
147
+        (res:any) => {
148
+          if(res.body.status == 200){
149
+            this.message.remove(this.maskFlag);
150
+            this.maskFlag = false;
151
+            this.message.success('导入成功');
152
+            this.getList();
153
+          }else{
154
+            this.message.remove(this.maskFlag);
155
+            this.maskFlag = false;
156
+            this.showPromptModal("导入", false, res.body.msg);
157
+          }
158
+        },
159
+        () => {
160
+          this.message.remove(this.maskFlag);
161
+          this.maskFlag = false;
162
+          this.message.error('导入失败');
163
+        },
164
+      );
165
+  }
166
+  // 导入---end
167
+  //搜索父级科室
168
+	isDeptLoading = false;
169
+  changeInp(e) {
170
+    this.searchParentDeptSubject.next(e);
171
+  }
172
+  // 打开父级科室下拉框baba
173
+  isLoading = false;
174
+  openDeptSelect(flag) {
175
+    if (flag) {
176
+      this.isLoading = true;
177
+      this.getAllParentdepart().subscribe((result) => {
178
+        this.isLoading = false;
179
+        if (result.status == 200) {
180
+          this.allParentdepart = result.list;
181
+        }
182
+      });
183
+    }
184
+  }
185
+  // 配送建单
186
+  coopData:any = {};
187
+  addDateModal(data) {
188
+    this.coopData = data;
189
+    this.showDelModal1();
190
+  }
191
+  delModal1: boolean = false; //删除模态框
192
+
193
+  showDelModal1() {
194
+    this.delModal1 = true;
195
+  }
196
+  hideDelModal1() {
197
+    this.delModal1 = false;
198
+  }
199
+  // 确认配送工单
200
+  confirmDel1() {
201
+    this.btnLoading = true;
202
+    this.mainService
203
+      .transfusionBuildOrder({
204
+				drugsListId:this.coopData.id
205
+			})
206
+      .subscribe((data) => {
207
+        this.btnLoading = false;
208
+        this.delModal1 = false;
209
+        if (data.status == 200) {
210
+          this.showPromptModal('操作', true, "");
211
+        } else {
212
+          this.showPromptModal('操作', false, data.msg);
213
+        }
214
+      });
215
+  }
216
+  //获取所有的父级科室列表
217
+  getAllParentdepart(keyWord = "") {
218
+    let postData: any = {
219
+      idx: 0,
220
+      sum: 10,
221
+      department: {
222
+        // hospital: { id: this.add ? this.tool.getCurrentHospital().id : this.hospital },
223
+        keyWord: keyWord,
224
+      },
225
+    };
226
+    if (this.coopItem) {
227
+      // 过滤这个科室及其子科室
228
+      postData.department.filterByDeptId = this.coopItem.id;
229
+    }
230
+    return this.mainService.getFetchDataList("data", "department", postData);
231
+  }
232
+  // 新添加科室号码
233
+  addDeptPhone(e: MouseEvent) {
234
+    e.preventDefault();
235
+    this.deptPhones.push({ id: ++this.deptsPhoneId, phone: "" });
236
+    this.deptsPhoneChange();
237
+  }
238
+  // 删除新添加科室号码
239
+  removeDeptPhone(index: number, e: MouseEvent) {
240
+    e.preventDefault();
241
+    this.deptPhones.splice(index, 1);
242
+    this.deptsPhoneChange();
243
+  }
244
+  //监听科室电话输入事件
245
+  deptsPhoneChange(e?, phone?) {
246
+    if (e !== undefined && phone !== undefined) {
247
+      phone.phone = e;
248
+    }
249
+    // -------------判断添加按钮是否禁用 start
250
+    this.isAddDeptsPhone = !this.validateForm.value.officeNum;
251
+    if (!this.isAddDeptsPhone) {
252
+      //如果没禁用
253
+      this.isAddDeptsPhone = this.deptPhones.some((item) => item.phone === "");
254
+    }
255
+    // -------------判断添加按钮是否禁用 end
256
+  }
257
+
258
+  // 搜索
259
+  search() {
260
+    this.pageIndex = 1;
261
+    this.getList();
262
+  }
263
+  // 重置
264
+  reset() {
265
+    this.pageIndex = 1;
266
+    this.department = null;
267
+    this.batchNumber = "";
268
+		this.dateRange = [];
269
+		this.startDate = "";
270
+		this.endDate = "";
271
+    this.getList();
272
+  }
273
+  // 表格数据
274
+  loading1 = false;
275
+  getList() {
276
+    var that = this;
277
+    let data = {
278
+      idx: that.pageIndex - 1,
279
+      sum: that.pageSize,
280
+      drugsList: {
281
+        applyDept: that.department,
282
+				batch:{
283
+					batchNo:that.batchNumber
284
+				},
285
+        startTime: this.startDate,
286
+				endTime: this.endDate,
287
+				hosId: this.hosId
288
+      },
289
+    };
290
+		if(that.department){
291
+			data.drugsList.applyDept = that.department
292
+		}else{
293
+			delete data.drugsList.applyDept
294
+		}
295
+		if(that.batchNumber){
296
+			data.drugsList.batch.batchNo = that.batchNumber
297
+		}else{
298
+			delete data.drugsList.batch
299
+		}
300
+    this.loading1 = true;
301
+    that.mainService
302
+      .getFetchDataList("data", "drugsList", data)
303
+      .subscribe((data) => {
304
+        this.loading1 = false;
305
+        that.listOfData = data.list;
306
+        that.listLength = data.totalNum;
307
+      });
308
+  }
309
+	
310
+	// 日期选择
311
+	startDate: string; //发起时间开始
312
+	endDate: string; //发起时间结束
313
+	changeDate(result?): void {
314
+	  if (!result) {
315
+	    this.startDate = this.endDate = "";
316
+	    return;
317
+	  }
318
+	  this.startDate = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
319
+	  this.endDate = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
320
+	}
321
+	
322
+	// 获取所有科室
323
+  // snum = 0;
324
+  getDeparts(dept) {
325
+    var that = this;
326
+    let data = {
327
+      department: {
328
+        dept,
329
+        hospital: {
330
+          id: this.hosId
331
+        },
332
+      },
333
+      idx: 0,
334
+      sum: 20,
335
+    };
336
+    that.mainService
337
+		.getFetchDataList("data", "department", data)
338
+		.subscribe((data) => {
339
+			setTimeout(_=>{
340
+				this.isDeptLoading = false
341
+				this.hospitals1 = data.list
342
+			},500)
343
+		});
344
+  }
345
+	
346
+  // 获取所有院区
347
+  getAllHospital() {
348
+		this.getDeparts('')
349
+    this.getList();
350
+  }
351
+
352
+  // 切换院区选项
353
+  buildings: any = []; //楼栋
354
+  maskFlag: any = false;
355
+  changeHosp(obj?) {
356
+    let hospitalId;
357
+    if (obj) {
358
+      hospitalId = obj.hospital.id;
359
+    }
360
+    let hid;
361
+    if (hospitalId || hospitalId == 0) {
362
+      hid = hospitalId - 0;
363
+    } 
364
+		// else {
365
+  //     hid = this.hospital - 0;
366
+  //   }
367
+    let data = {
368
+      // hosId: this.add ? this.tool.getCurrentHospital().id : hid,
369
+    };
370
+    this.maskFlag = this.message.loading("正在加载中..", {
371
+      nzDuration: 0,
372
+    }).messageId;
373
+    this.mainService
374
+      .coopData("getBuildingOrFloor", "building", data)
375
+      .subscribe((data) => {
376
+        this.buildings = data.data;
377
+        this.floors = [];
378
+        // ---------
379
+        if (obj) {
380
+          //编辑
381
+          let arr = this.buildings.map((item) => item.id);
382
+          if (obj.building.id && arr.includes(obj.building.id)) {
383
+            //有楼栋
384
+            this.changeBuilding(obj.building.id, obj);
385
+            this.validateForm.controls.building.setValue(obj.building.id + "");
386
+          } else {
387
+            //无楼栋
388
+            this.floors = [];
389
+            this.message.remove(this.maskFlag);
390
+            this.maskFlag = false;
391
+            this.modal = true;
392
+            this.validateForm.controls.building.setValue(null);
393
+            this.validateForm.controls.officeAddress.setValue(null);
394
+          }
395
+        } else {
396
+          //新增
397
+          this.message.remove(this.maskFlag);
398
+          this.maskFlag = false;
399
+          this.modal = true;
400
+        }
401
+        // ---------
402
+      });
403
+  }
404
+
405
+  // 切换楼栋信息
406
+  floors: Array<any> = []; //楼层
407
+  floorLoading: boolean = false;
408
+  changeBuilding(buildingId?, obj?) {
409
+    var that = this;
410
+    that.floors = [];
411
+    var bid;
412
+    if (buildingId || buildingId == 0) {
413
+      bid = buildingId - 0;
414
+    } else if (!that.add && that.validateForm.value.building) {
415
+      bid = that.validateForm.value.building - 0;
416
+    } else {
417
+      return;
418
+    }
419
+    let data = {
420
+      buildingId: bid,
421
+    };
422
+    this.floorLoading = true;
423
+    that.mainService
424
+      .coopData("getBuildingOrFloor", "floor", data)
425
+      .subscribe((data) => {
426
+        this.floorLoading = false;
427
+        this.message.remove(this.maskFlag);
428
+        this.maskFlag = false;
429
+        this.modal = true;
430
+        that.floors = data.data;
431
+        if (obj) {
432
+          let floorId = obj.floor.id;
433
+          let arr = that.floors.map((item) => item["id"]);
434
+          if (floorId && arr.includes(floorId)) {
435
+            this.validateForm.controls.floor.setValue(floorId + "");
436
+          } else {
437
+            this.validateForm.controls.floor.setValue(null);
438
+            this.validateForm.controls.officeAddress.setValue(null);
439
+          }
440
+        }
441
+      });
442
+  }
443
+
444
+  // 获取科室类型
445
+  types: Array<any> = [];
446
+  getType() {
447
+    var that = this;
448
+    that.mainService.getDictionary("list", "dept_type").subscribe((data) => {
449
+      console.log(data);
450
+      that.types = data;
451
+    });
452
+  }
453
+
454
+  // 获取科室汇总交接类型
455
+  deptHandoverTypes: Array<any> = [];
456
+  getDeptHandoverType() {
457
+    var that = this;
458
+    that.mainService.getDictionary("list", "dept_handover_type").subscribe((data) => {
459
+      console.log(data);
460
+      that.deptHandoverTypes = data;
461
+    });
462
+  }
463
+
464
+  // 新增弹框
465
+  showModal() {
466
+    this.initForm();
467
+    // this.changeHosp();
468
+    this.add = true;
469
+    this.isAddDeptsPhone = true;
470
+    this.deptPhones = [];
471
+  }
472
+  hideModal() {
473
+    this.coopItem = null;
474
+    this.modal = false;
475
+    this.initForm();
476
+  }
477
+  // 初始化新增form表单
478
+  initForm() {
479
+    this.endTime1Hourdis = () => [];
480
+    this.endTime1Mindis = () => [];
481
+    this.endTime2Hourdis = () => [];
482
+    this.endTime2Mindis = () => [];
483
+    this.startTime1Hourdis = () => [];
484
+    this.startTime1Mindis = () => [];
485
+    this.startTime2Hourdis = () => [];
486
+    this.startTime2Mindis = () => [];
487
+    this.validateForm = this.fb.group({
488
+      parentOfficeName: [null],
489
+      officeName: [null, [Validators.required]],
490
+      deptalias: [null],
491
+      officeNo: [null, [Validators.required]],
492
+      officeNum: [null, [Validators.required]],
493
+      building: [null, [Validators.required]],
494
+      floor: [null, [Validators.required]],
495
+      officeAddress: [null, [Validators.required]],
496
+      officeType: [null, [Validators.required]],
497
+      deptHandoverType: [null],
498
+      startTime1: [null],
499
+      endTime1: [null],
500
+      dynamicCode1: [null],
501
+      startTime2: [null],
502
+      endTime2: [null],
503
+      dynamicCode2: [null],
504
+    });
505
+  }
506
+  // 科室位置必填
507
+  buildValidator = (control: FormControl): { [s: string]: boolean } => {
508
+    if (
509
+      this.validateForm &&
510
+      this.validateForm.value &&
511
+      (!this.validateForm.value.building ||
512
+        !this.validateForm.value.floor ||
513
+        !this.validateForm.value.officeAddress)
514
+    ) {
515
+      return { required: true };
516
+    }
517
+  };
518
+  /**
519
+   * 生成一个从 start 到 end 的连续数组
520
+   * @param start
521
+   * @param end
522
+   */
523
+  generateArray(start, end) {
524
+    return Array.from(new Array(end).keys()).slice(start);
525
+  }
526
+
527
+  //服务时间选择
528
+  // 禁用的小时
529
+  startTime1Hourdis() {
530
+    return [];
531
+  }
532
+  endTime1Hourdis() {
533
+    return [];
534
+  }
535
+  startTime2Hourdis() {
536
+    return [];
537
+  }
538
+  endTime2Hourdis() {
539
+    return [];
540
+  }
541
+  // 禁用的分钟
542
+  startTime1Mindis() {
543
+    return [];
544
+  }
545
+  endTime1Mindis() {
546
+    return [];
547
+  }
548
+  startTime2Mindis() {
549
+    return [];
550
+  }
551
+  endTime2Mindis() {
552
+    return [];
553
+  }
554
+  timeChange(e: boolean, type: string, num: number) {
555
+    if (!e && this.validateForm.value[type + num]) {
556
+      let hour = new Date(this.validateForm.value[type + num]).getHours();
557
+      let minute = new Date(this.validateForm.value[type + num]).getMinutes();
558
+      if (type == "startTime" && num === 1) {
559
+        this.endTime1Hourdis = () => this.generateArray(0, hour);
560
+        this.endTime1Mindis = () => this.generateArray(0, minute + 1);
561
+      } else if (type == "startTime" && num === 2) {
562
+        this.endTime2Hourdis = () => this.generateArray(0, hour);
563
+        this.endTime2Mindis = () => this.generateArray(0, minute + 1);
564
+      } else if (type == "endTime" && num === 1) {
565
+        this.startTime1Hourdis = () => this.generateArray(hour + 1, 24);
566
+        this.startTime1Mindis = () => this.generateArray(minute, 60);
567
+      } else if (type == "endTime" && num === 2) {
568
+        this.startTime2Hourdis = () => this.generateArray(hour + 1, 24);
569
+        this.startTime2Mindis = () => this.generateArray(minute, 60);
570
+      }
571
+    }
572
+  }
573
+  // 表单提交
574
+  submitForm(): void {
575
+    var that = this;
576
+    for (const i in that.validateForm.controls) {
577
+      that.validateForm.controls[i].markAsDirty();
578
+      that.validateForm.controls[i].updateValueAndValidity();
579
+    }
580
+    console.log(that.validateForm);
581
+    if (that.validateForm.invalid) return;
582
+    let deptsPhone = this.deptPhones.map((item) => item.phone).join();
583
+    let data: any = {
584
+      department: {
585
+        dept: that.validateForm.value.officeName,
586
+        deptalias: that.validateForm.value.deptalias,
587
+        // hospital: { id: that.add ? that.tool.getCurrentHospital().id : that.hospital },
588
+        pcode: that.validateForm.value.officeNo,
589
+        manyPhone: deptsPhone
590
+          ? that.validateForm.value.officeNum + "," + deptsPhone
591
+          : that.validateForm.value.officeNum,
592
+        building: { id: that.validateForm.value.building - 0 },
593
+        floor: { id: that.validateForm.value.floor - 0 },
594
+        address: that.validateForm.value.officeAddress,
595
+        type: { id: that.validateForm.value.officeType },
596
+        deptHandoverType: { id: that.validateForm.value.deptHandoverType },
597
+      },
598
+    };
599
+    if (this.validateForm.value.parentOfficeName) {
600
+      data.department.parent = { id: this.validateForm.value.parentOfficeName };
601
+    }
602
+    if (
603
+      this.validateForm.value.startTime1 ||
604
+      this.validateForm.value.endTime1
605
+    ) {
606
+      if (
607
+        this.validateForm.value.startTime1 &&
608
+        this.validateForm.value.endTime1
609
+      ) {
610
+        data.department["startTime1"] = format(
611
+          this.validateForm.value.startTime1,
612
+          "yyyy-MM-dd HH:mm:ss"
613
+        );
614
+        data.department["endTime1"] = format(
615
+          this.validateForm.value.endTime1,
616
+          "yyyy-MM-dd HH:mm:ss"
617
+        );
618
+        data.department["dynamicCode1"] = this.validateForm.value.dynamicCode1 ? 1 : 0;
619
+      } else {
620
+        return;
621
+      }
622
+    }
623
+    if (
624
+      this.validateForm.value.startTime2 ||
625
+      this.validateForm.value.endTime2
626
+    ) {
627
+      if (
628
+        this.validateForm.value.startTime2 &&
629
+        this.validateForm.value.endTime2
630
+      ) {
631
+        data.department["startTime2"] = format(
632
+          this.validateForm.value.startTime2,
633
+          "yyyy-MM-dd HH:mm:ss"
634
+        );
635
+        data.department["endTime2"] = format(
636
+          this.validateForm.value.endTime2,
637
+          "yyyy-MM-dd HH:mm:ss"
638
+        );
639
+        data.department["dynamicCode2"] = this.validateForm.value.dynamicCode2 ? 1 : 0;
640
+      } else {
641
+        return;
642
+      }
643
+    }
644
+    if (!that.add) {
645
+      data.department["id"] = that.coopId;
646
+    }
647
+    that.btnLoading = true;
648
+    that.mainService
649
+      .coopData(that.add ? "addData" : "updData", "department", data)
650
+      .subscribe((data) => {
651
+        that.btnLoading = false;
652
+        that.hideModal();
653
+        that.initForm();
654
+        if (data.status == 200) {
655
+          that.showPromptModal(that.add ? "新增" : "编辑", true, "");
656
+        } else {
657
+          that.showPromptModal(that.add ? "新增" : "编辑", false, data.msg);
658
+        }
659
+      });
660
+  }
661
+
662
+  // 编辑
663
+  coopItem: any = null;
664
+  edit(e, data) {
665
+    e.stopPropagation();
666
+    this.add = false;
667
+    this.coopId = data.id;
668
+    this.coopItem = data;
669
+    this.isAddDeptsPhone = false;
670
+    this.deptPhones = [];
671
+    let phones = data.manyPhone ? data.manyPhone.split(",") : [];
672
+    if (phones.length === 0) {
673
+      this.validateForm.controls.officeNum.setValue("");
674
+      this.deptPhones = [];
675
+    } else if (phones.length === 1) {
676
+      this.validateForm.controls.officeNum.setValue(phones[0]);
677
+      this.deptPhones = [];
678
+    } else {
679
+      this.validateForm.controls.officeNum.setValue(phones[0]);
680
+      this.deptPhones = phones.slice(1).map((item) => {
681
+        return {
682
+          id: ++this.deptsPhoneId,
683
+          phone: item,
684
+        };
685
+      });
686
+    }
687
+    if (data.startTime1 && data.endTime1) {
688
+      this.validateForm.controls.startTime1.setValue(new Date(data.startTime1));
689
+      this.validateForm.controls.endTime1.setValue(new Date(data.endTime1));
690
+      this.validateForm.controls.dynamicCode1.setValue(data.dynamicCode1 == 1);
691
+    }
692
+    if (data.startTime2 && data.endTime2) {
693
+      this.validateForm.controls.startTime2.setValue(new Date(data.startTime2));
694
+      this.validateForm.controls.endTime2.setValue(new Date(data.endTime2));
695
+      this.validateForm.controls.dynamicCode2.setValue(data.dynamicCode2 == 1);
696
+    }
697
+    this.validateForm.controls.officeAddress.setValue(data.address);
698
+    if (data.parent) {
699
+      this.getAllParentdepart(data.parent.dept).subscribe((res) => {
700
+        if (res.status == 200) {
701
+          this.allParentdepart = res.list;
702
+          this.validateForm.controls.parentOfficeName.setValue(data.parent.id);
703
+        }
704
+      });
705
+    }
706
+    this.validateForm.controls.officeName.setValue(data.dept);
707
+    this.validateForm.controls.deptalias.setValue(data.deptalias);
708
+    this.validateForm.controls.officeNo.setValue(data.pcode);
709
+    this.validateForm.controls.officeType.setValue(data.type.id + "");
710
+    this.validateForm.controls.deptHandoverType.setValue(data.deptHandoverType ? data.deptHandoverType.id + "" : null);
711
+    // this.changeHosp(data);
712
+    this.validateForm.controls.officeAddress.setValue(data.address);
713
+  }
714
+
715
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
716
+  showPromptModal(con, success, promptInfo?) {
717
+    this.promptModalShow = false;
718
+    this.promptContent = con;
719
+    this.ifSuccess = success;
720
+    this.promptInfo = promptInfo;
721
+    setTimeout(() => {
722
+      this.promptModalShow = true;
723
+    }, 100);
724
+    this.getList();
725
+  }
726
+
727
+  delModal: boolean = false; //删除模态框
728
+  coopIds: any;
729
+  coopFlag: any = false;
730
+  /**
731
+   *
732
+   * @param e 事件对象
733
+   * @param flag true是批量删除,false是单个删除
734
+   * @param id
735
+   */
736
+  showDelModal(e, flag, id) {
737
+    e.stopPropagation();
738
+    this.delModal = true;
739
+    this.coopFlag = flag;
740
+    if (flag) {
741
+      this.coopIds = id;
742
+    } else {
743
+      this.coopId = id;
744
+    }
745
+  }
746
+  hideDelModal() {
747
+    this.delModal = false;
748
+  }
749
+  // 确认删除
750
+  confirmDel() {
751
+    var that = this;
752
+    that.btnLoading = true;
753
+    that.mainService
754
+      .coopData(
755
+        "rmvData",
756
+        "department",
757
+        this.coopFlag ? this.coopIds : [that.coopId]
758
+      )
759
+      .subscribe((data) => {
760
+        that.btnLoading = false;
761
+        that.delModal = false;
762
+        if (data.data && data.data[0]) {
763
+          if (!data.data[0].msg) {
764
+            if (
765
+              that.listOfData.length == 1 &&
766
+              that.pageIndex == Math.ceil(that.listLength / that.pageSize)
767
+            ) {
768
+              that.listLength--;
769
+              that.pageIndex = Math.ceil(that.listLength / that.pageSize) || 1;
770
+            }
771
+            that.showPromptModal("删除", true, "");
772
+          } else {
773
+            that.showPromptModal("删除", false, data.data[0].msg);
774
+          }
775
+        } else {
776
+          that.showPromptModal("删除", false, "");
777
+        }
778
+      });
779
+  }
780
+
781
+  // 查看
782
+  detail(e, id) {
783
+    e.stopPropagation();
784
+		var that = this;
785
+		let data = {
786
+			idx: 0,
787
+			sum: 9999,
788
+			drugsConfigure: {
789
+			  hosId: this.hosId,
790
+			  drugListId: id
791
+			}
792
+		};
793
+		this.loading1 = true;
794
+		that.mainService
795
+		  .getFetchDataList("data", "drugsConfigure", data)
796
+		  .subscribe((data) => {
797
+		    this.loading1 = false;
798
+				this.modal = true
799
+		    that.viewData = data.list;
800
+		    // that.listLength = data.totalNum;
801
+		  });
802
+  }
803
+
804
+  // 选中表格中科室
805
+  mapOfCheckedId: { [key: string]: boolean } = {};
806
+  checkedDepIds = []; //已选中科室id
807
+  refreshStatus(): void {
808
+    this.isAllDisplayDataChecked = this.listOfData.every(
809
+      (item) => this.mapOfCheckedId[item.id]
810
+    );
811
+    let arr = [];
812
+    for (var k in this.mapOfCheckedId) {
813
+      if (this.mapOfCheckedId[k]) {
814
+        arr.push(Number(k));
815
+      }
816
+    }
817
+    this.checkedDepIds = arr;
818
+    console.log(this.checkedDepIds);
819
+  }
820
+  //表格整行选中
821
+  selectedListData(id) {
822
+    this.mapOfCheckedId[id] = !this.mapOfCheckedId[id];
823
+    this.refreshStatus();
824
+  }
825
+  // 全选
826
+  isAllDisplayDataChecked = false; //当前页是否全选
827
+  checkAll(value: boolean): void {
828
+    this.listOfData.forEach((item) => (this.mapOfCheckedId[item.id] = value));
829
+    this.refreshStatus();
830
+  }
831
+
832
+  // 打印
833
+  codes = []; //二维码
834
+  print(e, data, id) {
835
+		this.rowData = data
836
+    e.stopPropagation();
837
+    let that = this;
838
+    that.printLoading = true;
839
+    that.mainService
840
+      .transfusionPrint("drugsList", id)
841
+      .subscribe((res) => {
842
+				let arr = res.data.drugsConfigureDTOS;
843
+				for(let i of arr){
844
+					i.deptName = res.data.pharmacyDTO?res.data.pharmacyDTO.dept:'-'
845
+				}
846
+				arr.push({
847
+					drugsInfoDTO:{
848
+						drugName:'合计',
849
+						specs:'',
850
+					},
851
+					actualCount:res.data.totalActual,
852
+					cartonNum:res.data.totalCarton,
853
+					deptName:''
854
+				})
855
+        that.codes = arr
856
+        that.printLoading = false;
857
+        setTimeout(() => {
858
+          const printContent = document.getElementById("report");
859
+          const WindowPrt = window.open("", "", "width=1000,height=900");
860
+          WindowPrt.document.write(printContent.innerHTML);
861
+          WindowPrt.document.close();
862
+          WindowPrt.focus();
863
+          WindowPrt.print();
864
+          WindowPrt.close();
865
+        }, 500);
866
+      });
867
+  }
868
+}

+ 19 - 0
src/app/views/admin-office-prescription/admin-office-prescription.module.ts

@@ -0,0 +1,19 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+
4
+import { AdminOfficePrescriptionRoutingModule } from './admin-office-prescription-routing.module';
5
+import { AdminOfficePrescriptionComponent } from './admin-office-prescription.component';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+
8
+
9
+@NgModule({
10
+  declarations: [
11
+    AdminOfficePrescriptionComponent,
12
+  ],
13
+  imports: [
14
+    CommonModule,
15
+    AdminOfficePrescriptionRoutingModule,
16
+    ShareModule
17
+  ]
18
+})
19
+export class AdminOfficePrescriptionModule { }

+ 14 - 0
src/app/views/big-transfusion-set/big-transfusion-set-routing.module.ts

@@ -0,0 +1,14 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { BigTransfusionSetComponent } from './big-transfusion-set.component';
4
+
5
+
6
+const routes: Routes = [
7
+  { path: '', component: BigTransfusionSetComponent }
8
+];
9
+
10
+@NgModule({
11
+  imports: [RouterModule.forChild(routes)],
12
+  exports: [RouterModule]
13
+})
14
+export class BigTransfusionSetRoutingModule { }

+ 49 - 0
src/app/views/big-transfusion-set/big-transfusion-set.component.html

@@ -0,0 +1,49 @@
1
+<div class="TaskTypeManagement">
2
+  <div class="taskTypeInfo">
3
+    <div class="top">
4
+      <div class="item" (click)="tabModal('characteristics')" [ngClass]="{'items':tabModalName=='characteristics'}">
5
+        特性配置
6
+      </div>
7
+      <div class="item" (click)="tabModal('automaticOrderCreation')" [ngClass]="{'items':tabModalName=='automaticOrderCreation'}">
8
+        自动建单配置
9
+      </div>
10
+    </div>
11
+    <div class="list" *ngIf="!loading">
12
+      <!-- 特性配置 -->
13
+      <div *ngIf="tabModalName=='characteristics'">
14
+       <!-- 任务类型 -->
15
+       <div class="display_flex align-items_center mb8">
16
+         <nz-form-label class="label" nzRequired>任务类型</nz-form-label>
17
+         <nz-select class="w320px" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch
18
+           (nzOnSearch)="changeTasktype($event)" nzPlaceHolder="请选择任务类型" [(ngModel)]="infusionSolutionsTypeId">
19
+           <ng-container *ngFor="let option of taskTypes1">
20
+             <nz-option *ngIf="!isLoading" [nzLabel]="option.taskName" [nzValue]="option.id"></nz-option>
21
+           </ng-container>
22
+           <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
23
+             <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
24
+           </nz-option>
25
+         </nz-select>
26
+       </div>
27
+      </div>
28
+      <!-- 自动建单配置 -->
29
+      <div *ngIf="tabModalName=='automaticOrderCreation'">
30
+        <!-- 自动建单 -->
31
+        <div class="display_flex align-items_center mb8">
32
+          <nz-form-label class="label">自动建单</nz-form-label>
33
+          <nz-checkbox-group [(ngModel)]="autoCreateOrders"></nz-checkbox-group>
34
+        </div>
35
+      </div>
36
+      <div class="bottom">
37
+        <button class="login-form-button" nzType="primary" [nzLoading]="btnLoading" nz-button (click)="submitForm()">保存</button>
38
+      </div>
39
+    </div>
40
+    <div class="list" *ngIf="loading">
41
+      <div class="loadingFull display_flex justify-content_flex-center align-items_center">
42
+        <div class="loadingFullInner">
43
+          <img src="../../../assets/images/loading.gif" alt="">
44
+          <div>加载中...</div>
45
+        </div>
46
+      </div>
47
+    </div>
48
+  </div>
49
+</div>

+ 94 - 0
src/app/views/big-transfusion-set/big-transfusion-set.component.less

@@ -0,0 +1,94 @@
1
+@import "../../../../src/theme.less";
2
+:host {
3
+  width: 100%;
4
+  height: 100%;
5
+}
6
+.w320px {
7
+  width: 250px;
8
+}
9
+
10
+.TaskTypeManagement {
11
+  height: calc(100vh - 88px);
12
+  background: #f9fafb;
13
+  overflow: hidden;
14
+  padding: 16px 20px;
15
+
16
+  //任务类型管理-主体
17
+  .taskTypeInfo {
18
+    height: 100%;
19
+    border: 1px solid #e5e9ed;
20
+    background: #fff;
21
+    color: #333;
22
+    position: relative;
23
+
24
+    .top {
25
+      height: 61px;
26
+      line-height: 60px;
27
+      display: flex;
28
+      align-items: center;
29
+      border-bottom: 1px solid #e5e9ed;
30
+      position: relative;
31
+      z-index: 2;
32
+
33
+      .items {
34
+        background: #f0f6ed;
35
+      }
36
+
37
+      & > div {
38
+        border-right: 1px solid #e5e9ed;
39
+        width: 30%;
40
+        text-align: center; // display: flex;
41
+        // align-items: center;
42
+        cursor: pointer;
43
+
44
+        &:hover {
45
+          background: #f0f6ed;
46
+        }
47
+      }
48
+
49
+      &:nth-last-child(4) {
50
+        border: none;
51
+      }
52
+    }
53
+
54
+    .list {
55
+      width: 100%;
56
+      padding: 16px;
57
+      background: #fff;
58
+      height: 89%;
59
+      overflow: auto;
60
+
61
+      nz-form-label {
62
+        margin-left: 0px !important;
63
+      }
64
+
65
+      & > div {
66
+        background: #f9fafb;
67
+        border: 1px solid #e5e9ed;
68
+        border-radius: 10px 10px 0px 0px;
69
+        padding: 24px 120px;
70
+
71
+        .label {
72
+          margin-left: 16px;
73
+          font-size: 14px;
74
+          color: #333;
75
+        }
76
+      }
77
+
78
+      .bottom {
79
+        height: 60px;
80
+        border-radius: 0px 0px 10px 10px;
81
+        padding: 10px 240px 0px 240px;
82
+        border-top: 0px;
83
+
84
+        button {
85
+          width: 80px;
86
+          height: 34px;
87
+          display: block;
88
+          margin: 0 auto;
89
+        }
90
+      }
91
+    }
92
+  }
93
+}
94
+

+ 195 - 0
src/app/views/big-transfusion-set/big-transfusion-set.component.ts

@@ -0,0 +1,195 @@
1
+import { Component, OnInit } from "@angular/core";
2
+import { MainService } from 'src/app/services/main.service';
3
+import { ToolService } from 'src/app/services/tool.service';
4
+import { NzMessageService } from 'ng-zorro-antd';
5
+import { Subject } from 'rxjs';
6
+import { debounceTime } from 'rxjs/operators';
7
+
8
+@Component({
9
+  selector: "app-big-transfusion-set",
10
+  templateUrl: "./big-transfusion-set.component.html",
11
+  styleUrls: ["./big-transfusion-set.component.less"],
12
+})
13
+export class BigTransfusionSetComponent implements OnInit {
14
+  loading:boolean = false; //页面加载的loading
15
+  btnLoading:boolean = false; //提交按钮的loading
16
+  tabModalName:string = 'characteristics'; //当前选中的tab
17
+  surgeryField = null; //手术关联业务
18
+  hosId = this.tool.getCurrentHospital().id; //当前院区
19
+  // 接手术关联任务类型
20
+  infusionSolutionsTypeId:Number;
21
+  taskTypes1:any[] = [];
22
+  taskTypeData:{id:''};
23
+  // 苏醒室科室
24
+  recoveryDeptId:any;
25
+  recoveryDepts:any[] = [];
26
+  // 自动建单
27
+  autoCreateOrders:any[] = [
28
+    {label:'是否开启',value: 0}
29
+  ];
30
+  // 是否开通送回病房
31
+  autoSendWard:any[] = [
32
+    {label:'是否开启',value: 0}
33
+  ];
34
+  // 是否开通送回苏醒室
35
+  autoSendAwakeningRoom:any[] = [
36
+    {label:'是否开启',value: 0}
37
+  ];
38
+  // 是否开通关联手术清洁建单
39
+  autoRemandClean:any[] = [
40
+    {label:'是否开启',value: 0}
41
+  ];
42
+  // 是否开启手术即将开始通知
43
+  surgeryBegin:any[] = [
44
+    {label:'是否开启',value: 0}
45
+  ];
46
+  // 建单时间
47
+  autoTime:Date | null = null;
48
+  tasktype1Id:any;
49
+  tasktype2Id:any;
50
+  cleanTypeId:any;
51
+	associationTypeIds:any;
52
+	questionnaireManagementData:any; //调查问卷数据
53
+	questionnaireIds:Number; //问卷参数
54
+	intervalTime:string = ''; //间隔时间参数
55
+	taskTypeIds:any = []; //任务类型参数
56
+	editId:'';
57
+	targetData:any = [];
58
+	stateData:any = [];
59
+	// 间隔时间数据
60
+	timeData:any[] = [
61
+	  {label:'10',value: 10},
62
+		{label:'15',value: 15},
63
+		{label:'30',value: 30},
64
+		{label:'60',value: 60}
65
+	];
66
+  // 配置
67
+  configs:any = {};
68
+  searchTimerSubject = new Subject();
69
+  constructor(private mainService: MainService,private tool: ToolService,private msg: NzMessageService) {}
70
+
71
+  ngOnInit():void {
72
+    // todo
73
+    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
74
+      let fun = v[0];
75
+      fun.call(this, v[1], v[2], v[3]);
76
+    });
77
+    this.getTaskTypes('', true);
78
+  }
79
+
80
+  // 切换tab
81
+  tabModal(tabModalName:string){
82
+    this.tabModalName = tabModalName;
83
+  }
84
+
85
+  // 保存
86
+  submitForm() {
87
+    if(!this.infusionSolutionsTypeId){
88
+      this.msg.create("warning", "请选择任务类型!");
89
+      return;
90
+    }
91
+    let editData = {
92
+			id:'',
93
+			taskType:this.taskTypeData.id,
94
+			hosId: this.hosId,
95
+			infusionSolutionsTypeId:this.infusionSolutionsTypeId, //任务类型参数
96
+			autoCreate:0
97
+    };
98
+		if(this.editId){
99
+			editData.id = this.editId
100
+		}else{
101
+			delete editData.id 
102
+		}
103
+		if(this.autoCreateOrders[0].checked){
104
+			editData.autoCreate = 1
105
+		}else{
106
+			delete editData.autoCreate
107
+		}
108
+    this.btnLoading = true;
109
+    this.mainService
110
+      .simplePost("addData", "taskTypeConfig", editData)
111
+      .subscribe((result) => {
112
+        this.btnLoading = false;
113
+        if (result.status == 200) {
114
+          this.getConfig();
115
+        }
116
+      });
117
+  }
118
+	
119
+  // 用户输入搜索任务类型
120
+  isLoading: boolean = false;
121
+  changeTasktype(e) {
122
+    this.searchTimer(this.getTaskTypes, e, false);
123
+  }
124
+
125
+  // 边输入边搜索节流阀
126
+  searchTimer(fun, e, isFirst, type?) {
127
+    this.isLoading = true;
128
+    this.searchTimerSubject.next([fun, e, isFirst, type]);
129
+  }
130
+	
131
+  //获取关联任务类型
132
+  // 1 患者其他服务
133
+  // 2 其他临床服务
134
+  getTaskTypes(e:string = '', isFirst:boolean = false) {
135
+    isFirst && (this.loading = true);
136
+    let postData:any = {
137
+      idx: 0,
138
+      sum: 9999,
139
+      taskType: {
140
+        taskName: e,
141
+        simpleQuery: true,
142
+				associationType : {
143
+					key: 'association_types',
144
+					value: 'other'
145
+				},
146
+        hosId: {
147
+          id: this.hosId
148
+        }
149
+      }
150
+    };
151
+    this.isLoading = true;
152
+    this.mainService
153
+      .getFetchDataList("simple/data", "taskType", postData)
154
+      .subscribe((result) => {
155
+        this.isLoading = false;
156
+        if (result.status == 200) {
157
+          this.taskTypes1 = result.list || [];
158
+					this.getTaskTypesId();
159
+        }
160
+      });
161
+  }
162
+	
163
+	// 获取任务id
164
+	getTaskTypesId() {
165
+		this.mainService.getDictionary("list", "ordinary_field").subscribe((data) => {
166
+			this.taskTypeData = data.find(i=>i.value=='infusionSolutions')
167
+			this.getConfig();
168
+		});
169
+	}
170
+	
171
+  // 获取配置
172
+  getConfig() {
173
+    this.loading = true;
174
+    let postData = {
175
+      idx: 0,
176
+      sum: 10,
177
+      taskTypeConfig: {
178
+				hosId:this.hosId,
179
+				taskType:this.taskTypeData.id
180
+      }
181
+    };
182
+    this.mainService
183
+      .getFetchDataList("simple/data", "taskTypeConfig", postData)
184
+      .subscribe((result) => {
185
+        this.loading = false;
186
+        if (result.status == 200) {
187
+    			let data = result.list[0] || {};
188
+					this.editId = data.id
189
+					this.autoCreateOrders[0].checked = data.autoCreate == 1;
190
+    			this.infusionSolutionsTypeId = data.infusionSolutionsTypeId
191
+        }
192
+      });
193
+  }
194
+}
195
+

+ 17 - 0
src/app/views/big-transfusion-set/big-transfusion-set.module.ts

@@ -0,0 +1,17 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+
4
+import { BigTransfusionSetRoutingModule } from './big-transfusion-set-routing.module';
5
+import { ShareModule } from 'src/app/share/share.module';
6
+import { BigTransfusionSetComponent } from './big-transfusion-set.component';
7
+
8
+
9
+@NgModule({
10
+  declarations: [BigTransfusionSetComponent],
11
+  imports: [
12
+    CommonModule,
13
+    BigTransfusionSetRoutingModule,
14
+    ShareModule
15
+  ]
16
+})
17
+export class BigTransfusionSetModule { }

+ 20 - 0
src/app/views/dispensing-batch/dispensing-batch-routing.module.ts

@@ -0,0 +1,20 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { DispensingBatchComponent } from './dispensing-batch.component';
4
+
5
+
6
+const routes: Routes = [
7
+  {
8
+    path: '',
9
+    component: DispensingBatchComponent,
10
+    // children: [
11
+     
12
+    // ]
13
+  }
14
+];
15
+
16
+@NgModule({
17
+  imports: [RouterModule.forChild(routes)],
18
+  exports: [RouterModule]
19
+})
20
+export class DispensingBatchRoutingModule { }

+ 203 - 0
src/app/views/dispensing-batch/dispensing-batch.component.html

@@ -0,0 +1,203 @@
1
+<div class="list-template">
2
+  <div class="list-template__content">
3
+    <div class="list-template__top" nz-row>
4
+      <div nz-col nzLg='18' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <span class="label">批次号:</span>
7
+          <input nz-input class="formItem" [(ngModel)]="batchNumber" placeholder="请输入批次号" nzSize="default" />
8
+        </div>
9
+        <div class="list-template__searchItem">
10
+          <span class="label">创建时间:</span>
11
+          <nz-range-picker [(ngModel)]="dateRange" nzFormat="yyyy-MM-dd"
12
+					(ngModelChange)="changeDate($event)"></nz-range-picker>
13
+        </div>
14
+      </div>
15
+      <div nz-col nzLg="6" class="list-template__btns">
16
+        <button class="btn default" (click)='search()'>搜索</button>
17
+        <button class="btn default ml8" (click)='reset()'>重置</button>
18
+				<button *ngIf="coopBtns.add" class="btn default ml8" (click)='showModal()'>新增</button>
19
+      </div>
20
+    </div>
21
+    <div class="list-template__bottom">
22
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
23
+        [nzLoading]="loading1">
24
+        <thead>
25
+          <tr class="thead">
26
+            <th nzWidth="13%">批次号</th>
27
+            <th nzWidth="13%">创建时间</th>
28
+            <th nzWidth="13%">发药时间区间</th>
29
+            <th nzWidth="7%">发药科室</th>
30
+            <th nzWidth="7%">科室数</th>
31
+            <th nzWidth="7%">发药量</th>
32
+            <th nzWidth="7%">箱数</th>
33
+            <th nzWidth="10%">药品总价</th>
34
+						<th nzWidth="7%">状态</th>
35
+            <th nzWidth="16%">操作</th>
36
+          </tr>
37
+        </thead>
38
+        <tbody>
39
+          <tr *ngFor="let data of listOfData" (click)="selectedListData(data.id)">
40
+            <td>{{ data.batchNo || '-' }}</td>
41
+            <td>{{ data.createTime|date:'yyyy-MM-dd HH:mm' }}</td>
42
+            <td>
43
+							<div>{{ data.startTime|date:'yyyy-MM-dd HH:mm' }}至</div>
44
+							<div>{{ data.endTime|date:'yyyy-MM-dd HH:mm' }}</div>
45
+						</td>
46
+            <td>{{ data.pharmacyDTO?data.pharmacyDTO.dept:'-' }}</td>
47
+            <td>{{ data.deptNum || '0' }}</td>
48
+            <td>{{ data.drugNum || '0'}}</td>
49
+						<td>{{ data.cartonNum || '0' }}</td>
50
+						<td>{{ data.totalPrice || '0' }}</td>
51
+						<td>{{ data.batchState?data.batchState.name : '-' }}</td>
52
+            <td>
53
+              <div class="coop">
54
+								<span *ngIf="coopBtns.edit && data.batchState.name=='未发药'" (click)="edit($event,data)">编辑</span>
55
+								<span *ngIf="coopBtns.del && data.batchState.name=='未发药'" (click)="showDelModal($event,data.id)">删除</span>
56
+                <span *ngIf="coopBtns.config && data.batchState.name=='未发药'" (click)="detail($event,data)">配置</span>
57
+                <span *ngIf="coopBtns.print && data.batchState.name=='已发药'" (click)="print($event,data, data.id)">打印</span>
58
+                <span *ngIf="coopBtns.batchPrint && data.batchState.name=='未发药'" (click)="dispensingPrint($event, data, data.id)">发药并打印</span>
59
+              </div>
60
+            </td>
61
+          </tr>
62
+        </tbody>
63
+      </nz-table>
64
+      <div class="list-template__pagination">
65
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
66
+          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
67
+        </nz-pagination>
68
+      </div>
69
+    </div>
70
+  </div>
71
+
72
+  <!-- 新增/编辑模态框 -->
73
+  <div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
74
+    <div class="modalBody">
75
+      <div class="title">发药批次-{{add ? '新增' : '编辑'}}<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
76
+      </div>
77
+      <overlay-scrollbars #osComponentRef1 class="content">
78
+       <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
79
+       	<nz-form-item>
80
+       	  <nz-form-label nzRequired nzFor="dispensingTime">发药时间区间</nz-form-label>
81
+       	  <nz-form-control nzErrorTip="请选择发药时间区间!">
82
+       	    <nz-input-group>
83
+       				<nz-range-picker formControlName="dispensingTime" 
84
+							[nzShowTime]="{ nzFormat: 'yyyy-MM-dd HH:mm:ss' }" nzFormat="yyyy-MM-dd HH:mm:ss"
85
+							(ngModelChange)="formChangeDate($event)"></nz-range-picker>
86
+       			</nz-input-group>
87
+       	  </nz-form-control>
88
+       	</nz-form-item>
89
+       	<nz-form-item>
90
+       	  <nz-form-label nzRequired nzFor="department">取药科室</nz-form-label>
91
+       	  <nz-form-control nzErrorTip="请选择取药科室!">
92
+       	    <nz-input-group>
93
+       				<nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" (nzOnSearch)="changeInp($event)" nzServerSearch nzShowSearch nzPlaceHolder="请选择申请科室" formControlName="department">
94
+       				  <ng-container *ngFor="let option of hospitals1">
95
+       				    <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
96
+       				  </ng-container>
97
+       				  <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
98
+       				    <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
99
+       				  </nz-option>
100
+       				</nz-select>
101
+       			</nz-input-group>
102
+       	  </nz-form-control>
103
+       	</nz-form-item>
104
+       </form>
105
+      </overlay-scrollbars>
106
+      <div class="display_flex justify-content_flex-center">
107
+        <button class="btn" nz-button nzType="primary" (click)="submitForm()" [nzLoading]="btnLoading">{{add ? '保存并配置' : '保存'}}</button>
108
+				<button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
109
+      </div>
110
+    </div>
111
+  </div>
112
+  <!-- 删除模态框 -->
113
+  <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
114
+    (confirmDelEvent)="confirmDel()" content="您确认要删除发药批次吗?"></app-dialog-delete>
115
+
116
+  <!-- 编辑模态框 -->
117
+  <app-dialog-delete [delModal]="editModal" (hideDelModalEvent)="hideDelModal1()" [btnLoading]="saveLoading"
118
+    (confirmDelEvent)="confirmDel1()" [content]="'保存后会重置您的发药科室的药品信息,您确认吗?'"></app-dialog-delete>
119
+
120
+  <!-- 打印 -->
121
+  <div id="report" style="display: none">
122
+		<div class="monad" *ngFor="let item of printData"
123
+				style="padding: 10px;
124
+				border: 1px solid #e7e7e7;
125
+				border-radius: 5px;margin-bottom: 40px;">
126
+			<div class="monad-title" 
127
+				style="text-align: center;
128
+				font-weight: 700;
129
+				font-size: 16px;
130
+				border-bottom: 1px solid #e7e7e7;
131
+				padding-bottom: 10px;">
132
+				大输液发药单-{{item.applyDeptDTO.dept}}
133
+			</div>
134
+			<div class="monad-sign" style="display: flex;line-height: 40px;font-size: 14px;">
135
+				<div style="margin-right: 15px;">日期:{{item.createTime|date:'yyyy-MM-dd HH:mm'}}</div>
136
+				<div style="margin-right: 15px;">批次号:{{item.batch.batchNo}}</div>
137
+				<div style="margin-right: 15px;">单号:{{item.packingNo}}</div>
138
+			</div>
139
+			<div style="border: 1px solid #e7e7e7;border-bottom: none;font-size: 14px;">
140
+				<div class="thead" style="display: flex;">
141
+					<div style="text-align: center;width: 40%;height: 40px;
142
+					line-height: 40px;
143
+					border-right: 1px solid #e7e7e7;
144
+					border-bottom: 1px solid #e7e7e7;">药品名称</div>
145
+					
146
+					<div style="text-align: center;width: 20%;height: 40px;
147
+					line-height: 40px;
148
+					border-right: 1px solid #e7e7e7;
149
+					border-bottom: 1px solid #e7e7e7;">规格</div>
150
+					
151
+					<div style="text-align: center;width: 10%;height: 40px;
152
+					line-height: 40px;
153
+					border-right: 1px solid #e7e7e7;
154
+					border-bottom: 1px solid #e7e7e7;">总量</div>
155
+					
156
+					<div style="text-align: center;width: 10%;height: 40px;
157
+					line-height: 40px;
158
+					border-right: 1px solid #e7e7e7;
159
+					border-bottom: 1px solid #e7e7e7;">箱数</div>
160
+					
161
+					<div style="text-align: center;width: 20%;height: 40px;
162
+					line-height: 40px;border-bottom: 1px solid #e7e7e7;">取药药房</div>
163
+				</div>
164
+				<div *ngFor="let data of item.drugsConfigureDTOS" style="display: flex;">
165
+					<div style="text-align: center;width: 40%;height: 40px;
166
+					line-height: 40px;
167
+					border-right: 1px solid #e7e7e7;
168
+					border-bottom: 1px solid #e7e7e7;">{{ data.drugsInfoDTO.drugName }}</div>
169
+					
170
+					<div style="text-align: center;width: 20%;height: 40px;
171
+					line-height: 40px;
172
+					border-right: 1px solid #e7e7e7;
173
+					border-bottom: 1px solid #e7e7e7;">{{ data.drugsInfoDTO.specs }}</div>
174
+					
175
+					<div style="text-align: center;width: 10%;height: 40px;
176
+					line-height: 40px;
177
+					border-right: 1px solid #e7e7e7;
178
+					border-bottom: 1px solid #e7e7e7;">{{ data.actualCount }}</div>
179
+					
180
+					<div style="text-align: center;width: 10%;height: 40px;
181
+					line-height: 40px;
182
+					border-right: 1px solid #e7e7e7;
183
+					border-bottom: 1px solid #e7e7e7;">{{ data.cartonNum }}</div>
184
+					
185
+					<div style="text-align: center;width: 20%;height: 40px;
186
+					line-height: 40px;border-bottom: 1px solid #e7e7e7;">{{ data.deptName }}</div>
187
+				</div>
188
+			</div>
189
+		</div>
190
+  </div>
191
+
192
+</div>
193
+<!-- 操作成功/失败提示框 -->
194
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
195
+  [info]="promptInfo"></app-prompt-modal>
196
+
197
+ <!-- 模态框 -->
198
+<app-dialog-delete [delModal]="printModal" (hideDelModalEvent)="hidePrintModal()" [btnLoading]="btnLoading"
199
+  (confirmDelEvent)="confirmPrintDel()" [content]="'您确认发药并打印吗?打印同时会更新云库存并建立配送工单?'"></app-dialog-delete>
200
+		
201
+<!-- 遮罩 -->
202
+<app-mask *ngIf="maskFlag"></app-mask>
203
+<app-excel-import [isShow]="isShow" (hideFormHand)="hideExcelImport($event)" *ngIf="isShow" (submitFormHand)="submitExcelImport($event)"></app-excel-import>

+ 260 - 0
src/app/views/dispensing-batch/dispensing-batch.component.less

@@ -0,0 +1,260 @@
1
+@import "../../../../src/theme.less";
2
+:host {
3
+  .add-button {
4
+    margin: 0 auto 16px !important;
5
+  }
6
+  .targetDept {
7
+    overflow: hidden;
8
+    // width: 90px;
9
+    text-overflow: ellipsis;
10
+    white-space: nowrap;
11
+  }
12
+  .dynamic {
13
+    margin-bottom: 16px;
14
+    display: flex;
15
+    align-items: center;
16
+    input {
17
+      width: 90%;
18
+    }
19
+    i {
20
+      margin-left: 8px;
21
+      cursor: pointer;
22
+      font-size: 18px;
23
+    }
24
+  }
25
+}
26
+
27
+.save {
28
+  position: fixed;
29
+  left: 0;
30
+  top: 0;
31
+  width: 100%;
32
+  height: 100%;
33
+  background: rgba(0, 0, 0, 0.4);
34
+  z-index: 99;
35
+
36
+  .modalBody {
37
+    width: 350px;
38
+    background: #fff;
39
+    border-radius: 5px;
40
+    padding: 10px 20px;
41
+    color: #333;
42
+
43
+    .title {
44
+      width: 100%;
45
+      text-align: center;
46
+      font-size: 18px;
47
+      position: relative;
48
+
49
+      i {
50
+        position: absolute;
51
+        right: 0;
52
+        top: 0;
53
+        font-size: 20px;
54
+        color: #666;
55
+        cursor: pointer;
56
+        padding: 0 5px;
57
+      }
58
+    }
59
+
60
+    .content {
61
+      width: 100%;
62
+      height: 117px;
63
+      background: #f9fafb;
64
+      border: 1px solid #e5e9ed;
65
+      border-radius: 5px;
66
+      overflow: hidden;
67
+      margin-top: 12px;
68
+
69
+      div {
70
+        text-align: center;
71
+        margin: 0;
72
+
73
+        &.icon {
74
+          margin-top: 17px;
75
+
76
+          i {
77
+            color: #34b349;
78
+            font-size: 30px !important;
79
+
80
+            &.transport-wenhao {
81
+              color: #f5a523;
82
+            }
83
+
84
+            &.transport-shibai {
85
+              color: #ff3a52;
86
+            }
87
+          }
88
+        }
89
+
90
+        &.defeat {
91
+          color: #333;
92
+          font-size: 18px;
93
+        }
94
+
95
+        &:nth-child(3) {
96
+          font-size: 14px;
97
+          color: #666;
98
+        }
99
+      }
100
+    }
101
+
102
+    button {
103
+      margin-top: 10px;
104
+
105
+      &.btn {
106
+        margin-left: 8px;
107
+      }
108
+    }
109
+  }
110
+
111
+  // 新增
112
+  &.add {
113
+    .modalBody {
114
+      width: 420px;
115
+      height: auto;
116
+
117
+      .content {
118
+        width: 100%;
119
+        height: auto;
120
+        padding: 19px 14px 0 14px;
121
+        max-height: 500px;
122
+        overflow-y: auto;
123
+				
124
+				.ant-select{
125
+					width: 100%;
126
+				}
127
+				.ant-calendar-picker{
128
+					width: 100% !important;
129
+				}
130
+				.list-template__bottom {
131
+				  background: #f9fafb;
132
+				  border: 1px solid #e5e9ed;
133
+				  border-radius: 8px;
134
+				  padding-bottom: 56px;
135
+				  position: relative;
136
+				  .list-template__nzTable {
137
+				    padding: 16px 16px 0;
138
+				
139
+				    .thead {
140
+				      background-image: linear-gradient(to right, @bg-start, @bg-end);
141
+				
142
+				      th {
143
+				        background: transparent;
144
+				        color: #fff;
145
+				        text-align: center;
146
+				      }
147
+				    }
148
+				
149
+				    .ant-table-body {
150
+				      border-bottom: 1px solid #e5e9ed;
151
+				    }
152
+				
153
+				    .ant-table-tbody {
154
+				      tr {
155
+				        text-align: center;
156
+				        color: #333;
157
+				
158
+				        td {
159
+				          border: none;
160
+				
161
+				          &.tab_hover:hover{
162
+				            text-decoration: underline;
163
+				            cursor: pointer;
164
+				          }
165
+				
166
+				          .coop {
167
+				            button{
168
+				              color: #333;
169
+				            }
170
+				            span,button {
171
+				              display: inline-block;
172
+				              padding: 0 8px;
173
+				              cursor: pointer;
174
+				              position: relative;
175
+				
176
+				              &::after {
177
+				                content: "|";
178
+				                position: absolute;
179
+				                top: 0;
180
+				                right: 0;
181
+				              }
182
+				
183
+				              &:hover,
184
+				              &:active {
185
+				                color: @primary-color;
186
+				              }
187
+				
188
+				              &:nth-last-child(1) {
189
+				                &::after {
190
+				                  content: "";
191
+				                }
192
+				              }
193
+				            }
194
+				          }
195
+				        }
196
+				      }
197
+				    }
198
+				  }
199
+				  .list-template__pagination {
200
+				    height: 56px;
201
+				    display: flex;
202
+				    align-items: center;
203
+				    position: absolute;
204
+				    right: 8px;
205
+				  }
206
+				}
207
+				
208
+        .addForm {
209
+          .ant-form-item {
210
+            margin-bottom: 14px;
211
+
212
+            .ant-form-item-label {
213
+              line-height: 14px;
214
+              text-align: left;
215
+            }
216
+          }
217
+        }
218
+
219
+        .editForm {
220
+          .ant-form-item {
221
+            margin-bottom: 14px;
222
+
223
+            .ant-form-item-label {
224
+              line-height: 0;
225
+              text-align: left;
226
+            }
227
+          }
228
+        }
229
+      }
230
+
231
+      button {
232
+        &:nth-child(1) {
233
+          margin-right: 20px;
234
+        }
235
+      }
236
+    }
237
+  }
238
+}
239
+
240
+.monad{
241
+	margin-top: 20px;
242
+	.monad-list{
243
+		border: 1px solid #e7e7e7;
244
+		border-radius: 5px;
245
+		margin-bottom: 40px;
246
+		padding: 20px;
247
+	}
248
+	.monad-title{
249
+		text-align: center;
250
+		font-weight: 700;
251
+		font-size: 16px;
252
+	}
253
+	.monad-sign{
254
+		display: flex;
255
+		line-height: 30px;
256
+		div{
257
+			margin-right: 15px;
258
+		}
259
+	}
260
+}

+ 770 - 0
src/app/views/dispensing-batch/dispensing-batch.component.ts

@@ -0,0 +1,770 @@
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import {
4
+  FormBuilder,
5
+  Validators,
6
+  FormGroup,
7
+  FormControl,
8
+} from "@angular/forms";
9
+
10
+import { MainService } from "../../services/main.service";
11
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
12
+import { ToolService } from "../../services/tool.service";
13
+import { format, startOfDay, endOfDay, subDays} from "date-fns";
14
+import { NzMessageService } from "ng-zorro-antd";
15
+import { Subject } from "rxjs";
16
+import { debounceTime, filter } from "rxjs/operators";
17
+import host from "../../../assets/js/http";
18
+import { HttpRequest, HttpResponse, HttpClient } from '@angular/common/http';
19
+
20
+@Component({
21
+  selector: "app-dispensing-batch",
22
+  templateUrl: "./dispensing-batch.component.html",
23
+  styleUrls: ["./dispensing-batch.component.less"],
24
+})
25
+export class DispensingBatchComponent implements OnInit {
26
+  @ViewChild("osComponentRef1", {
27
+    read: OverlayScrollbarsComponent,
28
+    static: false,
29
+  })
30
+  osComponentRef1: OverlayScrollbarsComponent;
31
+  constructor(
32
+    private message: NzMessageService,
33
+    private fb: FormBuilder,
34
+    private route: ActivatedRoute,
35
+    private router: Router,
36
+    private mainService: MainService,
37
+    private tool: ToolService,
38
+    private http: HttpClient,
39
+  ) {}
40
+
41
+  ngOnInit() {
42
+    this.searchParentDeptSubject.pipe(debounceTime(500)).subscribe((e) => {
43
+			this.isDeptLoading = true;
44
+			this.getDeparts(e);
45
+    });
46
+		this.hosId = this.tool.getCurrentHospital().id;
47
+    this.coopBtns = this.tool.initCoopBtns(this.route);
48
+    this.initForm();
49
+    this.getAllHospital();
50
+    this.getType();
51
+    this.getDeptHandoverType();
52
+  }
53
+  listOfData: any[] = []; //表格数据
54
+  promptContent: string; //操作提示框提示信息
55
+  ifSuccess: boolean; //操作成功/失败
56
+  promptInfo: string; //操作结果提示信息
57
+  promptModalShow: boolean; //操作提示框是否展示
58
+  modal: boolean = false; //新增/编辑模态框
59
+  add: boolean; //true:新增;false:编辑
60
+  validateForm: FormGroup; //新增/编辑表单
61
+  coopId: number; //表格中执行操作的id
62
+  department: number; //所属科室
63
+	hosId: number; 
64
+	dateRange;//时间
65
+  batchNumber; //批次号
66
+  num; //编码
67
+  deptalias; //别名
68
+  type; //类型
69
+  deptHandoverType; //类型
70
+  pageIndex: number = 1; //页码
71
+  listLength: number = 10; //总条数
72
+  pageSize: number = 10; //每页条数
73
+  btnLoading: boolean = false; //确认按钮loading状态
74
+  printLoading: boolean = false; //批量打印按钮loading状态
75
+  deptPhones: any = []; //新添加的科室电话列表
76
+  isAddDeptsPhone = true; //添加新的科室电话是否禁用
77
+  deptsPhoneId = 1; //科室电话自增id
78
+  allParentdepart: any = []; //所有的父级科室列表
79
+  hospitals1: any = []; //科室列表(搜索)
80
+	rowData: object = {}; //打印选择列表
81
+	editModal:boolean = false; //编辑时弹框
82
+  searchParentDeptSubject = new Subject();
83
+  // 初始化增删改按钮
84
+  coopBtns: any = {};
85
+	saveLoading:boolean = false;
86
+  // 模板导出
87
+  excelExport(){
88
+    this.maskFlag = this.message.loading("下载模板中..", {
89
+      nzDuration: 0,
90
+    }).messageId;
91
+    this.mainService.exportExcel("department", {}).subscribe(
92
+      (data) => {
93
+        this.message.remove(this.maskFlag);
94
+        this.maskFlag = false;
95
+        this.message.success('下载模板成功');
96
+        var file = new Blob([data], {
97
+          type: "application/vnd.ms-excel",
98
+        });
99
+        //trick to download store a file having its URL
100
+        var fileURL = URL.createObjectURL(file);
101
+        var a = document.createElement("a");
102
+        a.href = fileURL;
103
+        a.target = "_blank";
104
+        a.download = "科室导入模板.xls";
105
+        document.body.appendChild(a);
106
+        a.click();
107
+      },
108
+      (err) => {
109
+        this.message.remove(this.maskFlag);
110
+        this.maskFlag = false;
111
+        this.message.error('下载模板失败');
112
+      }
113
+    );
114
+  }
115
+
116
+  // 导入---start
117
+  // model-取消
118
+  isShow = false;
119
+  hideExcelImport() {
120
+    this.isShow = false;
121
+  }
122
+  // 触发
123
+  excelImport() {
124
+    this.isShow = true;
125
+  }
126
+  submitExcelImport({fileList}){
127
+    this.isShow = false;
128
+    const formData = new FormData();
129
+    fileList.forEach((file: any) => {
130
+      formData.append('file', file);
131
+    });
132
+    this.maskFlag = this.message.loading("正在导入中..", {
133
+      nzDuration: 0,
134
+    }).messageId;
135
+    const req = new HttpRequest('Post', host.host + '/user/data/importExcel/department', formData, {
136
+      reportProgress: true
137
+    });
138
+    this.http
139
+      .request(req)
140
+      .pipe(filter(e => e instanceof HttpResponse))
141
+      .subscribe(
142
+        (res:any) => {
143
+          if(res.body.status == 200){
144
+            this.message.remove(this.maskFlag);
145
+            this.maskFlag = false;
146
+            this.message.success('导入成功');
147
+            this.getList();
148
+          }else{
149
+            this.message.remove(this.maskFlag);
150
+            this.maskFlag = false;
151
+            this.showPromptModal("导入", false, res.body.msg);
152
+          }
153
+        },
154
+        () => {
155
+          this.message.remove(this.maskFlag);
156
+          this.maskFlag = false;
157
+          this.message.error('导入失败');
158
+        },
159
+      );
160
+  }
161
+  // 导入---end
162
+  //搜索父级科室
163
+	isDeptLoading = false;
164
+  changeInp(e) {
165
+    this.searchParentDeptSubject.next(e);
166
+  }
167
+  // 打开父级科室下拉框baba
168
+  isLoading = false;
169
+  openDeptSelect(flag) {
170
+    if (flag) {
171
+      this.isLoading = true;
172
+      this.getAllParentdepart().subscribe((result) => {
173
+        this.isLoading = false;
174
+        if (result.status == 200) {
175
+          this.allParentdepart = result.list;
176
+        }
177
+      });
178
+    }
179
+  }
180
+  // 配送建单
181
+  coopData:any = {};
182
+  addDateModal(data) {
183
+    this.coopData = data;
184
+    this.showDelModal1();
185
+  }
186
+
187
+  showDelModal1() {
188
+    this.editModal = true;
189
+  }
190
+  hideDelModal1() {
191
+    this.editModal = false;
192
+  }
193
+	
194
+  // 编辑保存
195
+  confirmDel1() {
196
+    var that = this;
197
+		for (const i in that.validateForm.controls) {
198
+		  that.validateForm.controls[i].markAsDirty();
199
+		  that.validateForm.controls[i].updateValueAndValidity();
200
+		}
201
+		if (that.validateForm.invalid) return;
202
+    let data: any = {
203
+			startTime:this.formStartDate?this.formStartDate:this.loadStartTime,//发起时间开始
204
+			endTime:this.formEndDate?this.formEndDate:this.loadEndTime,//发起时间结束
205
+			hosId:this.hosId,
206
+			pharmacy:this.validateForm.value.department,
207
+			id:that.coopId
208
+    };
209
+		that.saveLoading = true;
210
+		that.mainService
211
+		  .simplePost("addData", "drugsBatch", data)
212
+		  .subscribe((data) => {
213
+		    that.saveLoading = false;
214
+		    that.hideModal();
215
+		    that.initForm();
216
+		    if (data.status == 200) {
217
+					this.editModal = false;
218
+		      that.showPromptModal("编辑", true, "");
219
+		    } else {
220
+		      that.showPromptModal("编辑", false, data.msg);
221
+		    }
222
+		  });
223
+  }
224
+	
225
+  //获取所有的父级科室列表
226
+  getAllParentdepart(keyWord = "") {
227
+    let postData: any = {
228
+      idx: 0,
229
+      sum: 10,
230
+      department: {
231
+        // hospital: { id: this.add ? this.tool.getCurrentHospital().id : this.hospital },
232
+        keyWord: keyWord,
233
+      },
234
+    };
235
+    if (this.coopItem) {
236
+      // 过滤这个科室及其子科室
237
+      postData.department.filterByDeptId = this.coopItem.id;
238
+    }
239
+    return this.mainService.getFetchDataList("data", "department", postData);
240
+  }
241
+  // 新添加科室号码
242
+  addDeptPhone(e: MouseEvent) {
243
+    e.preventDefault();
244
+    this.deptPhones.push({ id: ++this.deptsPhoneId, phone: "" });
245
+    this.deptsPhoneChange();
246
+  }
247
+  // 删除新添加科室号码
248
+  removeDeptPhone(index: number, e: MouseEvent) {
249
+    e.preventDefault();
250
+    this.deptPhones.splice(index, 1);
251
+    this.deptsPhoneChange();
252
+  }
253
+  //监听科室电话输入事件
254
+  deptsPhoneChange(e?, phone?) {
255
+    if (e !== undefined && phone !== undefined) {
256
+      phone.phone = e;
257
+    }
258
+    // -------------判断添加按钮是否禁用 start
259
+    this.isAddDeptsPhone = !this.validateForm.value.officeNum;
260
+    if (!this.isAddDeptsPhone) {
261
+      //如果没禁用
262
+      this.isAddDeptsPhone = this.deptPhones.some((item) => item.phone === "");
263
+    }
264
+    // -------------判断添加按钮是否禁用 end
265
+  }
266
+
267
+  // 搜索
268
+  search() {
269
+    this.pageIndex = 1;
270
+    this.getList();
271
+  }
272
+  // 重置
273
+  reset() {
274
+    this.pageIndex = 1;
275
+		this.batchNumber = null;
276
+    this.startDate = null;
277
+		this.endDate = null;
278
+		this.dateRange = [];
279
+    this.getList();
280
+  }
281
+  // 表格数据
282
+  loading1 = false;
283
+  getList() {
284
+    var that = this;
285
+    let data = {
286
+      idx: that.pageIndex - 1,
287
+      sum: that.pageSize,
288
+      drugsBatch: {
289
+    		batchNo:that.batchNumber,
290
+        startTime: this.startDate,
291
+    		endTime: this.endDate,
292
+    		hosId: this.hosId
293
+      },
294
+    };
295
+    if(that.batchNumber){
296
+    	data.drugsBatch.batchNo = that.batchNumber
297
+    }else{
298
+    	delete data.drugsBatch.batchNo
299
+    }
300
+    this.loading1 = true;
301
+    that.mainService
302
+      .getFetchDataList("data", "drugsBatch", data)
303
+      .subscribe((data) => {
304
+        this.loading1 = false;
305
+        that.listOfData = data.list;
306
+        that.listLength = data.totalNum;
307
+      });
308
+  }
309
+	
310
+	// 日期选择
311
+	startDate: string; //发起时间开始
312
+	endDate: string; //发起时间结束
313
+	changeDate(result?): void {
314
+	  if (!result) {
315
+	    this.startDate = this.endDate = "";
316
+	    return;
317
+	  }
318
+	  this.startDate = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
319
+	  this.endDate = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
320
+	}
321
+	
322
+	// 新增、编辑日期选择
323
+	formStartDate: string; //发起时间开始
324
+	formEndDate: string; //发起时间结束
325
+	formChangeDate(result?): void {
326
+		if (!result) {
327
+		  this.formStartDate = this.formEndDate = "";
328
+		  return;
329
+		}
330
+		this.formStartDate = format(result[0], 'yyyy-MM-dd HH:mm:ss');
331
+		this.formEndDate = format(result[1], 'yyyy-MM-dd HH:mm:ss');
332
+	}
333
+	
334
+	// 获取所有科室
335
+  getDeparts(dept) {
336
+    var that = this;
337
+    let data = {
338
+      department: {
339
+        dept,
340
+        hospital: {
341
+          id: this.hosId
342
+        },
343
+				type:{
344
+					id:''
345
+				}
346
+      },
347
+      idx: 0,
348
+      sum: 20,
349
+    };
350
+		that.mainService.getDictionary("list", "dept_type").subscribe((res) => {
351
+		  let typeData = res.find(i=>i.value=='pharmacyRoom');
352
+			if(typeData){
353
+				data.department.type.id = typeData.id
354
+			}
355
+			that.mainService
356
+			  .getFetchDataList("data", "department", data)
357
+			  .subscribe((data) => {
358
+					setTimeout(_=>{
359
+						this.hospitals1 = data.list
360
+						that.isDeptLoading = false;
361
+					},500)
362
+			  });
363
+		});
364
+  }
365
+	
366
+  // 获取所有院区
367
+  getAllHospital() {
368
+		this.getDeparts('')
369
+    this.getList();
370
+  }
371
+
372
+  // 切换院区选项
373
+  buildings: any = []; //楼栋
374
+  maskFlag: any = false;
375
+  changeHosp(obj?) {
376
+    let hospitalId;
377
+    if (obj) {
378
+      hospitalId = obj.hospital.id;
379
+    }
380
+    let hid;
381
+    if (hospitalId || hospitalId == 0) {
382
+      hid = hospitalId - 0;
383
+    } 
384
+		// else {
385
+  //     hid = this.hospital - 0;
386
+  //   }
387
+    let data = {
388
+      hosId: this.add ? this.tool.getCurrentHospital().id : hid,
389
+    };
390
+    this.maskFlag = this.message.loading("正在加载中..", {
391
+      nzDuration: 0,
392
+    }).messageId;
393
+    this.mainService
394
+      .coopData("getBuildingOrFloor", "building", data)
395
+      .subscribe((data) => {
396
+        this.buildings = data.data;
397
+        this.floors = [];
398
+        // ---------
399
+        if (obj) {
400
+          //编辑
401
+          let arr = this.buildings.map((item) => item.id);
402
+          if (obj.building.id && arr.includes(obj.building.id)) {
403
+            //有楼栋
404
+            this.changeBuilding(obj.building.id, obj);
405
+            this.validateForm.controls.building.setValue(obj.building.id + "");
406
+          } else {
407
+            //无楼栋
408
+            this.floors = [];
409
+            this.message.remove(this.maskFlag);
410
+            this.maskFlag = false;
411
+            this.modal = true;
412
+            this.validateForm.controls.building.setValue(null);
413
+            this.validateForm.controls.officeAddress.setValue(null);
414
+          }
415
+        } else {
416
+          //新增
417
+          this.message.remove(this.maskFlag);
418
+          this.maskFlag = false;
419
+          this.modal = true;
420
+        }
421
+        // ---------
422
+      });
423
+  }
424
+
425
+  // 切换楼栋信息
426
+  floors: Array<any> = []; //楼层
427
+  floorLoading: boolean = false;
428
+  changeBuilding(buildingId?, obj?) {
429
+    var that = this;
430
+    that.floors = [];
431
+    var bid;
432
+    if (buildingId || buildingId == 0) {
433
+      bid = buildingId - 0;
434
+    } else if (!that.add && that.validateForm.value.building) {
435
+      bid = that.validateForm.value.building - 0;
436
+    } else {
437
+      return;
438
+    }
439
+    let data = {
440
+      buildingId: bid,
441
+    };
442
+    this.floorLoading = true;
443
+    that.mainService
444
+      .coopData("getBuildingOrFloor", "floor", data)
445
+      .subscribe((data) => {
446
+        this.floorLoading = false;
447
+        this.message.remove(this.maskFlag);
448
+        this.maskFlag = false;
449
+        this.modal = true;
450
+        that.floors = data.data;
451
+        if (obj) {
452
+          let floorId = obj.floor.id;
453
+          let arr = that.floors.map((item) => item["id"]);
454
+          if (floorId && arr.includes(floorId)) {
455
+            this.validateForm.controls.floor.setValue(floorId + "");
456
+          } else {
457
+            this.validateForm.controls.floor.setValue(null);
458
+            this.validateForm.controls.officeAddress.setValue(null);
459
+          }
460
+        }
461
+      });
462
+  }
463
+
464
+  // 获取科室类型
465
+  types: Array<any> = [];
466
+  getType() {
467
+    var that = this;
468
+    that.mainService.getDictionary("list", "dept_type").subscribe((data) => {
469
+      console.log(data);
470
+      that.types = data;
471
+    });
472
+  }
473
+
474
+  // 获取科室汇总交接类型
475
+  deptHandoverTypes: Array<any> = [];
476
+  getDeptHandoverType() {
477
+    var that = this;
478
+    that.mainService.getDictionary("list", "dept_handover_type").subscribe((data) => {
479
+      console.log(data);
480
+      that.deptHandoverTypes = data;
481
+    });
482
+  }
483
+
484
+  // 新增弹框
485
+  showModal() {
486
+    this.initForm();
487
+    this.add = true;
488
+		this.modal = true;
489
+    this.isAddDeptsPhone = true;
490
+  }
491
+  hideModal() {
492
+    this.coopItem = null;
493
+    this.modal = false;
494
+    this.initForm();
495
+  }
496
+  // 初始化新增form表单
497
+	loadStartTime = '';
498
+	loadEndTime = '';
499
+  initForm() {
500
+    this.validateForm = this.fb.group({
501
+      dispensingTime: [null, [Validators.required]],
502
+      department: [null, [Validators.required]]
503
+    });
504
+		let date = new Date();
505
+		this.loadStartTime = format(subDays(date, 1), "yyyy-MM-dd") +' '+'08:00:00'
506
+		this.loadEndTime = format(date, "yyyy-MM-dd") +' '+'08:00:00'
507
+		this.validateForm.controls.dispensingTime.setValue([this.loadStartTime, this.loadEndTime]);
508
+  }
509
+  // 科室位置必填
510
+  buildValidator = (control: FormControl): { [s: string]: boolean } => {
511
+    if (
512
+      this.validateForm &&
513
+      this.validateForm.value &&
514
+      (!this.validateForm.value.building ||
515
+        !this.validateForm.value.floor ||
516
+        !this.validateForm.value.officeAddress)
517
+    ) {
518
+      return { required: true };
519
+    }
520
+  };
521
+  /**
522
+   * 生成一个从 start 到 end 的连续数组
523
+   * @param start
524
+   * @param end
525
+   */
526
+  generateArray(start, end) {
527
+    return Array.from(new Array(end).keys()).slice(start);
528
+  }
529
+
530
+  //服务时间选择
531
+  // 禁用的小时
532
+  startTime1Hourdis() {
533
+    return [];
534
+  }
535
+  endTime1Hourdis() {
536
+    return [];
537
+  }
538
+  startTime2Hourdis() {
539
+    return [];
540
+  }
541
+  endTime2Hourdis() {
542
+    return [];
543
+  }
544
+  // 禁用的分钟
545
+  startTime1Mindis() {
546
+    return [];
547
+  }
548
+  endTime1Mindis() {
549
+    return [];
550
+  }
551
+  startTime2Mindis() {
552
+    return [];
553
+  }
554
+  endTime2Mindis() {
555
+    return [];
556
+  }
557
+  timeChange(e: boolean, type: string, num: number) {
558
+    if (!e && this.validateForm.value[type + num]) {
559
+      let hour = new Date(this.validateForm.value[type + num]).getHours();
560
+      let minute = new Date(this.validateForm.value[type + num]).getMinutes();
561
+      if (type == "startTime" && num === 1) {
562
+        this.endTime1Hourdis = () => this.generateArray(0, hour);
563
+        this.endTime1Mindis = () => this.generateArray(0, minute + 1);
564
+      } else if (type == "startTime" && num === 2) {
565
+        this.endTime2Hourdis = () => this.generateArray(0, hour);
566
+        this.endTime2Mindis = () => this.generateArray(0, minute + 1);
567
+      } else if (type == "endTime" && num === 1) {
568
+        this.startTime1Hourdis = () => this.generateArray(hour + 1, 24);
569
+        this.startTime1Mindis = () => this.generateArray(minute, 60);
570
+      } else if (type == "endTime" && num === 2) {
571
+        this.startTime2Hourdis = () => this.generateArray(hour + 1, 24);
572
+        this.startTime2Mindis = () => this.generateArray(minute, 60);
573
+      }
574
+    }
575
+  }
576
+  // 表单提交
577
+  submitForm(): void {
578
+    var that = this;
579
+		for (const i in that.validateForm.controls) {
580
+		  that.validateForm.controls[i].markAsDirty();
581
+		  that.validateForm.controls[i].updateValueAndValidity();
582
+		}
583
+		if (that.validateForm.invalid) return;
584
+    let data: any = {
585
+			startTime:this.formStartDate?this.formStartDate:this.loadStartTime,//发起时间开始
586
+			endTime:this.formEndDate?this.formEndDate:this.loadEndTime,//发起时间结束
587
+			hosId:this.hosId,
588
+			pharmacy:this.validateForm.value.department
589
+    };
590
+  
591
+    if (!that.add) {
592
+			this.editModal = true
593
+    }else{
594
+			that.btnLoading = true;
595
+			that.mainService
596
+			  .simplePost("addData", "drugsBatch", data)
597
+			  .subscribe((data) => {
598
+			    that.btnLoading = false;
599
+			    that.hideModal();
600
+			    that.initForm();
601
+			    if (data.status == 200) {
602
+			      that.showPromptModal(that.add ? "新增" : "编辑", true, "");
603
+			    } else {
604
+			      that.showPromptModal(that.add ? "新增" : "编辑", false, data.msg);
605
+			    }
606
+			  });
607
+		}
608
+  }
609
+
610
+  // 编辑
611
+  coopItem: any = null;
612
+  edit(e, data) {
613
+    e.stopPropagation();
614
+    this.add = false;
615
+    this.coopId = data.id;
616
+    this.coopItem = data;
617
+    this.validateForm.controls.department.setValue(data.pharmacy);
618
+    this.validateForm.controls.dispensingTime.setValue([data.startTime,data.endTime]);
619
+		this.loadStartTime = data.startTime
620
+		this.loadEndTime = data.endTime
621
+		this.modal = true
622
+  }
623
+
624
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
625
+  showPromptModal(con, success, promptInfo?) {
626
+    this.promptModalShow = false;
627
+    this.promptContent = con;
628
+    this.ifSuccess = success;
629
+    this.promptInfo = promptInfo;
630
+    setTimeout(() => {
631
+      this.promptModalShow = true;
632
+    }, 100);
633
+    this.getList();
634
+  }
635
+
636
+  delModal: boolean = false; //删除模态框
637
+  coopIds: any;
638
+  coopFlag: any = false;
639
+  /**
640
+   *
641
+   * @param e 事件对象
642
+   * @param id
643
+   */
644
+  showDelModal(e, id) {
645
+    e.stopPropagation();
646
+    this.delModal = true;
647
+    this.coopId = id;
648
+  }
649
+  hideDelModal() {
650
+    this.delModal = false;
651
+  }
652
+  // 确认删除
653
+  confirmDel() {
654
+    var that = this;
655
+    that.btnLoading = true;
656
+    that.mainService
657
+      .coopTypeConfig(
658
+        "rmvData",
659
+        "drugsBatch",
660
+         [that.coopId]
661
+      )
662
+      .subscribe((data) => {
663
+        that.btnLoading = false;
664
+        that.delModal = false;
665
+        if (data.status==200) {
666
+          that.showPromptModal("删除", true, "");
667
+        } else {
668
+          that.showPromptModal("删除", false, data.data[0].msg);
669
+        }
670
+      });
671
+  }
672
+
673
+  // 查看
674
+  detail(e, data) {
675
+    e.stopPropagation();
676
+		this.router.navigateByUrl(`/dispensingDetail/${data.id}`);
677
+  }
678
+
679
+  // 选中表格中科室
680
+  mapOfCheckedId: { [key: string]: boolean } = {};
681
+  checkedDepIds = []; //已选中科室id
682
+  refreshStatus(): void {
683
+    this.isAllDisplayDataChecked = this.listOfData.every(
684
+      (item) => this.mapOfCheckedId[item.id]
685
+    );
686
+    let arr = [];
687
+    for (var k in this.mapOfCheckedId) {
688
+      if (this.mapOfCheckedId[k]) {
689
+        arr.push(Number(k));
690
+      }
691
+    }
692
+    this.checkedDepIds = arr;
693
+    console.log(this.checkedDepIds);
694
+  }
695
+  //表格整行选中
696
+  selectedListData(id) {
697
+    this.mapOfCheckedId[id] = !this.mapOfCheckedId[id];
698
+    this.refreshStatus();
699
+  }
700
+  // 全选
701
+  isAllDisplayDataChecked = false; //当前页是否全选
702
+  checkAll(value: boolean): void {
703
+    this.listOfData.forEach((item) => (this.mapOfCheckedId[item.id] = value));
704
+    this.refreshStatus();
705
+  }
706
+
707
+	// 发药并打印
708
+	printData = []; 
709
+	print(e, data, id){
710
+		this.rowData = data
711
+		e.stopPropagation();
712
+		let that = this;
713
+		that.printLoading = true;
714
+		that.mainService
715
+		  .transfusionPrint("drugsBatch", id)
716
+		  .subscribe((res) => {
717
+				let arr = res.data.drugsListDTOS;
718
+				for(let i of arr){
719
+					for(let t of i.drugsConfigureDTOS){
720
+						t.deptName = i.pharmacyDTO?i.pharmacyDTO.dept:'-'
721
+					}
722
+					i.drugsConfigureDTOS.push({
723
+						drugsInfoDTO:{
724
+							drugName:'合计',
725
+							specs:'',
726
+						},
727
+						actualCount:i.totalActual,
728
+						cartonNum:i.totalCarton,
729
+						deptName:''
730
+					})
731
+				}
732
+		    that.printData = arr;
733
+		    that.printLoading = false;
734
+				that.btnLoading = false;
735
+				that.printModal = false;
736
+		    setTimeout(() => {
737
+		      const printContent = document.getElementById("report");
738
+		      const WindowPrt = window.open("", "", "width=1000,height=900");
739
+		      WindowPrt.document.write(printContent.innerHTML);
740
+		      WindowPrt.document.close();
741
+		      WindowPrt.focus();
742
+		      WindowPrt.print();
743
+		      WindowPrt.close();
744
+					setTimeout(()=>{
745
+						this.getList();
746
+					},200)
747
+		    }, 500);
748
+		  });
749
+	}
750
+	
751
+	printModal = false;
752
+	printE = '';
753
+	printItemData = '';
754
+	printItemId = '';
755
+	dispensingPrint(e, data, id){
756
+		this.printModal = true
757
+		this.printE = e
758
+		this.printItemData = data
759
+		this.printItemId = id
760
+	}
761
+	
762
+	confirmPrintDel(){
763
+		this.btnLoading = true;
764
+		this.print(this.printE, this.printItemData, this.printItemId)
765
+	}
766
+	
767
+	hidePrintModal(){
768
+		this.printModal = false
769
+	}
770
+}

+ 19 - 0
src/app/views/dispensing-batch/dispensing-batch.module.ts

@@ -0,0 +1,19 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+
4
+import { DispensingBatchRoutingModule } from './dispensing-batch-routing.module';
5
+import { DispensingBatchComponent } from './dispensing-batch.component';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+
8
+
9
+@NgModule({
10
+  declarations: [
11
+    DispensingBatchComponent,
12
+  ],
13
+  imports: [
14
+    CommonModule,
15
+    DispensingBatchRoutingModule,
16
+    ShareModule
17
+  ]
18
+})
19
+export class DispensingBatchModule { }

+ 17 - 0
src/app/views/dispensing-detail/dispensing-detail-routing.module.ts

@@ -0,0 +1,17 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { DispensingDetailComponent } from './dispensing-detail.component';
4
+
5
+
6
+const routes: Routes = [
7
+  {
8
+    path: '',
9
+    component: DispensingDetailComponent
10
+  }
11
+];
12
+
13
+@NgModule({
14
+  imports: [RouterModule.forChild(routes)],
15
+  exports: [RouterModule]
16
+})
17
+export class DispensingDetailRoutingModule { }

+ 142 - 0
src/app/views/dispensing-detail/dispensing-detail.component.html

@@ -0,0 +1,142 @@
1
+<div class="list-template detail-box">
2
+  <div class="list-template__content">
3
+		<div class="detail-title">
4
+			<h3 *ngIf="deptName">{{deptName}}-发药单</h3>
5
+			<button class="btn cancel right-btn" nz-button nzType="default" (click)="back()">取消</button>
6
+		</div>
7
+    <div class="list-template__bottom" style="padding: 0 !important;">
8
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
9
+        [nzLoading]="loading1">
10
+        <thead>
11
+          <tr class="thead">
12
+						<th nzWidth="9%">药品标识</th>
13
+            <th nzWidth="9%">药品名称</th>
14
+            <th nzWidth="9%">规格</th>
15
+						<th nzWidth="9%">消耗数量</th>
16
+						<th nzWidth="9%">原库存数</th>
17
+						<th nzWidth="9%">包装规格</th>
18
+						<th nzWidth="9%">发药箱数</th>
19
+						<th nzWidth="9%">实发数量</th>
20
+            <th nzWidth="9%">计算后库存</th>
21
+						<th nzWidth="7%">增减</th>
22
+            <th nzWidth="11%">操作</th>
23
+          </tr>
24
+        </thead>
25
+        <tbody>
26
+          <tr *ngFor="let data of listOfData">
27
+						<td>{{ data.drugsInfoDTO?data.drugsInfoDTO.drugCode:'-' }}</td>
28
+            <td>{{ data.drugsInfoDTO?data.drugsInfoDTO.drugName:'-' }}</td>
29
+            <td>{{ data.drugsInfoDTO?data.drugsInfoDTO.specs:'-' }}</td>
30
+            <td>{{ data.expendCount||'0' }}</td>
31
+            <td>{{ data.formerInventory || '0' }}</td>
32
+            <td>{{ data.drugsInfoDTO?data.drugsInfoDTO.packingSpecs:'0' }}</td>
33
+						<td>{{ data.cartonNum||'0' }}</td>
34
+						<td>{{ data.actualCount||'0' }}</td>
35
+						<td>{{ data.afterInventory||'0' }}</td>
36
+						<td>{{ data.addSub||'0' }}</td>
37
+            <td>
38
+              <div class="coop">
39
+                <span (click)="itemClick($event,data.id, 'add')">增加</span>
40
+								<span (click)="itemClick($event,data.id, 'del')">减少</span>
41
+							</div>
42
+            </td>
43
+          </tr>
44
+        </tbody>
45
+      </nz-table>
46
+    </div>
47
+  </div>
48
+	<div class="right-content">
49
+		<div class="right-top">
50
+			<h3 class="title">快速添加发药科室</h3>
51
+			<div class="right-template">
52
+			  <span class="label">科室:</span>
53
+			  <nz-select class="formItem" (ngModelChange)="deptChange($event)" [nzDropdownMatchSelectWidth]="false" (nzOnSearch)="changeInp($event, 'dept')" nzServerSearch nzShowSearch nzPlaceHolder="请选择科室" [(ngModel)]="department">
54
+			    <ng-container *ngFor="let option of hospitals1">
55
+			      <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
56
+			    </ng-container>
57
+			    <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
58
+			      <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
59
+			    </nz-option>
60
+			  </nz-select>
61
+				<span (click)='addDept()' class="icon_transport transport-tag27fuben add-class"></span>
62
+			</div>
63
+		</div>
64
+		<div class="right-bottom">
65
+			<h3 class="title">发药科室列表</h3>
66
+			<div class="right-template">
67
+			  <span class="label">楼栋:</span>
68
+			  <nz-select class="formItem" (ngModelChange)="buildingChange($event)" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch
69
+			    (nzOnSearch)="changeInp($event, 'building')" nzAllowClear nzPlaceHolder="请选择楼栋" [(ngModel)]="building">
70
+			    <ng-container *ngFor="let option of buildingList">
71
+			      <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.buildingName" [nzValue]="option.id"></nz-option>
72
+			    </ng-container>
73
+			    <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
74
+			      <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
75
+			    </nz-option>
76
+			  </nz-select>
77
+			</div>
78
+			<div class="dept-box">
79
+				<div *ngFor="let item of deptList;let index=index;" class="dept-item" 
80
+					[ngClass]="{'activeClass': index == deptIndex}" (click)="deptClick($event,item,index)">
81
+					<div>{{item.applyDeptDTO?item.applyDeptDTO.dept:'-'}}</div>
82
+					<span class="icon_transport transport-lajitong" (click)="deptDel($event,item,index)"></span>
83
+				</div>
84
+			</div>
85
+		</div>
86
+	</div>
87
+  <!-- 增加/减少 -->
88
+  <div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
89
+    <div class="modalBody">
90
+      <div class="title">{{add ? '增加' : '减少'}}<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
91
+      </div>
92
+      <overlay-scrollbars #osComponentRef1 class="content">
93
+       <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
94
+       	<nz-form-item *ngIf="add">
95
+       	  <nz-form-label nzRequired nzFor="addNum">增加数量</nz-form-label>
96
+       	  <nz-form-control nzErrorTip="请选择增加数量!">
97
+       	    <nz-input-group>
98
+       				<nz-input-number
99
+								nz-input
100
+       					formControlName="addNum"
101
+       					[nzMin]="0"
102
+       					[nzPrecision]="0"
103
+       					[nzMax]="999999"
104
+       					[nzStep]="1"
105
+       					[nzPlaceHolder]="'请填写增加数量'"
106
+       				 ></nz-input-number>
107
+       			</nz-input-group>
108
+       	  </nz-form-control>
109
+       	</nz-form-item>
110
+				<nz-form-item *ngIf="!add">
111
+				  <nz-form-label nzRequired nzFor="delNum">减少数量</nz-form-label>
112
+				  <nz-form-control nzErrorTip="请选择减少数量!">
113
+				    <nz-input-group>
114
+							<nz-input-number
115
+								nz-input
116
+								formControlName="delNum"
117
+								[nzMin]="0"
118
+								[nzPrecision]="0"
119
+								[nzMax]="999999"
120
+								[nzStep]="1"
121
+								[nzPlaceHolder]="'请填写减少数量'"
122
+							 ></nz-input-number>
123
+						</nz-input-group>
124
+				  </nz-form-control>
125
+				</nz-form-item>
126
+       </form>
127
+      </overlay-scrollbars>
128
+      <div class="display_flex justify-content_flex-center">
129
+        <button class="btn" nz-button nzType="primary" (click)="submitForm()" [nzLoading]="btnLoading">保存</button>
130
+    		<button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
131
+      </div>
132
+    </div>
133
+  </div>
134
+
135
+</div>
136
+<!-- 操作成功/失败提示框 -->
137
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
138
+  [info]="promptInfo"></app-prompt-modal>
139
+	
140
+<!-- 删除模态框 -->
141
+  <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
142
+    (confirmDelEvent)="confirmDel()" content="您确认要删除发药科室吗?"></app-dialog-delete>

+ 385 - 0
src/app/views/dispensing-detail/dispensing-detail.component.less

@@ -0,0 +1,385 @@
1
+@import "../../../../src/theme.less";
2
+:host {
3
+	width: 100%;
4
+	height: 100%;
5
+	// display: flex;
6
+	// text-rendering: optimizeLegibility;
7
+	// -webkit-font-smoothing: antialiased;
8
+	// -moz-osx-font-smoothing: grayscale;
9
+  .add-button {
10
+    margin: 0 auto 16px !important;
11
+  }
12
+  .targetDept {
13
+    overflow: hidden;
14
+    // width: 90px;
15
+    text-overflow: ellipsis;
16
+    white-space: nowrap;
17
+  }
18
+  .dynamic {
19
+    margin-bottom: 16px;
20
+    display: flex;
21
+    align-items: center;
22
+    input {
23
+      width: 90%;
24
+    }
25
+    i {
26
+      margin-left: 8px;
27
+      cursor: pointer;
28
+      font-size: 18px;
29
+    }
30
+  }
31
+}
32
+
33
+h3{
34
+	margin: 0 !important;
35
+}
36
+/* 修改垂直滚动条 */
37
+::-webkit-scrollbar {
38
+  width: 4px; /* 修改宽度 */
39
+}
40
+ 
41
+/* 修改滚动条轨道背景色 */
42
+::-webkit-scrollbar-track {
43
+  background-color: #f1f1f1;
44
+}
45
+ 
46
+/* 修改滚动条滑块颜色 */
47
+::-webkit-scrollbar-thumb {
48
+  background-color: #888;
49
+}
50
+ 
51
+/* 修改滚动条滑块悬停时的颜色 */
52
+::-webkit-scrollbar-thumb:hover {
53
+  background-color: #555;
54
+}
55
+
56
+.detail-box{
57
+	display: flex;
58
+	.list-template__content{
59
+		flex:3;
60
+		padding: 0 10px 10px 10px;
61
+		border-radius: 5px;
62
+		border: 1px solid #e5e5e5;
63
+		.list-template__bottom{
64
+			height: auto;
65
+			max-height: 550px;
66
+			overflow-y: auto;
67
+		}
68
+	}
69
+	.right-content{
70
+		flex: 1;
71
+		margin-left: 10px;
72
+		.right-top{
73
+			border-radius: 5px;
74
+			background: #f9fafb;
75
+			border: 1px solid #e5e5e5;
76
+			padding: 10px;
77
+			.title{
78
+				text-align: center;
79
+				margin-bottom: 10px;
80
+			}
81
+			.right-template{
82
+				display: flex;
83
+				align-items: center;
84
+				margin-top: 10px;
85
+				.label{
86
+					width:55px;
87
+				}
88
+				.ant-select{
89
+					width: 100%;
90
+				}
91
+				.add-class{
92
+					margin-left: 10px;
93
+					cursor: pointer;
94
+					color: #34b349;
95
+				}
96
+			}
97
+			
98
+		}
99
+		.right-bottom{
100
+			border-radius: 5px;
101
+			background: #f9fafb;
102
+			border: 1px solid #e5e5e5;
103
+			padding: 10px;
104
+			margin-top: 20px;
105
+			.title{
106
+				text-align: center;
107
+				margin-bottom: 10px;
108
+			}
109
+			.right-template{
110
+				display: flex;
111
+				align-items: center;
112
+				margin-top: 10px;
113
+				.label{
114
+					width:50px;
115
+				}
116
+				.ant-select{
117
+					width: 100%;
118
+				}
119
+			}
120
+			.dept-box{
121
+				margin-top: 20px;
122
+				height: auto;
123
+				max-height: 393px;
124
+				overflow-y: auto;
125
+				.dept-item{
126
+					display: flex;
127
+					justify-content: space-between;
128
+					align-items: center;
129
+					cursor: pointer;
130
+					height: 40px;
131
+					padding: 0 10px;
132
+					box-sizing: border-box;
133
+					.transport-lajitong{
134
+						color: #49b856;
135
+						font-size: 18px;
136
+					}
137
+				}
138
+				.activeClass{
139
+					border: 1px solid #49b856;
140
+					background: #E9F7E9;
141
+				}
142
+			}
143
+		}
144
+	}
145
+	.detail-title{
146
+		display: flex;
147
+		justify-content: center;
148
+		align-items: center;
149
+		position: relative;
150
+		height: 42px;
151
+		
152
+		.right-btn{
153
+			position: absolute;
154
+			right: 0;
155
+		}
156
+	}
157
+}
158
+
159
+.save {
160
+  position: fixed;
161
+  left: 0;
162
+  top: 0;
163
+  width: 100%;
164
+  height: 100%;
165
+  background: rgba(0, 0, 0, 0.4);
166
+  z-index: 99;
167
+
168
+  .modalBody {
169
+    width: 350px;
170
+    background: #fff;
171
+    border-radius: 5px;
172
+    padding: 10px 20px;
173
+    color: #333;
174
+
175
+    .title {
176
+      width: 100%;
177
+      text-align: center;
178
+      font-size: 18px;
179
+      position: relative;
180
+
181
+      i {
182
+        position: absolute;
183
+        right: 0;
184
+        top: 0;
185
+        font-size: 20px;
186
+        color: #666;
187
+        cursor: pointer;
188
+        padding: 0 5px;
189
+      }
190
+    }
191
+
192
+    .content {
193
+      width: 100%;
194
+      height: 117px;
195
+      background: #f9fafb;
196
+      border: 1px solid #e5e9ed;
197
+      border-radius: 5px;
198
+      overflow: hidden;
199
+      margin-top: 12px;
200
+
201
+      div {
202
+        text-align: center;
203
+        margin: 0;
204
+
205
+        &.icon {
206
+          margin-top: 17px;
207
+
208
+          i {
209
+            color: #34b349;
210
+            font-size: 30px !important;
211
+
212
+            &.transport-wenhao {
213
+              color: #f5a523;
214
+            }
215
+
216
+            &.transport-shibai {
217
+              color: #ff3a52;
218
+            }
219
+          }
220
+        }
221
+
222
+        &.defeat {
223
+          color: #333;
224
+          font-size: 18px;
225
+        }
226
+
227
+        &:nth-child(3) {
228
+          font-size: 14px;
229
+          color: #666;
230
+        }
231
+      }
232
+    }
233
+
234
+    button {
235
+      margin-top: 10px;
236
+
237
+      &.btn {
238
+        margin-left: 8px;
239
+      }
240
+    }
241
+  }
242
+
243
+  // 新增
244
+  &.add {
245
+    .modalBody {
246
+      width: 400px;
247
+      height: auto;
248
+
249
+      .content {
250
+        width: 100%;
251
+        height: auto;
252
+        padding: 19px 14px 0 14px;
253
+        max-height: 500px;
254
+        overflow-y: auto;
255
+				
256
+				.ant-input-number{
257
+					width: 100%;
258
+				}
259
+				.list-template__bottom {
260
+				  background: #f9fafb;
261
+				  border: 1px solid #e5e9ed;
262
+				  border-radius: 8px;
263
+				  position: relative;
264
+				  .list-template__nzTable {
265
+				    padding: 16px 16px 0;
266
+				
267
+				    .thead {
268
+				      background-image: linear-gradient(to right, @bg-start, @bg-end);
269
+				
270
+				      th {
271
+				        background: transparent;
272
+				        color: #fff;
273
+				        text-align: center;
274
+				      }
275
+				    }
276
+				
277
+				    .ant-table-body {
278
+				      border-bottom: 1px solid #e5e9ed;
279
+				    }
280
+				
281
+				    .ant-table-tbody {
282
+				      tr {
283
+				        text-align: center;
284
+				        color: #333;
285
+				
286
+				        td {
287
+				          border: none;
288
+				
289
+				          &.tab_hover:hover{
290
+				            text-decoration: underline;
291
+				            cursor: pointer;
292
+				          }
293
+				
294
+				          .coop {
295
+				            button{
296
+				              color: #333;
297
+				            }
298
+				            span,button {
299
+				              display: inline-block;
300
+				              padding: 0 8px;
301
+				              cursor: pointer;
302
+				              position: relative;
303
+				
304
+				              &::after {
305
+				                content: "|";
306
+				                position: absolute;
307
+				                top: 0;
308
+				                right: 0;
309
+				              }
310
+				
311
+				              &:hover,
312
+				              &:active {
313
+				                color: @primary-color;
314
+				              }
315
+				
316
+				              &:nth-last-child(1) {
317
+				                &::after {
318
+				                  content: "";
319
+				                }
320
+				              }
321
+				            }
322
+				          }
323
+				        }
324
+				      }
325
+				    }
326
+				  }
327
+				  .list-template__pagination {
328
+				    height: 56px;
329
+				    display: flex;
330
+				    align-items: center;
331
+				    position: absolute;
332
+				    right: 8px;
333
+				  }
334
+				}
335
+				
336
+        .addForm {
337
+          .ant-form-item {
338
+            margin-bottom: 14px;
339
+
340
+            .ant-form-item-label {
341
+              line-height: 14px;
342
+              text-align: left;
343
+            }
344
+          }
345
+        }
346
+
347
+        .editForm {
348
+          .ant-form-item {
349
+            margin-bottom: 14px;
350
+
351
+            .ant-form-item-label {
352
+              line-height: 0;
353
+              text-align: left;
354
+            }
355
+          }
356
+        }
357
+      }
358
+
359
+      button {
360
+        &:nth-child(1) {
361
+          margin-right: 20px;
362
+        }
363
+      }
364
+    }
365
+  }
366
+}
367
+
368
+.monad{
369
+	padding: 10px;
370
+	border: 1px solid #e7e7e7;
371
+	border-radius: 5px;
372
+	margin-top: 20px;
373
+	.monad-title{
374
+		text-align: center;
375
+		font-weight: 700;
376
+		font-size: 16px;
377
+	}
378
+	.monad-sign{
379
+		display: flex;
380
+		line-height: 30px;
381
+		div{
382
+			margin-right: 15px;
383
+		}
384
+	}
385
+}

+ 386 - 0
src/app/views/dispensing-detail/dispensing-detail.component.ts

@@ -0,0 +1,386 @@
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import {
4
+  FormBuilder,
5
+  Validators,
6
+  FormGroup,
7
+  FormControl,
8
+} from "@angular/forms";
9
+
10
+import { MainService } from "../../services/main.service";
11
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
12
+import { ToolService } from "../../services/tool.service";
13
+import { NzMessageService } from "ng-zorro-antd";
14
+import { Subject } from "rxjs";
15
+import { debounceTime, filter } from "rxjs/operators";
16
+import { HttpRequest, HttpResponse, HttpClient } from '@angular/common/http';
17
+
18
+@Component({
19
+  selector: "app-dispensing-detail",
20
+  templateUrl: "./dispensing-detail.component.html",
21
+  styleUrls: ["./dispensing-detail.component.less"],
22
+})
23
+export class DispensingDetailComponent implements OnInit {
24
+  @ViewChild("osComponentRef1", {
25
+    read: OverlayScrollbarsComponent,
26
+    static: false,
27
+  })
28
+  osComponentRef1: OverlayScrollbarsComponent;
29
+  constructor(
30
+    private message: NzMessageService,
31
+    private fb: FormBuilder,
32
+    private route: ActivatedRoute,
33
+    private router: Router,
34
+    private mainService: MainService,
35
+    private tool: ToolService,
36
+    private http: HttpClient,
37
+  ) {}
38
+
39
+  ngOnInit() {
40
+    this.searchParentDeptSubject.pipe(debounceTime(500)).subscribe((e) => {
41
+			this.isDeptLoading = true;
42
+			if(e[1]=='dept'){
43
+				this.getDeparts(e[0]);
44
+			}else{
45
+				this.getBuilding(e[0]);
46
+			}
47
+    });
48
+		this.detailId = this.route.snapshot.params.id;
49
+		this.hosId = this.tool.getCurrentHospital().id;
50
+    this.coopBtns = this.tool.initCoopBtns(this.route);
51
+    this.getAllHospital();
52
+  }
53
+	detailId:null; //列表数据
54
+	deptId:null; //选中的科室id
55
+  listOfData: any[] = []; //表格数据
56
+  promptContent: string; //操作提示框提示信息
57
+  ifSuccess: boolean; //操作成功/失败
58
+  promptInfo: string; //操作结果提示信息
59
+  promptModalShow: boolean; //操作提示框是否展示
60
+  modal: boolean = false; //新增/编辑模态框
61
+  add: boolean; //true:新增;false:编辑
62
+  validateForm: FormGroup; //新增/编辑表单
63
+  coopId: number; //表格中执行操作的id
64
+  department: number; //所属科室
65
+	drug: number; //药品名称
66
+	hosId: number; 
67
+	rowId:number; //清单id
68
+	dateRange;//时间
69
+  batchNumber; //批次号
70
+  num; //编码
71
+  deptalias; //别名
72
+  type; //类型
73
+  deptHandoverType; //类型
74
+  pageIndex: number = 1; //页码
75
+  listLength: number = 10; //总条数
76
+  pageSize: number = 10; //每页条数
77
+  btnLoading: boolean = false; //确认按钮loading状态
78
+  printLoading: boolean = false; //批量打印按钮loading状态
79
+  deptPhones: any = []; //新添加的科室电话列表
80
+  isAddDeptsPhone = true; //添加新的科室电话是否禁用
81
+  deptsPhoneId = 1; //科室电话自增id
82
+  allParentdepart: any = []; //所有的父级科室列表
83
+  hospitals1: any = []; //科室列表
84
+	buildingList: any = []; //楼栋列表
85
+	deptList: any = []; //楼栋科室
86
+	building:''; //楼栋
87
+	deptIndex:number; //选中index
88
+  searchParentDeptSubject = new Subject();
89
+  // 初始化增删改按钮
90
+  coopBtns: any = {};
91
+	deptName:null;
92
+  //搜索父级科室
93
+	isDeptLoading = false;
94
+  changeInp(e, type) {
95
+    this.searchParentDeptSubject.next([e, type]);
96
+  }
97
+
98
+  // 表格数据
99
+  loading1 = false;
100
+  getList() {
101
+    var that = this;
102
+    let data = {
103
+    	idx: 0,
104
+    	sum: 9999,
105
+    	drugsConfigure: {
106
+    	  hosId: this.hosId,
107
+				deptId :this.deptId?this.deptId:null,
108
+    	  batchId: this.detailId
109
+    	}
110
+    };
111
+    this.loading1 = true;
112
+    that.mainService
113
+      .getFetchDataList("data", "drugsConfigure", data)
114
+      .subscribe((data) => {
115
+        this.loading1 = false;
116
+        that.listOfData = data.list;
117
+      });
118
+  }
119
+	
120
+	// 发药科室列表
121
+	getDispensingDept(e,type){
122
+		var that = this;
123
+		let data = {
124
+			idx: 0,
125
+			sum: 9999,
126
+			drugsConfigure: {
127
+			  hosId: this.hosId,
128
+				deptId :e,
129
+				batchId:''
130
+			}
131
+		};
132
+		if(type=='dept'){
133
+			data.drugsConfigure.batchId = this.detailId
134
+		}else{
135
+			delete data.drugsConfigure.batchId
136
+		}
137
+		let deptData = this.hospitals1.find(i=>i.id==e)
138
+		that.mainService
139
+		  .getFetchDataList("data", "drugsConfigure", data)
140
+		  .subscribe((res) => {
141
+				if(res.list.length==0){
142
+					this.message.error(`您选择的科室“	${deptData.dept}”时间段内没有消耗药品无法添加发药单。`)
143
+				}
144
+				this.getDeptData(e,'all','load')
145
+		  });
146
+	}
147
+	
148
+	// 科室点击
149
+	deptClick(e,item,index){
150
+		e.stopPropagation();
151
+		this.deptId = item.applyDeptDTO.id
152
+		this.deptName = item.applyDeptDTO.dept
153
+		this.deptIndex = index
154
+		this.getList()
155
+	}
156
+	
157
+	// 科室删除
158
+	deptDel(e,item,index){
159
+		e.stopPropagation();
160
+		this.delModal = true;
161
+		this.coopId = item.applyDept;
162
+	}
163
+	
164
+	hideDelModal() {
165
+	  this.delModal = false;
166
+	}
167
+	
168
+	// 确认删除
169
+	confirmDel() {
170
+		var that = this;
171
+		let data = {
172
+			hosId: this.hosId,
173
+			deptId :this.coopId,
174
+			batchId: this.detailId
175
+		};
176
+		that.btnLoading = true;
177
+		that.mainService
178
+		  .transfusionConfigDeptDel(data)
179
+		  .subscribe((res) => {
180
+				that.btnLoading = false;
181
+				that.delModal = false;
182
+				this.deptId = null
183
+				this.deptName = null
184
+				this.deptIndex = null
185
+				this.getDeptData('','all','load')
186
+				if (res.status==200) {
187
+				  that.showPromptModal("删除", true, "");
188
+				} else {
189
+				  that.showPromptModal("删除", false, res.msg);
190
+				}
191
+		  });
192
+	}
193
+	// 选择楼栋
194
+	buildingChange(e){
195
+		this.deptId = null
196
+		this.deptName = null
197
+		this.deptIndex = null
198
+		this.listOfData=[]
199
+		this.getDeptData(e,'','')
200
+	}
201
+	
202
+	// 根据楼栋查询科室
203
+	getDeptData(e,type,initial){
204
+		var that = this;
205
+		let data = {
206
+		  idx: 0,
207
+		  sum: 99999,
208
+		  drugsList: {
209
+				hosId: this.hosId,
210
+				buildingId:e,
211
+				batch:{
212
+					id:this.detailId
213
+				}
214
+		  },
215
+		};
216
+		if(type=='all'){
217
+			delete data.drugsList.buildingId
218
+		}else{
219
+			data.drugsList.buildingId = e
220
+		}
221
+		that.mainService
222
+		  .getFetchDataList("data", "drugsList", data)
223
+		  .subscribe((res) => {
224
+		    that.deptList = res.list;
225
+				if(initial=='load'){
226
+					if(res.list.length>0){
227
+						this.deptId = res.list[0].applyDeptDTO.id
228
+						this.deptName = res.list[0].applyDeptDTO.dept
229
+						this.deptIndex = 0
230
+					}
231
+					this.getList()
232
+				}
233
+		  });
234
+	}
235
+	
236
+	// 选择科室
237
+	addDeptId=''
238
+	deptChange(e){
239
+		this.addDeptId = e
240
+		
241
+	}
242
+	// 添加科室
243
+	addDept(){
244
+		if(this.addDeptId){
245
+			this.getDispensingDept(this.addDeptId,'dept')
246
+		}else{
247
+			this.message.error('请先选择发药科室')
248
+		}
249
+	}
250
+	
251
+	// 获取楼栋
252
+	getBuilding(name){
253
+		let postData = {
254
+		  building: {
255
+		    cascadeHosId: this.hosId,
256
+		    buildingName: name
257
+		  },
258
+		  idx: 0,
259
+		  sum: 20,
260
+		};
261
+		this.mainService
262
+		  .getFetchDataList("data", "building", postData)
263
+		  .subscribe((result) => {
264
+				setTimeout(_=>{
265
+					this.isDeptLoading = false
266
+					this.buildingList = result.list;
267
+				},500)
268
+		  });
269
+	}
270
+	
271
+	// 获取所有科室
272
+  getDeparts(dept) {
273
+    var that = this;
274
+    let data = {
275
+      department: {
276
+        dept,
277
+        hospital: {
278
+          id: this.hosId
279
+        },
280
+      },
281
+      idx: 0,
282
+      sum: 20,
283
+    };
284
+    that.mainService
285
+      .getFetchDataList("data", "department", data)
286
+      .subscribe((data) => {
287
+				setTimeout(_=>{
288
+					that.isDeptLoading = false;
289
+					this.hospitals1 = data.list
290
+				},500)
291
+      });
292
+  }
293
+	
294
+  // 获取所有院区
295
+  getAllHospital() {
296
+		this.getDeparts('')
297
+		this.getBuilding('')
298
+		this.getDeptData('','all','load')
299
+  }
300
+	
301
+	// 增加/减少
302
+	itemClick(e, id, type){
303
+		e.stopPropagation();
304
+		this.rowId = id
305
+		if(type=='add'){
306
+			this.add = true
307
+		}else{
308
+			this.add = false
309
+		}
310
+		this.modal = true
311
+		this.initForm();
312
+	}
313
+	
314
+	// 表单提交
315
+	submitForm(): void {
316
+	  var that = this;
317
+		for (const i in that.validateForm.controls) {
318
+		  that.validateForm.controls[i].markAsDirty();
319
+		  that.validateForm.controls[i].updateValueAndValidity();
320
+		}
321
+		if (that.validateForm.invalid) return;
322
+	  let data = {
323
+			addSub:this.add?this.validateForm.value.addNum:this.validateForm.value.delNum,
324
+			id:this.rowId,
325
+			hosId:this.hosId,
326
+			deptId:this.deptId,
327
+			upType:that.add ? 'add' : 'sub'
328
+	  };
329
+	  that.mainService
330
+	    .simplePost("addData", "drugsConfigure", data)
331
+	    .subscribe((data) => {
332
+	      that.btnLoading = false;
333
+	      that.hideModal();
334
+				this.getList()
335
+	      if (data.status == 200) {
336
+	        that.showPromptModal(that.add ? "增加" : "减少", true, "");
337
+	      } else {
338
+	        that.showPromptModal(that.add ? "增加" : "减少", false, data.msg);
339
+	      }
340
+	    });
341
+	}
342
+
343
+  // 新增弹框
344
+  showModal() {
345
+    this.add = true;
346
+    this.isAddDeptsPhone = true;
347
+    this.deptPhones = [];
348
+  }
349
+	// 返回
350
+	back(){
351
+		this.router.navigateByUrl(`/main/dispensingBatch`);
352
+	}
353
+	
354
+  hideModal() {
355
+		this.initForm();
356
+    this.modal = false;
357
+  }
358
+  // 初始化新增form表单
359
+  initForm() {
360
+		if(this.add){
361
+			this.validateForm = this.fb.group({
362
+			  addNum: [null, [Validators.required]]
363
+			});
364
+		}else{
365
+			this.validateForm = this.fb.group({
366
+				delNum: [null, [Validators.required]]
367
+			});
368
+		}
369
+  }
370
+
371
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
372
+  showPromptModal(con, success, promptInfo?) {
373
+    this.promptModalShow = false;
374
+    this.promptContent = con;
375
+    this.ifSuccess = success;
376
+    this.promptInfo = promptInfo;
377
+    setTimeout(() => {
378
+      this.promptModalShow = true;
379
+    }, 100);
380
+  }
381
+
382
+  delModal: boolean = false; //删除模态框
383
+  coopIds: any;
384
+  coopFlag: any = false;
385
+
386
+}

+ 19 - 0
src/app/views/dispensing-detail/dispensing-detail.module.ts

@@ -0,0 +1,19 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+
4
+import { DispensingDetailRoutingModule } from './dispensing-detail-routing.module';
5
+import { DispensingDetailComponent } from './dispensing-detail.component';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+
8
+
9
+@NgModule({
10
+  declarations: [
11
+    DispensingDetailComponent,
12
+  ],
13
+  imports: [
14
+    CommonModule,
15
+    DispensingDetailRoutingModule,
16
+    ShareModule
17
+  ]
18
+})
19
+export class DispensingDetailModule { }

+ 17 - 0
src/app/views/drug-cloud/drug-cloud-routing.module.ts

@@ -0,0 +1,17 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { DrugCloudComponent } from './drug-cloud.component';
4
+
5
+
6
+const routes: Routes = [
7
+  {
8
+    path: '',
9
+    component: DrugCloudComponent
10
+  }
11
+];
12
+
13
+@NgModule({
14
+  imports: [RouterModule.forChild(routes)],
15
+  exports: [RouterModule]
16
+})
17
+export class DrugCloudRoutingModule { }

+ 127 - 0
src/app/views/drug-cloud/drug-cloud.component.html

@@ -0,0 +1,127 @@
1
+<div class="list-template">
2
+  <div class="list-template__content">
3
+    <div class="list-template__top" nz-row>
4
+      <div nz-col nzLg='20' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <span class="label">科室:</span>
7
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" (nzOnSearch)="changeInp($event,'dept')" nzServerSearch nzShowSearch nzPlaceHolder="请选择科室" [(ngModel)]="department">
8
+            <ng-container *ngFor="let option of hospitals1">
9
+              <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
10
+            </ng-container>
11
+            <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
12
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
13
+            </nz-option>
14
+          </nz-select>
15
+        </div>
16
+        <div class="list-template__searchItem">
17
+          <span class="label">药品:</span>
18
+					<nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" (nzOnSearch)="changeInp($event,'drug')" nzServerSearch nzShowSearch nzPlaceHolder="请选择药品" [(ngModel)]="drug">
19
+					  <ng-container *ngFor="let option of drugData">
20
+					    <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.drugName" [nzValue]="option.id"></nz-option>
21
+					  </ng-container>
22
+					  <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
23
+					    <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
24
+					  </nz-option>
25
+					</nz-select>
26
+        </div>
27
+      </div>
28
+      <div nz-col nzLg="4" class="list-template__btns">
29
+        <button class="btn default" (click)='search()'>搜索</button>
30
+        <button class="btn default ml8" (click)='reset()'>重置</button>
31
+      </div>
32
+    </div>
33
+    <div class="list-template__bottom">
34
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
35
+        [nzLoading]="loading1">
36
+        <thead>
37
+          <tr class="thead">
38
+						<th nzWidth="10%">科室名称</th>
39
+						<th nzWidth="10%">药品标识</th>
40
+            <th nzWidth="20%">药品名称</th>
41
+            <th nzWidth="10%">规格</th>
42
+            <th nzWidth="20%">库存数量(正负值)</th>
43
+            <th nzWidth="20%">库存价值(正负值)</th>
44
+            <th nzWidth="10%">操作</th>
45
+          </tr>
46
+        </thead>
47
+        <tbody>
48
+          <tr *ngFor="let data of listOfData" (click)="selectedListData(data.id)">
49
+            <td>{{ data.departmentDTO?data.departmentDTO.dept:'-' }}</td>
50
+						<td>{{ data.drugsInfoDTO?data.drugsInfoDTO.drugCode:'-' }}</td>
51
+            <td>{{ data.drugsInfoDTO?data.drugsInfoDTO.drugName:'-' }}</td>
52
+            <td>{{ data.drugsInfoDTO?data.drugsInfoDTO.specs:'0' }}</td>
53
+            <td>{{ data.inventoryNum || '0' }}</td>
54
+            <td>{{ data.inventoryPrice || '0' }}</td>
55
+            <td>
56
+              <div class="coop">
57
+                <span *ngIf="coopBtns.historyRecord" (click)="detail($event,data)">历史记录</span>
58
+              </div>
59
+            </td>
60
+          </tr>
61
+        </tbody>
62
+      </nz-table>
63
+      <div class="list-template__pagination">
64
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
65
+          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
66
+        </nz-pagination>
67
+      </div>
68
+    </div>
69
+  </div>
70
+
71
+  <!-- 历史记录 -->
72
+  <div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
73
+    <div class="modalBody">
74
+      <div class="title">历史记录<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
75
+      </div>
76
+      <overlay-scrollbars #osComponentRef1 class="content">
77
+        <div class="list-template__bottom">
78
+          <nz-table class="list-template__nzTable" [nzData]="viewData" nzSize="middle" [nzShowPagination]="false"
79
+            [nzLoading]="loading1">
80
+            <thead>
81
+              <tr class="thead">
82
+                <th nzWidth="13%">时间</th>
83
+                <th nzWidth="13%">批次号</th>
84
+								<th nzWidth="13%">发药单号</th>
85
+                <th nzWidth="8%">消耗数量</th>
86
+								<th nzWidth="8%">原库存数</th>
87
+								<th nzWidth="7%">增减</th>
88
+                <th nzWidth="10%">包装规格</th>
89
+                <th nzWidth="10%">发药药箱</th>
90
+								<th nzWidth="8%">实发数量</th>
91
+                <th nzWidth="10%">计算后库存</th>
92
+              </tr>
93
+            </thead>
94
+            <tbody>
95
+              <tr *ngFor="let data of viewData">
96
+                <td>{{ data.createTime|date:'yyyy-MM-dd HH:mm'}}</td>
97
+                <td>{{ data.drugsList?data.drugsList.batch.batchNo : '无' }}</td>
98
+                <td>{{ data.drugsList?data.drugsList.packingNo : '无' }}</td>
99
+								<td>{{ data.drugsConfig?data.drugsConfig.expendCount:'0' }}</td>
100
+								<td>{{ data.drugsConfig&&data.drugsConfig.formerInventory?data.drugsConfig.formerInventory:'0' }}</td>
101
+								<td>{{ data.drugsConfig&&data.drugsConfig.addSub?data.drugsConfig.addSub:'0' }}</td>
102
+                <td>{{ data.drugsInfo?data.drugsInfo.packingSpecs:'0' }}</td>
103
+                <td>{{ data.drugsConfig?data.drugsConfig.cartonNum : '0' }}</td>
104
+                <td>{{ data.drugsConfig?data.drugsConfig.actualCount : '0'}}</td>
105
+        				<td>{{ data.drugsConfig?data.drugsConfig.afterInventory : '0' }}</td>
106
+              </tr>
107
+            </tbody>
108
+          </nz-table>
109
+        <!--  <div class="list-template__pagination">
110
+            <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
111
+              (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
112
+            </nz-pagination>
113
+          </div> -->
114
+        </div>
115
+      </overlay-scrollbars>
116
+      <div class="display_flex justify-content_flex-center">
117
+        <button class="btn" nz-button nzType="primary" (click)="hideModal()">知道了</button>
118
+      </div>
119
+    </div>
120
+  </div>
121
+
122
+</div>
123
+<!-- 操作成功/失败提示框 -->
124
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
125
+  [info]="promptInfo"></app-prompt-modal>
126
+
127
+<app-excel-import [isShow]="isShow" (hideFormHand)="hideExcelImport($event)" *ngIf="isShow" (submitFormHand)="submitExcelImport($event)"></app-excel-import>

+ 251 - 0
src/app/views/drug-cloud/drug-cloud.component.less

@@ -0,0 +1,251 @@
1
+@import "../../../../src/theme.less";
2
+:host {
3
+  .add-button {
4
+    margin: 0 auto 16px !important;
5
+  }
6
+  .targetDept {
7
+    overflow: hidden;
8
+    // width: 90px;
9
+    text-overflow: ellipsis;
10
+    white-space: nowrap;
11
+  }
12
+  .dynamic {
13
+    margin-bottom: 16px;
14
+    display: flex;
15
+    align-items: center;
16
+    input {
17
+      width: 90%;
18
+    }
19
+    i {
20
+      margin-left: 8px;
21
+      cursor: pointer;
22
+      font-size: 18px;
23
+    }
24
+  }
25
+}
26
+
27
+.save {
28
+  position: fixed;
29
+  left: 0;
30
+  top: 0;
31
+  width: 100%;
32
+  height: 100%;
33
+  background: rgba(0, 0, 0, 0.4);
34
+  z-index: 99;
35
+
36
+  .modalBody {
37
+    width: 350px;
38
+    background: #fff;
39
+    border-radius: 5px;
40
+    padding: 10px 20px;
41
+    color: #333;
42
+
43
+    .title {
44
+      width: 100%;
45
+      text-align: center;
46
+      font-size: 18px;
47
+      position: relative;
48
+
49
+      i {
50
+        position: absolute;
51
+        right: 0;
52
+        top: 0;
53
+        font-size: 20px;
54
+        color: #666;
55
+        cursor: pointer;
56
+        padding: 0 5px;
57
+      }
58
+    }
59
+
60
+    .content {
61
+      width: 100%;
62
+      height: 117px;
63
+      background: #f9fafb;
64
+      border: 1px solid #e5e9ed;
65
+      border-radius: 5px;
66
+      overflow: hidden;
67
+      margin-top: 12px;
68
+
69
+      div {
70
+        text-align: center;
71
+        margin: 0;
72
+
73
+        &.icon {
74
+          margin-top: 17px;
75
+
76
+          i {
77
+            color: #34b349;
78
+            font-size: 30px !important;
79
+
80
+            &.transport-wenhao {
81
+              color: #f5a523;
82
+            }
83
+
84
+            &.transport-shibai {
85
+              color: #ff3a52;
86
+            }
87
+          }
88
+        }
89
+
90
+        &.defeat {
91
+          color: #333;
92
+          font-size: 18px;
93
+        }
94
+
95
+        &:nth-child(3) {
96
+          font-size: 14px;
97
+          color: #666;
98
+        }
99
+      }
100
+    }
101
+
102
+    button {
103
+      margin-top: 10px;
104
+
105
+      &.btn {
106
+        margin-left: 8px;
107
+      }
108
+    }
109
+  }
110
+
111
+  // 新增
112
+  &.add {
113
+    .modalBody {
114
+      width: 80%;
115
+      height: auto;
116
+
117
+      .content {
118
+        width: 100%;
119
+        height: auto;
120
+        padding: 19px 14px 0 14px;
121
+        max-height: 500px;
122
+        overflow-y: auto;
123
+				
124
+				.list-template__bottom {
125
+				  background: #f9fafb;
126
+				  border: 1px solid #e5e9ed;
127
+				  border-radius: 8px;
128
+				  padding-bottom: 56px;
129
+				  position: relative;
130
+				  .list-template__nzTable {
131
+				    padding: 16px 16px 0;
132
+				
133
+				    .thead {
134
+				      background-image: linear-gradient(to right, @bg-start, @bg-end);
135
+				
136
+				      th {
137
+				        background: transparent;
138
+				        color: #fff;
139
+				        text-align: center;
140
+				      }
141
+				    }
142
+				
143
+				    .ant-table-body {
144
+				      border-bottom: 1px solid #e5e9ed;
145
+				    }
146
+				
147
+				    .ant-table-tbody {
148
+				      tr {
149
+				        text-align: center;
150
+				        color: #333;
151
+				
152
+				        td {
153
+				          border: none;
154
+				
155
+				          &.tab_hover:hover{
156
+				            text-decoration: underline;
157
+				            cursor: pointer;
158
+				          }
159
+				
160
+				          .coop {
161
+				            button{
162
+				              color: #333;
163
+				            }
164
+				            span,button {
165
+				              display: inline-block;
166
+				              padding: 0 8px;
167
+				              cursor: pointer;
168
+				              position: relative;
169
+				
170
+				              &::after {
171
+				                content: "|";
172
+				                position: absolute;
173
+				                top: 0;
174
+				                right: 0;
175
+				              }
176
+				
177
+				              &:hover,
178
+				              &:active {
179
+				                color: @primary-color;
180
+				              }
181
+				
182
+				              &:nth-last-child(1) {
183
+				                &::after {
184
+				                  content: "";
185
+				                }
186
+				              }
187
+				            }
188
+				          }
189
+				        }
190
+				      }
191
+				    }
192
+				  }
193
+				  .list-template__pagination {
194
+				    height: 56px;
195
+				    display: flex;
196
+				    align-items: center;
197
+				    position: absolute;
198
+				    right: 8px;
199
+				  }
200
+				}
201
+				
202
+        .addForm {
203
+          .ant-form-item {
204
+            margin-bottom: 14px;
205
+
206
+            .ant-form-item-label {
207
+              line-height: 14px;
208
+              text-align: left;
209
+            }
210
+          }
211
+        }
212
+
213
+        .editForm {
214
+          .ant-form-item {
215
+            margin-bottom: 14px;
216
+
217
+            .ant-form-item-label {
218
+              line-height: 0;
219
+              text-align: left;
220
+            }
221
+          }
222
+        }
223
+      }
224
+
225
+      button {
226
+        &:nth-child(1) {
227
+          margin-right: 20px;
228
+        }
229
+      }
230
+    }
231
+  }
232
+}
233
+
234
+.monad{
235
+	padding: 10px;
236
+	border: 1px solid #e7e7e7;
237
+	border-radius: 5px;
238
+	margin-top: 20px;
239
+	.monad-title{
240
+		text-align: center;
241
+		font-weight: 700;
242
+		font-size: 16px;
243
+	}
244
+	.monad-sign{
245
+		display: flex;
246
+		line-height: 30px;
247
+		div{
248
+			margin-right: 15px;
249
+		}
250
+	}
251
+}

+ 323 - 0
src/app/views/drug-cloud/drug-cloud.component.ts

@@ -0,0 +1,323 @@
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import {
4
+  FormBuilder,
5
+  Validators,
6
+  FormGroup,
7
+  FormControl,
8
+} from "@angular/forms";
9
+
10
+import { MainService } from "../../services/main.service";
11
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
12
+import { ToolService } from "../../services/tool.service";
13
+import { NzMessageService } from "ng-zorro-antd";
14
+import { Subject } from "rxjs";
15
+import { debounceTime, filter } from "rxjs/operators";
16
+import host from "../../../assets/js/http";
17
+import { HttpRequest, HttpResponse, HttpClient } from '@angular/common/http';
18
+
19
+@Component({
20
+  selector: "app-drug-cloud",
21
+  templateUrl: "./drug-cloud.component.html",
22
+  styleUrls: ["./drug-cloud.component.less"],
23
+})
24
+export class DrugCloudComponent implements OnInit {
25
+  @ViewChild("osComponentRef1", {
26
+    read: OverlayScrollbarsComponent,
27
+    static: false,
28
+  })
29
+  osComponentRef1: OverlayScrollbarsComponent;
30
+  constructor(
31
+    private message: NzMessageService,
32
+    private fb: FormBuilder,
33
+    private route: ActivatedRoute,
34
+    private router: Router,
35
+    private mainService: MainService,
36
+    private tool: ToolService,
37
+    private http: HttpClient,
38
+  ) {}
39
+
40
+  ngOnInit() {
41
+    this.searchParentDeptSubject.pipe(debounceTime(500)).subscribe((e) => {
42
+			this.isDeptLoading = true;
43
+			if(e[1]=='dept'){
44
+				this.getDeparts(e[0]);
45
+			}else{
46
+				this.getDrugInfo(e[0]);
47
+			}
48
+    });
49
+		this.hosId = this.tool.getCurrentHospital().id;
50
+    this.coopBtns = this.tool.initCoopBtns(this.route);
51
+    this.initForm();
52
+    this.getAllHospital();
53
+  }
54
+  listOfData: any[] = []; //表格数据
55
+  promptContent: string; //操作提示框提示信息
56
+  ifSuccess: boolean; //操作成功/失败
57
+  promptInfo: string; //操作结果提示信息
58
+  promptModalShow: boolean; //操作提示框是否展示
59
+  modal: boolean = false; //新增/编辑模态框
60
+  add: boolean; //true:新增;false:编辑
61
+  validateForm: FormGroup; //新增/编辑表单
62
+  coopId: number; //表格中执行操作的id
63
+  department: number; //所属科室
64
+	drug: number; //药品名称
65
+	hosId: number; 
66
+	dateRange;//时间
67
+  batchNumber; //批次号
68
+  num; //编码
69
+  deptalias; //别名
70
+  type; //类型
71
+  deptHandoverType; //类型
72
+  pageIndex: number = 1; //页码
73
+  listLength: number = 10; //总条数
74
+  pageSize: number = 10; //每页条数
75
+  btnLoading: boolean = false; //确认按钮loading状态
76
+  printLoading: boolean = false; //批量打印按钮loading状态
77
+  deptPhones: any = []; //新添加的科室电话列表
78
+  isAddDeptsPhone = true; //添加新的科室电话是否禁用
79
+  deptsPhoneId = 1; //科室电话自增id
80
+  allParentdepart: any = []; //所有的父级科室列表
81
+  hospitals1: any = []; //科室列表(搜索)
82
+	rowData: object = {}; //打印选择列表
83
+  searchParentDeptSubject = new Subject();
84
+  // 初始化增删改按钮
85
+  coopBtns: any = {};
86
+	drugData: any = []; //药品搜索列表
87
+	drugTypeData: any = {}; //药品类型
88
+	viewData: any = []; //历史记录
89
+  // 导入---start
90
+  // model-取消
91
+  isShow = false;
92
+  hideExcelImport() {
93
+    this.isShow = false;
94
+  }
95
+  // 触发
96
+  excelImport() {
97
+    this.isShow = true;
98
+  }
99
+
100
+  // 导入---end
101
+  //搜索父级科室
102
+	isDeptLoading = false;
103
+  changeInp(e,type) {
104
+    this.searchParentDeptSubject.next([e,type]);
105
+  }
106
+
107
+  // 配送建单
108
+  coopData:any = {};
109
+  addDateModal(data) {
110
+    this.coopData = data;
111
+    this.showDelModal1();
112
+  }
113
+  delModal1: boolean = false; //删除模态框
114
+
115
+  showDelModal1() {
116
+    this.delModal1 = true;
117
+  }
118
+  hideDelModal1() {
119
+    this.delModal1 = false;
120
+  }
121
+
122
+  // 搜索
123
+  search() {
124
+    this.pageIndex = 1;
125
+    this.getList();
126
+  }
127
+  // 重置
128
+  reset() {
129
+    this.pageIndex = 1;
130
+    this.department = null;
131
+    this.drug = null;
132
+    this.getList();
133
+  }
134
+	
135
+	// 获取药品类型
136
+	getDrugType(){
137
+		this.mainService.getDictionary("list", "drug_type").subscribe((data) => {
138
+			this.drugTypeData = data.find(i=>i.value=='infusion_solutions')
139
+			this.getDrugInfo('')
140
+		});
141
+	}
142
+	
143
+	// 获取药品信息
144
+	getDrugInfo(e) {
145
+	  let data = {
146
+	    idx: 0,
147
+	    sum: 20,
148
+	    drugsInfo: {
149
+				drugName: e,
150
+	      hosId: this.hosId || "" ,
151
+				drugType:{
152
+					id:this.drugTypeData.id
153
+				}
154
+	    },
155
+	  };
156
+	  this.mainService
157
+	    .getFetchDataList("data", "drugsInfo", data)
158
+	    .subscribe((data) => {
159
+				this.isDeptLoading = false;
160
+	      this.drugData = data.list;
161
+				this.getList();
162
+	    });
163
+	}
164
+	
165
+  // 表格数据
166
+  loading1 = false;
167
+  getList() {
168
+    var that = this;
169
+    let data = {
170
+      idx: that.pageIndex - 1,
171
+      sum: that.pageSize,
172
+      drugsCloudInventory: {
173
+        deptId: that.department,
174
+        drugId: that.drug,
175
+        hosId: this.hosId
176
+      },
177
+    };
178
+    this.loading1 = true;
179
+    that.mainService
180
+      .getFetchDataList("data", "drugsCloudInventory", data)
181
+      .subscribe((data) => {
182
+        this.loading1 = false;
183
+        that.listOfData = data.list;
184
+        that.listLength = data.totalNum;
185
+      });
186
+  }
187
+	
188
+	
189
+	// 获取所有科室
190
+  getDeparts(dept) {
191
+    var that = this;
192
+    let data = {
193
+      department: {
194
+        dept,
195
+        hospital: {
196
+          id: this.hosId
197
+        },
198
+      },
199
+      idx: 0,
200
+      sum: 20,
201
+    };
202
+    that.mainService
203
+      .getFetchDataList("data", "department", data)
204
+      .subscribe((data) => {
205
+				setTimeout(_=>{
206
+					this.isDeptLoading = false
207
+					this.hospitals1 = data.list
208
+				},500)
209
+      });
210
+  }
211
+	
212
+  // 获取所有院区
213
+  getAllHospital() {
214
+		this.getDeparts('')
215
+    this.getDrugType();
216
+  }
217
+
218
+
219
+  // 新增弹框
220
+  showModal() {
221
+    this.initForm();
222
+    // this.changeHosp();
223
+    this.add = true;
224
+    this.isAddDeptsPhone = true;
225
+    this.deptPhones = [];
226
+  }
227
+  hideModal() {
228
+    this.modal = false;
229
+    this.initForm();
230
+  }
231
+  // 初始化新增form表单
232
+  initForm() {
233
+    this.validateForm = this.fb.group({
234
+      parentOfficeName: [null],
235
+      officeName: [null, [Validators.required]],
236
+      deptalias: [null],
237
+      officeNo: [null, [Validators.required]],
238
+      officeNum: [null, [Validators.required]],
239
+      building: [null, [Validators.required]],
240
+      floor: [null, [Validators.required]],
241
+      officeAddress: [null, [Validators.required]],
242
+      officeType: [null, [Validators.required]],
243
+      deptHandoverType: [null],
244
+      startTime1: [null],
245
+      endTime1: [null],
246
+      dynamicCode1: [null],
247
+      startTime2: [null],
248
+      endTime2: [null],
249
+      dynamicCode2: [null],
250
+    });
251
+  }
252
+  // 科室位置必填
253
+  buildValidator = (control: FormControl): { [s: string]: boolean } => {
254
+    if (
255
+      this.validateForm &&
256
+      this.validateForm.value &&
257
+      (!this.validateForm.value.building ||
258
+        !this.validateForm.value.floor ||
259
+        !this.validateForm.value.officeAddress)
260
+    ) {
261
+      return { required: true };
262
+    }
263
+  };
264
+
265
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
266
+  showPromptModal(con, success, promptInfo?) {
267
+    this.promptModalShow = false;
268
+    this.promptContent = con;
269
+    this.ifSuccess = success;
270
+    this.promptInfo = promptInfo;
271
+    setTimeout(() => {
272
+      this.promptModalShow = true;
273
+    }, 100);
274
+    this.getList();
275
+  }
276
+
277
+  delModal: boolean = false; //删除模态框
278
+  coopIds: any;
279
+  coopFlag: any = false;
280
+  /**
281
+   *
282
+   * @param e 事件对象
283
+   * @param flag true是批量删除,false是单个删除
284
+   * @param id
285
+   */
286
+  showDelModal(e, flag, id) {
287
+    e.stopPropagation();
288
+    this.delModal = true;
289
+    this.coopFlag = flag;
290
+    if (flag) {
291
+      this.coopIds = id;
292
+    } else {
293
+      this.coopId = id;
294
+    }
295
+  }
296
+  hideDelModal() {
297
+    this.delModal = false;
298
+  }
299
+
300
+  // 查看
301
+  detail(e, item) {
302
+    e.stopPropagation();
303
+		var that = this;
304
+		let data = {
305
+			idx: 0,
306
+			sum: 9999,
307
+			drugsLog: {
308
+			  hosId: this.hosId,
309
+			  drugId: item.drugId,
310
+				deptId: item.deptId
311
+			}
312
+		};
313
+		this.loading1 = true;
314
+		that.mainService
315
+		  .getFetchDataList("data", "drugsLog", data)
316
+		  .subscribe((data) => {
317
+		    this.loading1 = false;
318
+				this.modal = true
319
+		    that.viewData = data.list;
320
+		  });
321
+  }
322
+
323
+}

+ 19 - 0
src/app/views/drug-cloud/drug-cloud.module.ts

@@ -0,0 +1,19 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+
4
+import { DrugCloudRoutingModule } from './drug-cloud-routing.module';
5
+import { DrugCloudComponent } from './drug-cloud.component';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+
8
+
9
+@NgModule({
10
+  declarations: [
11
+    DrugCloudComponent,
12
+  ],
13
+  imports: [
14
+    CommonModule,
15
+    DrugCloudRoutingModule,
16
+    ShareModule
17
+  ]
18
+})
19
+export class DrugCloudModule { }

+ 15 - 0
src/app/views/drug-info/drug-info-routing.module.ts

@@ -0,0 +1,15 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { DrugInfoComponent } from './drug-info.component';
4
+
5
+
6
+const routes: Routes = [{
7
+  path: '',
8
+  component: DrugInfoComponent
9
+}];
10
+
11
+@NgModule({
12
+  imports: [RouterModule.forChild(routes)],
13
+  exports: [RouterModule]
14
+})
15
+export class DrugInfoRoutingModule { }

+ 184 - 0
src/app/views/drug-info/drug-info.component.html

@@ -0,0 +1,184 @@
1
+<div class="list-template">
2
+  <div class="list-template__content">
3
+    <div class="list-template__top" nz-row>
4
+      <div nz-col nzXl='18' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <span class="label">药品标识</span>:
7
+          <input nz-input class="formItem" [(ngModel)]="drugCode" placeholder="请输入药品标识" nzSize="default" />
8
+        </div>
9
+        <div class="list-template__searchItem">
10
+          <span class="label">药品名称</span>:
11
+          <input nz-input class="formItem" [(ngModel)]="name" placeholder="请输入药品名称" nzSize="default" />
12
+        </div>
13
+      </div>
14
+      <div nz-col nzXl='6' class="list-template__btns">
15
+        <button nz-button class="btn default" (click)='search()'>搜索</button>
16
+        <button nz-button class="btn ml8 default" (click)='reset()'>重置</button>
17
+        <button nz-button *ngIf="coopBtns.add" class="btn ml8 default" (click)="showModal()">新增</button>
18
+      </div>
19
+    </div>
20
+    <div class="list-template__bottom">
21
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
22
+        [nzLoading]="loading1">
23
+        <thead>
24
+          <tr class="thead">
25
+            <th nzWidth="5%">序号</th>
26
+            <th nzWidth="10%">药品标识</th>
27
+            <th nzWidth="20%">药品名称</th>
28
+            <th nzWidth="10%">规格</th>
29
+            <th nzWidth="9%">单位</th>
30
+            <th nzWidth="9%">单价</th>
31
+            <th nzWidth="9%">包装规格</th>
32
+            <th nzWidth="9%">低舍</th>
33
+						<th nzWidth="9%">高入</th>
34
+            <th nzWidth="10%">操作</th>
35
+          </tr>
36
+        </thead>
37
+        <tbody>
38
+          <tr *ngFor="let data of listOfData;let index=index;">
39
+            <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
40
+            <td>{{ data.drugCode||'-' }}</td>
41
+            <td>{{ data.drugName||'-' }}</td>
42
+            <td>{{ data.specs||'-'}}</td>
43
+            <td>{{ data.unit||'-' }}</td>
44
+            <td>{{ data.unitPrice||'-' }}</td>
45
+            <td>{{ data.packingSpecs }}</td>
46
+						<td>{{ data.lowerRound }}</td>
47
+						<td>{{ data.upperRound }}</td>
48
+            <td>
49
+              <div class="coop">
50
+                <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
51
+                <span *ngIf="coopBtns.del" (click)="del(data)">删除</span>
52
+              </div>
53
+            </td>
54
+          </tr>
55
+        </tbody>
56
+      </nz-table>
57
+      <div class="list-template__pagination">
58
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
59
+          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
60
+        </nz-pagination>
61
+      </div>
62
+    </div>
63
+  </div>
64
+</div>
65
+<!-- 新增/编辑模态框 -->
66
+<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
67
+  <div class="modalBody">
68
+    <div class="title">药品信息 - {{add?"新增":"编辑"}}<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
69
+    </div>
70
+    <overlay-scrollbars #osComponentRef1 class="content">
71
+      <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
72
+        <nz-form-item>
73
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="drugCode">药品标识</nz-form-label>
74
+          <nz-form-control nzErrorTip="请填写药品标识!">
75
+            <nz-input-group>
76
+              <input type="text" pattern="^[^\u4e00-\u9fa5]+$" (input)="handleInput($event)"
77
+							nz-input formControlName="drugCode" placeholder="请填写药品标识" />
78
+            </nz-input-group>
79
+          </nz-form-control>
80
+        </nz-form-item>
81
+        <nz-form-item>
82
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="drugName">药品名称</nz-form-label>
83
+          <nz-form-control nzErrorTip="请填写药品名称!">
84
+            <nz-input-group>
85
+              <input type="drugName" nz-input formControlName="drugName" placeholder="请填写药品名称" />
86
+            </nz-input-group>
87
+          </nz-form-control>
88
+        </nz-form-item>
89
+        <nz-form-item>
90
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="specs">规格</nz-form-label>
91
+          <nz-form-control nzErrorTip="请填写规格!">
92
+            <nz-input-group>
93
+              <input type="specs" nz-input formControlName="specs" placeholder="请填写规格" />
94
+            </nz-input-group>
95
+          </nz-form-control>
96
+        </nz-form-item>
97
+        <nz-form-item>
98
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="unit">单位</nz-form-label>
99
+          <nz-form-control nzErrorTip="请填写单位!">
100
+            <nz-input-group>
101
+              <input nz-input formControlName="unit" placeholder="请填写单位" />
102
+            </nz-input-group>
103
+          </nz-form-control>
104
+        </nz-form-item>
105
+        <nz-form-item>
106
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="unitPrice">单价</nz-form-label>
107
+          <nz-form-control nzErrorTip="请填写单价!">
108
+           <nz-input-number
109
+							formControlName="unitPrice"
110
+            	[nzMin]="0"
111
+							[nzPrecision]="2"
112
+            	[nzMax]="999999"
113
+            	[nzStep]="0.1"
114
+            	[nzPlaceHolder]="'请填写单价(保留2位小数)'"
115
+            ></nz-input-number>
116
+          </nz-form-control>
117
+        </nz-form-item>
118
+				<nz-form-item>
119
+				  <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="packingSpecs">包装规格</nz-form-label>
120
+				  <nz-form-control nzErrorTip="请填写包装规格!">
121
+				    <nz-input-group>
122
+							<nz-input-number
123
+								formControlName="packingSpecs"
124
+								[nzMin]="0"
125
+								[nzPrecision]="0"
126
+								[nzMax]="999999"
127
+								[nzStep]="1"
128
+								[nzPlaceHolder]="'请填写包装规格'"
129
+							 ></nz-input-number>
130
+						 </nz-input-group>
131
+				  </nz-form-control>
132
+				</nz-form-item>
133
+				<nz-form-item>
134
+				  <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="lowerRound">低舍</nz-form-label>
135
+				  <nz-form-control nzErrorTip="请填写低舍!">
136
+				    <nz-input-group>
137
+							<nz-input-number
138
+								(ngModelChange)="lowerChange($event)"
139
+								formControlName="lowerRound"
140
+								[nzMin]="0"
141
+								[nzPrecision]="0"
142
+								[nzMax]="999999"
143
+								[nzStep]="1"
144
+								[nzPlaceHolder]="'请填写低舍'"
145
+							 ></nz-input-number>
146
+						</nz-input-group>
147
+				  </nz-form-control>
148
+				</nz-form-item>
149
+				<nz-form-item>
150
+				  <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="upperRound">高入</nz-form-label>
151
+				  <nz-form-control nzErrorTip="请填写高入!">
152
+				    <nz-input-group>
153
+							<nz-input-number
154
+								formControlName="upperRound"
155
+								[nzDisabled]="true"
156
+								[nzMin]="0"
157
+								[nzPrecision]="0"
158
+								[nzMax]="999999"
159
+								[nzStep]="1"
160
+								[nzPlaceHolder]="'请填写高入'"
161
+							 ></nz-input-number>
162
+						</nz-input-group>
163
+				  </nz-form-control>
164
+				</nz-form-item>
165
+      </form>
166
+    </overlay-scrollbars>
167
+    <div class="display_flex justify-content_flex-center">
168
+      <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">确认</button>
169
+      <button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
170
+    </div>
171
+  </div>
172
+</div>
173
+<!-- 删除模态框 -->
174
+<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading" 
175
+  (confirmDelEvent)="confirmDel()" (cancelDelEvent)="cancelDel()" content="是否删除药品信息?" confirmTxt="是" cancelTxt="否">
176
+</app-dialog-delete>
177
+
178
+<!-- 操作成功/失败提示框 -->
179
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
180
+  [info]="promptInfo"></app-prompt-modal>
181
+
182
+<!-- 查看详情 -->
183
+<router-outlet (deactivate)="getList()"></router-outlet>
184
+

+ 130 - 0
src/app/views/drug-info/drug-info.component.less

@@ -0,0 +1,130 @@
1
+@import "../../../../src/theme.less";
2
+.save {
3
+  position: fixed;
4
+  left: 0;
5
+  top: 0;
6
+  width: 100%;
7
+  height: 100%;
8
+  background: rgba(0, 0, 0, 0.4);
9
+  z-index: 99;
10
+
11
+  .modalBody {
12
+    width: 350px;
13
+    background: #fff;
14
+    border-radius: 5px;
15
+    padding: 10px 20px;
16
+    color: #333;
17
+
18
+    .title {
19
+      width: 100%;
20
+      text-align: center;
21
+      font-size: 18px;
22
+      position: relative;
23
+
24
+      i {
25
+        position: absolute;
26
+        right: 0;
27
+        top: 0;
28
+        font-size: 20px;
29
+        color: #666;
30
+        cursor: pointer;
31
+        padding: 0 5px;
32
+      }
33
+    }
34
+
35
+    .content {
36
+      width: 100%;
37
+      height: 117px;
38
+      background: #f9fafb;
39
+      border: 1px solid #e5e9ed;
40
+      border-radius: 5px;
41
+      overflow: hidden;
42
+      margin-top: 12px;
43
+
44
+      div {
45
+        text-align: center;
46
+        margin: 0;
47
+
48
+        &.icon {
49
+          margin-top: 17px;
50
+
51
+          i {
52
+            color: #34b349;
53
+            font-size: 30px !important;
54
+
55
+            &.transport-wenhao {
56
+              color: #f5a523;
57
+            }
58
+
59
+            &.transport-shibai {
60
+              color: #ff3a52;
61
+            }
62
+          }
63
+        }
64
+
65
+        &.defeat {
66
+          color: #333;
67
+          font-size: 18px;
68
+        }
69
+
70
+        &:nth-child(3) {
71
+          font-size: 14px;
72
+          color: #666;
73
+        }
74
+      }
75
+    }
76
+
77
+    button {
78
+      margin-top: 10px;
79
+
80
+      &.btn {
81
+        margin-left: 8px;
82
+      }
83
+    }
84
+  }
85
+
86
+  // 新增
87
+  &.add {
88
+    .modalBody {
89
+      width: 480px;
90
+      height: auto;
91
+
92
+      .content {
93
+        width: 100%;
94
+        height: auto;
95
+        padding: 19px 14px 0 14px;
96
+        max-height: 500px;
97
+        overflow-y: auto;
98
+
99
+        .addForm {
100
+          .ant-form-item {
101
+            margin-bottom: 8px;
102
+						.ant-input-number{
103
+							width: 100% !important;
104
+						}
105
+            .ant-form-item-label {
106
+              line-height: 14px;
107
+              text-align: left;
108
+            }
109
+          }
110
+        }
111
+
112
+        .editForm {
113
+          .ant-form-item {
114
+            margin-bottom: 14px;
115
+						.ant-input-number{
116
+							width: 100% !important;
117
+						}
118
+            .ant-form-item-label {
119
+              line-height: 0;
120
+            }
121
+          }
122
+        }
123
+      }
124
+
125
+      button:nth-child(1) {
126
+        margin-right: 20px;
127
+      }
128
+    }
129
+  }
130
+}

+ 271 - 0
src/app/views/drug-info/drug-info.component.ts

@@ -0,0 +1,271 @@
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
+
5
+import { MainService } from "../../services/main.service";
6
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
7
+import { ToolService } from "../../services/tool.service";
8
+import { forkJoin, Subject } from "rxjs";
9
+import { debounceTime } from "rxjs/operators";
10
+import { NzMessageService } from "ng-zorro-antd";
11
+
12
+@Component({
13
+  selector: "app-drug-info",
14
+  templateUrl: "./drug-info.component.html",
15
+  styleUrls: ["./drug-info.component.less"],
16
+})
17
+export class DrugInfoComponent implements OnInit {
18
+  @ViewChild("osComponentRef1", {
19
+    read: OverlayScrollbarsComponent,
20
+    static: false,
21
+  })
22
+  osComponentRef1: OverlayScrollbarsComponent;
23
+  constructor(
24
+    private message: NzMessageService,
25
+    private fb: FormBuilder,
26
+    private route: ActivatedRoute,
27
+    private router: Router,
28
+    private mainService: MainService,
29
+    private tool: ToolService
30
+  ) {}
31
+
32
+  listOfData: any[] = []; //表格数据
33
+
34
+  modal: boolean = false; //新增/编辑模态框
35
+  add: boolean; //true:新增;false:编辑
36
+  validateForm: FormGroup; //新增/编辑表单
37
+  coopId: number; //表格中执行操作的id
38
+  department: any; //所属科室
39
+  drugCode; //编号
40
+  name; //名称
41
+  userType: any; //用户类型
42
+  hosId: any; //院区(搜索)
43
+  userGroup; //所属组
44
+  userGroup1; //所属组(搜索)
45
+  userTypes: Array<any>; //所有用户类型
46
+  alldepart: any = []; //所有所属科室
47
+  alldepart1: any = []; //所有所属科室(搜索)
48
+  hospitals1: any = []; //院区列表(搜索)
49
+	drugTypeData: any = []; //药品类型
50
+  allUserGroup: Array<any>; //所有用户组
51
+  allUserGroup1: Array<any>; //用户组(搜索)
52
+  allUserRole: Array<any>; //所有角色
53
+  pageIndex: number = 1; //页码
54
+  listLength: number = 10; //总条数
55
+  pageSize: number = 10; //每页条数
56
+
57
+  promptContent: string; //操作提示框提示信息
58
+  ifSuccess: boolean; //操作成功/失败
59
+  promptInfo: string; //操作结果提示信息
60
+  promptModalShow: boolean; //操作提示框是否展示
61
+
62
+  btnLoading: boolean = false; //提交按钮loading状态
63
+  wxRequired = false; //新增或编辑用户的时候,微信号是否必填
64
+  changeInpSubject = new Subject(); //防抖
65
+  changeInpHospitalSubject = new Subject(); //防抖
66
+  ngOnInit() {
67
+    this.coopBtns = this.tool.initCoopBtns(this.route);
68
+		this.hosId = this.tool.getCurrentHospital().id;
69
+    this.initForm();
70
+		this.getDrugType()
71
+  }
72
+
73
+  // 初始化增删改按钮
74
+  coopBtns: any = {};
75
+  // 搜索
76
+  search() {
77
+    this.pageIndex = 1;
78
+    this.getList();
79
+  }
80
+  // 重置
81
+  reset() {
82
+    this.pageIndex = 1;
83
+    this.name = "";
84
+    this.drugCode = "";
85
+    this.getList();
86
+  }
87
+  // 表格数据
88
+  loading1 = false;
89
+  getList() {
90
+    let data = {
91
+      idx: this.pageIndex - 1,
92
+      sum: this.pageSize,
93
+      drugsInfo: {
94
+        drugName: this.name || "",
95
+        drugCode: this.drugCode || "",
96
+        hosId: this.hosId || "" ,
97
+				drugType:{
98
+					id:this.drugTypeData.id
99
+				}
100
+      },
101
+    };
102
+    this.loading1 = true;
103
+    this.mainService
104
+      .getFetchDataList("data", "drugsInfo", data)
105
+      .subscribe((data) => {
106
+        this.loading1 = false;
107
+        this.listOfData = data.list;
108
+        this.listLength = data.totalNum;
109
+      });
110
+  }
111
+	
112
+	// 获取药品类型
113
+	getDrugType(){
114
+		this.mainService.getDictionary("list", "drug_type").subscribe((data) => {
115
+			this.drugTypeData = data.find(i=>i.value=='infusion_solutions')
116
+			this.getList();
117
+		});
118
+	}
119
+	
120
+	lowerChange(e){
121
+		this.validateForm.controls.upperRound.setValue(e+1);
122
+	}
123
+	
124
+	// 监听标识输入
125
+	handleInput(event: KeyboardEvent){
126
+		const input = event.target as HTMLInputElement;
127
+		// 如果输入的不是中文,则允许输入
128
+		if (!input.validity.patternMismatch) {
129
+			this.validateForm.value.drugCode = input.value;
130
+		} else {
131
+			// 重置输入值,不允许输入中文
132
+			input.value = this.validateForm.value.drugCode;
133
+		}
134
+	}
135
+	
136
+  // 新增弹框
137
+  showModal() {
138
+    this.add = true;
139
+		this.modal = true
140
+    this.initForm();
141
+  }
142
+  hideModal() {
143
+    this.modal = false;
144
+    this.initForm();
145
+  }
146
+	
147
+  // 初始化新增form表单
148
+  initForm() {
149
+    this.validateForm = this.fb.group({
150
+      drugName: [null, [Validators.required]],
151
+      drugCode: [null, [Validators.required]],
152
+      specs: [null, [Validators.required]],
153
+      unit: [null, [Validators.required]],
154
+			unitPrice:[null, [Validators.required]],
155
+			packingSpecs:[null, [Validators.required]],
156
+			lowerRound:[null, [Validators.required]],
157
+			upperRound:[null, [Validators.required]],
158
+    });
159
+  }
160
+  // 表单提交
161
+  submitForm(): void {
162
+    var that = this;
163
+		for (const i in that.validateForm.controls) {
164
+		  that.validateForm.controls[i].markAsDirty();
165
+		  that.validateForm.controls[i].updateValueAndValidity();
166
+		}
167
+		if (that.validateForm.invalid) return;
168
+		let form = this.validateForm.value
169
+		if(form.lowerRound >= form.upperRound){
170
+			this.message.error('低舍不能大于或者等于高入')
171
+			return 
172
+		}
173
+		if(form.upperRound >= form.packingSpecs){
174
+			this.message.error('高入不能大于或者等于包装规格')
175
+			return
176
+		}
177
+    let data = {
178
+			...this.validateForm.value,
179
+			id:0,
180
+			drugType:{
181
+				id:this.drugTypeData.id
182
+			},
183
+			hosId:that.hosId
184
+    };
185
+    if (!that.add) {
186
+      data.id = that.coopId;
187
+    }else{
188
+			delete data.id
189
+		}
190
+    that.mainService
191
+      .simplePost("addData", "drugsInfo", data)
192
+      .subscribe((data) => {
193
+        that.btnLoading = false;
194
+        that.hideModal();
195
+        that.initForm();
196
+        if (data.status == 200) {
197
+          that.showPromptModal(that.add ? "新增" : "编辑", true, "");
198
+        } else {
199
+          that.showPromptModal(that.add ? "新增" : "编辑", false, data.msg);
200
+        }
201
+      });
202
+  }
203
+
204
+  // 编辑
205
+  edit(data) {
206
+		this.add = false
207
+		this.coopId = data.id;
208
+    this.validateForm.controls.drugName.setValue(data.drugName);
209
+    this.validateForm.controls.drugCode.setValue(data.drugCode);
210
+    this.validateForm.controls.specs.setValue(data.specs);
211
+    this.validateForm.controls.unit.setValue(data.unit);
212
+    this.validateForm.controls.unitPrice.setValue(data.unitPrice);
213
+    this.validateForm.controls.packingSpecs.setValue(data.packingSpecs);
214
+    this.validateForm.controls.lowerRound.setValue(data.lowerRound);
215
+		this.validateForm.controls.upperRound.setValue(data.upperRound);
216
+		this.modal = true
217
+  }
218
+
219
+  // 删除
220
+  delModal: boolean = false; //删除模态框
221
+  del(data) {
222
+    let that = this;
223
+    that.coopId = data.id;
224
+    that.delModal = true;
225
+  }
226
+	
227
+	// 取消删除弹框
228
+	cancelDel(){
229
+		this.hideDelModal();
230
+	}
231
+	
232
+  // 确认删除
233
+  confirmDel() {
234
+    let that = this;
235
+    that.btnLoading = true;
236
+    that.mainService
237
+      .coopTypeConfig('rmvData', 'drugsInfo', [this.coopId])
238
+      .subscribe((data) => {
239
+        that.btnLoading = false;
240
+        that.hideDelModal();
241
+        if (data["status"] == 200) {
242
+          that.showPromptModal("删除", true, "");
243
+        } else {
244
+          that.showPromptModal("删除", false, data["msg"]);
245
+        }
246
+      });
247
+  }
248
+	
249
+	// 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
250
+	showPromptModal(con, success, promptInfo?) {
251
+	  this.promptModalShow = false;
252
+	  this.promptContent = con;
253
+	  this.ifSuccess = success;
254
+	  this.promptInfo = promptInfo;
255
+	  setTimeout(() => {
256
+	    this.promptModalShow = true;
257
+	  }, 100);
258
+	  this.getList();
259
+	}
260
+	
261
+  // 关闭删除模态框
262
+  hideDelModal() {
263
+    this.delModal = false;
264
+  }
265
+
266
+  // 查看
267
+  detail(id) {
268
+    this.router.navigateByUrl("/main/clinicalUsersManagement/userDetail/" + id);
269
+  }
270
+}
271
+

+ 19 - 0
src/app/views/drug-info/drug-info.module.ts

@@ -0,0 +1,19 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+
4
+import { DrugInfoRoutingModule } from './drug-info-routing.module';
5
+import { DrugInfoComponent } from './drug-info.component';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+
8
+
9
+@NgModule({
10
+  declarations: [
11
+    DrugInfoComponent
12
+  ],
13
+  imports: [
14
+    CommonModule,
15
+    DrugInfoRoutingModule,
16
+    ShareModule
17
+  ]
18
+})
19
+export class DrugInfoModule { }

+ 25 - 0
src/app/views/main/main-routing.module.ts

@@ -508,6 +508,31 @@ const routes: Routes = [
508 508
         path: "medicalWasteTrendAnalysis",
509 509
         loadChildren: () => import("../medical-waste-trend-analysis/medical-waste-trend-analysis.module").then((m) => m.MedicalWasteTrendAnalysisModule),
510 510
       },
511
+			// 大输液配置
512
+			{
513
+			  path: "bigTransfusionSet",
514
+			  loadChildren: () => import("../big-transfusion-set/big-transfusion-set.module").then((m) => m.BigTransfusionSetModule),
515
+			},
516
+			// 药品信息
517
+			{
518
+			  path: "drugInfo",
519
+			  loadChildren: () => import("../drug-info/drug-info.module").then((m) => m.DrugInfoModule),
520
+			},
521
+			// 科室发药单
522
+			{
523
+			  path: "adminOfficePrescription",
524
+			  loadChildren: () => import("../admin-office-prescription/admin-office-prescription.module").then((m) => m.AdminOfficePrescriptionModule),
525
+			},
526
+			// 药品云库存
527
+			{
528
+			  path: "drugCloud",
529
+			  loadChildren: () => import("../drug-cloud/drug-cloud.module").then((m) => m.DrugCloudModule),
530
+			},
531
+			// 发药批次
532
+			{
533
+			  path: "dispensingBatch",
534
+			  loadChildren: () => import("../dispensing-batch/dispensing-batch.module").then((m) => m.DispensingBatchModule),
535
+			}
511 536
       // 巡检单配置
512 537
       {
513 538
         path: "inspectionConfiguration",

File diff suppressed because it is too large
+ 5 - 0
src/app/views/main/main.component.html


+ 2 - 2
src/app/views/office-detail/office-detail.component.html

@@ -1,7 +1,7 @@
1 1
 <div class="detail" *ngIf="!maskFlag">
2 2
   <div class="modalBody">
3 3
     <div class="title">查看科室信息<i class="icon_transport transport-guanbi" (click)="hideModal()"></i></div>
4
-    <div class="content">
4
+		<div class="content">
5 5
       <div class="top display_flex justify-content_space-between align-items_center">
6 6
         <span>{{officeInfo['dept']?officeInfo['dept']:'无'}}<em style="font-style: normal;"
7 7
             *ngIf="officeInfo['deptalias']">(别名:{{officeInfo['deptalias']}})</em></span>
@@ -39,7 +39,7 @@
39 39
       </div>
40 40
     </div>
41 41
     <div class="display_flex justify-content_flex-center">
42
-      <button class="btn know" nz-button nzType="primary" nzGhost (click)="hideModal()">知道了</button>
42
+      <button class="btn know" nz-button nzType="primary" nzGhost (click)="hideModal()">取消</button>
43 43
     </div>
44 44
   </div>
45 45
 </div>

+ 1 - 1
src/app/views/office-detail/office-detail.component.ts

@@ -24,7 +24,7 @@ export class OfficeDetailComponent implements OnInit {
24 24
     this.getDetail();
25 25
   }
26 26
   hideModal() {
27
-    this.router.navigateByUrl("/main/officeManagement");
27
+    this.router.navigateByUrl("/main/dispensingBatch");
28 28
   }
29 29
 
30 30
   // 获取详情