浏览代码

Merge branch 'develop' of http://git.dashitech.com/seimin/zy-pc into develop

seimin 1 月之前
父节点
当前提交
547964e2a6

+ 16 - 16
angular.json

@@ -35,20 +35,20 @@
35
             "styles": [
35
             "styles": [
36
               "src/styles.less",
36
               "src/styles.less",
37
               "src/assets/iconfont/iconfont.css",
37
               "src/assets/iconfont/iconfont.css",
38
-              "./node_modules/swiper/swiper-bundle.min.css"
39
-							// "node_modules/prismjs/themes/prism-okaidia.css",
40
-							// "node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css"
38
+              "./node_modules/swiper/swiper-bundle.min.css",
39
+							"node_modules/prismjs/themes/prism-okaidia.css",
40
+							"node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css"
41
             ],
41
             ],
42
             "scripts": [
42
             "scripts": [
43
               "node_modules/echarts/dist/echarts.min.js",
43
               "node_modules/echarts/dist/echarts.min.js",
44
               "./node_modules/swiper/swiper-bundle.min.js",
44
               "./node_modules/swiper/swiper-bundle.min.js",
45
               "src/assets/libs/TLWebSocketAgent.js",
45
               "src/assets/libs/TLWebSocketAgent.js",
46
               "src/assets/libs/ola_api.js",
46
               "src/assets/libs/ola_api.js",
47
-							"node_modules/marked/marked.min.js"
48
-							// "node_modules/prismjs/prism.js",
49
-							// "node_modules/prismjs/components/prism-csharp.min.js",
50
-							// "node_modules/prismjs/components/prism-css.min.js",
51
-							// "node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js"
47
+							"node_modules/marked/marked.min.js",
48
+							"node_modules/prismjs/prism.js",
49
+							"node_modules/prismjs/components/prism-csharp.min.js",
50
+							"node_modules/prismjs/components/prism-css.min.js",
51
+							"node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js"
52
             ]
52
             ]
53
           },
53
           },
54
           "configurations": {
54
           "configurations": {
@@ -115,20 +115,20 @@
115
             "styles": [
115
             "styles": [
116
               "src/styles.less",
116
               "src/styles.less",
117
               "src/assets/iconfont/iconfont.css",
117
               "src/assets/iconfont/iconfont.css",
118
-              "./node_modules/swiper/swiper-bundle.min.css"
119
-							// "node_modules/prismjs/themes/prism-okaidia.css",
120
-							// "node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css"
118
+              "./node_modules/swiper/swiper-bundle.min.css",
119
+							"node_modules/prismjs/themes/prism-okaidia.css",
120
+							"node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css"
121
             ],
121
             ],
122
             "scripts": [
122
             "scripts": [
123
               "node_modules/echarts/dist/echarts.min.js",
123
               "node_modules/echarts/dist/echarts.min.js",
124
               "./node_modules/swiper/swiper-bundle.min.js",
124
               "./node_modules/swiper/swiper-bundle.min.js",
125
               "src/assets/libs/TLWebSocketAgent.js",
125
               "src/assets/libs/TLWebSocketAgent.js",
126
               "src/assets/libs/ola_api.js",
126
               "src/assets/libs/ola_api.js",
127
-							"node_modules/marked/marked.min.js"
128
-							// "node_modules/prismjs/prism.js",
129
-							// "node_modules/prismjs/components/prism-csharp.min.js",
130
-							// "node_modules/prismjs/components/prism-css.min.js",
131
-							// "node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js"
127
+							"node_modules/marked/marked.min.js",
128
+							"node_modules/prismjs/prism.js",
129
+							"node_modules/prismjs/components/prism-csharp.min.js",
130
+							"node_modules/prismjs/components/prism-css.min.js",
131
+							"node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js"
132
             ]
132
             ]
133
           }
133
           }
134
         },
134
         },

+ 3 - 1
src/app/app.module.ts

@@ -12,6 +12,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
12
 import { NZ_I18N, zh_CN, NzConfig, NZ_CONFIG } from 'ng-zorro-antd';
12
 import { NZ_I18N, zh_CN, NzConfig, NZ_CONFIG } from 'ng-zorro-antd';
13
 import { RouteReuseStrategy } from '@angular/router';
13
 import { RouteReuseStrategy } from '@angular/router';
14
 import { SimpleReuseStrategy } from './SimpleReuseStrategy';
14
 import { SimpleReuseStrategy } from './SimpleReuseStrategy';
15
+import { MarkdownModule } from 'ngx-markdown';
15
 const ngZorroConfig: NzConfig = {
16
 const ngZorroConfig: NzConfig = {
16
   // 注意组件名称没有 nz 前缀
17
   // 注意组件名称没有 nz 前缀
17
   notification: { nzTop: 100 }
18
   notification: { nzTop: 100 }
@@ -27,7 +28,8 @@ registerLocaleData(zh);
27
     BrowserAnimationsModule,
28
     BrowserAnimationsModule,
28
     AppRoutingModule,
29
     AppRoutingModule,
29
     HttpClientModule,
30
     HttpClientModule,
30
-    ShareModule
31
+    ShareModule,
32
+		MarkdownModule.forRoot()
31
   ],
33
   ],
32
   providers: [
34
   providers: [
33
     { provide: NZ_I18N, useValue: zh_CN },
35
     { provide: NZ_I18N, useValue: zh_CN },

+ 20 - 7
src/app/components/smart-dialogue/smart-dialogue.component.html

@@ -9,20 +9,33 @@
9
 				<div class="timestamp" *ngIf="message.showTime">
9
 				<div class="timestamp" *ngIf="message.showTime">
10
 					<!-- {{ formatSendTime(message.timestamp) }} -->
10
 					<!-- {{ formatSendTime(message.timestamp) }} -->
11
 				</div>
11
 				</div>
12
-				<div class="content-message" [ngClass]="{'user-message' : message.role === 'user','bot-message': message.role === 'assistant'}">
13
-					<!-- <div markdown [data]="message.content" *ngIf="message.role=='assistant'"></div> -->
14
-					<markdown data="123456"></markdown>
15
-					<!-- <div *ngIf="message.role=='user'">{{message.content}}</div> -->
16
-					<!-- {{message.content}} -->
12
+				<div class="content-message"
13
+					[ngClass]="{'user-message' : message.role === 'user','bot-message': message.role === 'assistant'}">
14
+					<!-- <markdown [data]="message.content" *ngIf="message.role=='assistant'"></markdown> -->
15
+					<div class="content-left">
16
+						<div markdown [data]="message.content" *ngIf="message.role=='assistant'"
17
+							[ngClass]="{'mark-class' : isLoad}">
18
+						</div>
19
+						<i class="icon_transport transport-xiazai"
20
+							*ngIf="message.role=='assistant' && message.content != '正在思考中...' && message.content != '抱歉,我现在无法回答您的问题,请稍后再试。'"
21
+							(click)="exportWord(message)"></i>
22
+					</div>
23
+					<div *ngIf="message.role=='user'">{{message.content}}</div>
17
 				</div>
24
 				</div>
18
 			</div>
25
 			</div>
19
 		</div>
26
 		</div>
20
 		<div class="display_flex justify-content_flex-center">
27
 		<div class="display_flex justify-content_flex-center">
21
 			<nz-input-group nzSearch [nzAddOnAfter]="suffixIconButton">
28
 			<nz-input-group nzSearch [nzAddOnAfter]="suffixIconButton">
22
-			  <input type="text" (keydown.enter)="handleEnter()" nz-input [(ngModel)]="userContent" placeholder="请输入您想咨询的问题" />
29
+				<input type="text" [disabled]="isDisabled" (keydown.enter)="handleEnter()" nz-input [(ngModel)]="userContent"
30
+					placeholder="请输入您想咨询的问题" />
23
 			</nz-input-group>
31
 			</nz-input-group>
24
 			<ng-template #suffixIconButton>
32
 			<ng-template #suffixIconButton>
25
-			  <button nz-button nzType="primary" nzSearch (click)="searchDeepSeek()"><i nz-icon nzType="search"></i></button>
33
+				<button nz-button nzType="primary" [disabled]="isDisabled" nzSearch (click)="searchDeepSeek()"><i nz-icon
34
+						nzType="search"></i></button>
26
 			</ng-template>
35
 			</ng-template>
27
 		</div>
36
 		</div>
37
+	</div>
38
+</div>
39
+	<div class="mask-style" *ngIf="exportLoading">
40
+		<nz-spin nzSimple class="spin-style"></nz-spin>
28
 	</div>
41
 	</div>

+ 92 - 16
src/app/components/smart-dialogue/smart-dialogue.component.less

@@ -1,5 +1,38 @@
1
 @import "../../../../src/theme.less";
1
 @import "../../../../src/theme.less";
2
+
2
 :host {
3
 :host {
4
+	
5
+  h1,
6
+  h2,
7
+  h3,
8
+  p {
9
+    margin: 0;
10
+  }
11
+  em {
12
+    font-style: normal;
13
+  }
14
+	
15
+	/* 修改垂直滚动条 */
16
+	::-webkit-scrollbar {
17
+		width: 4px; /* 修改宽度 */
18
+		border-radius: 2px;
19
+	}
20
+	 
21
+	/* 修改滚动条轨道背景色 */
22
+	::-webkit-scrollbar-track {
23
+		background-color: #f1f1f1;
24
+	}
25
+	 
26
+	/* 修改滚动条滑块颜色 */
27
+	::-webkit-scrollbar-thumb {
28
+		background-color: #888;
29
+	}
30
+	 
31
+	/* 修改滚动条滑块悬停时的颜色 */
32
+	::-webkit-scrollbar-thumb:hover {
33
+		background-color: #555;
34
+	}
35
+	
3
   .add-button {
36
   .add-button {
4
     margin: 0 auto 16px !important;
37
     margin: 0 auto 16px !important;
5
   }
38
   }
@@ -110,21 +143,6 @@
110
     .modalBody {
143
     .modalBody {
111
       width: 70%;
144
       width: 70%;
112
       height: auto;
145
       height: auto;
113
-				.mask-style{
114
-					width: 100%;
115
-					height: 100%;
116
-					position: fixed;
117
-					top: 0;
118
-					left: 0;
119
-					z-index: 999;
120
-					display: flex;
121
-					background: rgba(0,0,0,0.2);
122
-					align-items: center;
123
-					justify-content: center;
124
-				}
125
-				.spin-style{
126
-					z-index:9999;
127
-				}
128
 			.view-box{
146
 			.view-box{
129
 				height: 400px;
147
 				height: 400px;
130
 				padding: 20px;
148
 				padding: 20px;
@@ -134,13 +152,22 @@
134
 				border-radius: 5px;
152
 				border-radius: 5px;
135
 				.content-message{
153
 				.content-message{
136
 					position: relative;
154
 					position: relative;
137
-					padding: 10px 15px;
155
+					padding: 10px 20px;
138
 					border-radius: 10px;
156
 					border-radius: 10px;
139
 					font-size: 14px;
157
 					font-size: 14px;
140
 					color: #333;
158
 					color: #333;
141
 					line-height: 25px;
159
 					line-height: 25px;
142
 					width: fit-content;
160
 					width: fit-content;
143
 					max-width: 70%;
161
 					max-width: 70%;
162
+					.content-left{
163
+						i{
164
+							cursor: pointer;
165
+							position: absolute;
166
+							top: 10px;
167
+							right: 4px;
168
+							color: #34b349;
169
+						}
170
+					}
144
 				}
171
 				}
145
 				
172
 				
146
 				.user-message {
173
 				.user-message {
@@ -152,6 +179,39 @@
152
 				.bot-message {
179
 				.bot-message {
153
 				  background: #f2f2f2;
180
 				  background: #f2f2f2;
154
 				  color: #000;
181
 				  color: #000;
182
+					.mark-class{
183
+						white-space: nowrap;
184
+						overflow: hidden;
185
+						animation: typing 2s steps(15, end) infinite;
186
+						position: relative;
187
+					}
188
+					
189
+			// 		.mark-class::before{
190
+			// 			position: absolute;
191
+			// 			width: 0;
192
+			// 			height: 100%;
193
+			// 			text-wrap: nowrap;
194
+			// 			overflow: hidden;
195
+			// 			animation: moving 3s calc(var(--delay) * 3s) linear forwards, flashing 0.5s infinite alternate;
196
+			// 			text-shadow: 0.05em 0.05em 0.05em hsla(0, 0%, 0%, .5);
197
+			// 		}
198
+					
199
+			// 		@keyframes moving {
200
+			// 			to {
201
+			// 				width: 100%;
202
+			// 			}
203
+			// 		}
204
+			
205
+			// 		@keyframes flashing {
206
+			// 			to {
207
+			// 				border-color: transparent;
208
+			// 			}
209
+			// 		}
210
+					
211
+					@keyframes typing {
212
+						from { width: 0; }
213
+						to { width: 100%; }
214
+					}
155
 				}
215
 				}
156
 				
216
 				
157
 				.left-box{
217
 				.left-box{
@@ -364,3 +424,19 @@
364
 		}
424
 		}
365
 	}
425
 	}
366
 }
426
 }
427
+
428
+.mask-style{
429
+	width: 100%;
430
+	height: 100%;
431
+	position: fixed;
432
+	top: 0;
433
+	left: 0;
434
+	z-index: 999;
435
+	display: flex;
436
+	background: rgba(0,0,0,0.2);
437
+	align-items: center;
438
+	justify-content: center;
439
+}
440
+.spin-style{
441
+	z-index:9999;
442
+}

+ 42 - 3
src/app/components/smart-dialogue/smart-dialogue.component.ts

@@ -28,6 +28,34 @@ export class SmartDialogueComponent implements OnInit  {
28
 	userContent:any;
28
 	userContent:any;
29
   hosId: number;
29
   hosId: number;
30
   messagesData:any = [];
30
   messagesData:any = [];
31
+	isDisabled:boolean = false;
32
+	isLoad:boolean = false;
33
+	
34
+	// 导出
35
+	exportLoading:boolean = false;
36
+	exportWord(item){
37
+		this.exportLoading = true;
38
+		this.mainService.exportDeepSeek({
39
+			chatList:[item]
40
+		}).subscribe(
41
+		  (data:any) => {
42
+				this.exportLoading = false;
43
+		    var file = new Blob([data], {
44
+		      type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
45
+		    });
46
+		    var fileURL = URL.createObjectURL(file);
47
+		    var a = document.createElement("a");
48
+		    a.href = fileURL;
49
+		    a.target = "_blank";
50
+		    a.download = new Date().getTime() + ".docx";
51
+		    document.body.appendChild(a);
52
+		    a.click();
53
+		  },
54
+		  (err) => {
55
+		    this.exportLoading = false;
56
+		  }
57
+		);
58
+	}
31
 	
59
 	
32
 	// 回车
60
 	// 回车
33
 	handleEnter(){
61
 	handleEnter(){
@@ -35,10 +63,11 @@ export class SmartDialogueComponent implements OnInit  {
35
 	}
63
 	}
36
 	
64
 	
37
   searchDeepSeek(){
65
   searchDeepSeek(){
38
-		this.scrollContainer.nativeElement.scrollTop = this.scrollContainer.nativeElement.scrollHeight;
39
-		if(this.userContent==''){
66
+		if(this.userContent=='' || this.userContent == undefined){
40
 			return
67
 			return
41
 		}
68
 		}
69
+		this.isDisabled = true
70
+		this.isLoad = false
42
 		let messagesStr = JSON.parse(JSON.stringify(this.userContent))
71
 		let messagesStr = JSON.parse(JSON.stringify(this.userContent))
43
 		this.messagesData.push({
72
 		this.messagesData.push({
44
 			role: "user",
73
 			role: "user",
@@ -54,6 +83,9 @@ export class SmartDialogueComponent implements OnInit  {
54
 		let arr = this.messagesData.filter((item) => {
83
 		let arr = this.messagesData.filter((item) => {
55
 			return item.content.indexOf("正在思考中") === -1;
84
 			return item.content.indexOf("正在思考中") === -1;
56
 		});
85
 		});
86
+		setTimeout(_=>{
87
+			this.scrollContainer.nativeElement.scrollTop = this.scrollContainer.nativeElement.scrollHeight;
88
+		},100)
57
 		this.mainService.getDeepSeekData({
89
 		this.mainService.getDeepSeekData({
58
 			chatList:arr
90
 			chatList:arr
59
 		})
91
 		})
@@ -78,7 +110,14 @@ export class SmartDialogueComponent implements OnInit  {
78
 						// timestamp: new Date(), //时间戳
110
 						// timestamp: new Date(), //时间戳
79
 					});
111
 					});
80
 				}
112
 				}
81
-				this.scrollContainer.nativeElement.scrollTop = this.scrollContainer.nativeElement.scrollHeight;
113
+				this.isLoad = true;
114
+				setTimeout(_=>{
115
+					this.isLoad = false;
116
+				},2000)
117
+				setTimeout(_=>{
118
+					this.scrollContainer.nativeElement.scrollTop = this.scrollContainer.nativeElement.scrollHeight;
119
+					this.isDisabled = false
120
+				},100)
82
 			});
121
 			});
83
   }
122
   }
84
 
123
 

+ 1 - 1
src/app/components/smart-dialogue/smart-dialogue.module.ts

@@ -12,7 +12,7 @@ import { MarkdownModule } from 'ngx-markdown';
12
   imports: [
12
   imports: [
13
     CommonModule,
13
     CommonModule,
14
     ShareModule,
14
     ShareModule,
15
-		MarkdownModule.forRoot()
15
+		MarkdownModule.forChild()
16
   ],
16
   ],
17
   exports: [
17
   exports: [
18
     SmartDialogueComponent
18
     SmartDialogueComponent

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

@@ -1100,4 +1100,12 @@ export class MainService {
1100
 		  headers: this.headers,
1100
 		  headers: this.headers,
1101
 		});
1101
 		});
1102
 	}
1102
 	}
1103
+	// 导出deepSeek数据
1104
+	exportDeepSeek(data){
1105
+		return this.http.post(host.host + `/user/data/ds/exportChat`, data, {
1106
+		  headers: this.headers,
1107
+			responseType: "arraybuffer",
1108
+		});
1109
+	}
1110
+	
1103
 }
1111
 }

+ 4 - 4
src/app/views/hushijiandan/hushijiandan.component.html

@@ -1435,8 +1435,8 @@
1435
       <div class="patientMsg">
1435
       <div class="patientMsg">
1436
         <div class="patientMsgTips">患者姓名:{{patientMsg.patientName}}</div>
1436
         <div class="patientMsgTips">患者姓名:{{patientMsg.patientName}}</div>
1437
         <div class="patientMsgTips">住院号:{{patientMsg.residenceNo}}</div>
1437
         <div class="patientMsgTips">住院号:{{patientMsg.residenceNo}}</div>
1438
-        <div class="patientMsgTips">护理级别:{{patientMsg.illnessState?.name}}</div>
1439
-        <div class="patientMsgTips">危重等级:{{patientMsg.careLevel?.name}}</div>
1438
+        <div class="patientMsgTips">护理级别:{{patientMsg.careLevel?.name}}</div>
1439
+        <div class="patientMsgTips">危重等级:{{patientMsg.illnessState?.name}}</div>
1440
       </div>
1440
       </div>
1441
       <div>
1441
       <div>
1442
         <form nz-form [formGroup]="patientForm" class="patientForm">
1442
         <form nz-form [formGroup]="patientForm" class="patientForm">
@@ -2730,9 +2730,9 @@
2730
   </div>
2730
   </div>
2731
 </nz-modal>
2731
 </nz-modal>
2732
 
2732
 
2733
-<div class="kefu" (click)="smartOpen()">
2733
+<!-- <div class="kefu" (click)="smartOpen()">
2734
 	<img src="../../assets/images/kefu.png" alt="">
2734
 	<img src="../../assets/images/kefu.png" alt="">
2735
-</div>
2735
+</div> -->
2736
 
2736
 
2737
 <!-- 快捷方式建单弹窗 -->
2737
 <!-- 快捷方式建单弹窗 -->
2738
 <app-build-quick-confirm *ngIf="isShowBuildQuickConfirm" [buildQuickConfirmData]="buildQuickConfirmData" (cancelModal)="cancelBuildQuickConfirm($event)" (confirmModal)="confirmBuildQuickConfirm($event)" [loading5]="loadingQuick"></app-build-quick-confirm>
2738
 <app-build-quick-confirm *ngIf="isShowBuildQuickConfirm" [buildQuickConfirmData]="buildQuickConfirmData" (cancelModal)="cancelBuildQuickConfirm($event)" (confirmModal)="confirmBuildQuickConfirm($event)" [loading5]="loadingQuick"></app-build-quick-confirm>