| 
					
				 | 
			
			
				@@ -1,6 +1,5 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { Component, LOCALE_ID } from '@angular/core'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { IonCardHeader, IonHeader, IonToolbar, IonTitle, IonContent, IonTabButton, IonSearchbar, IonLabel, IonItem, IonList, NavController, IonCard, IonCardTitle, IonCardSubtitle, IonCardContent, IonThumbnail, IonRippleEffect, IonFab, IonFabList, IonFabButton, IonBadge } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { ExploreContainerComponent } from '../explore-container/explore-container.component'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { IonCardHeader, IonHeader, IonToolbar, IonTitle, IonContent, IonTabButton, IonSearchbar, IonLabel, IonItem, IonList, NavController, IonCard, IonCardTitle, IonCardSubtitle, IonCardContent, IonThumbnail, IonRippleEffect, IonFab, IonFabList, IonFabButton, IonBadge, IonAvatar } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { IonButton } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { IonIcon } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { Router } from '@angular/router'; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -44,9 +43,10 @@ interface ServiceItem { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   styleUrls: ['tab1.page.scss'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   standalone: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   imports: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent, IonTabButton, IonButton, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonHeader, IonToolbar, IonTitle, IonContent,IonTabButton, IonButton, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     IonIcon,IonSearchbar,IonLabel,IonItem,IonList,CommonModule,IonCard,IonCardHeader,IonCardTitle,IonCardSubtitle, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    IonCardContent, IonThumbnail, IonRippleEffect, IonFab, IonFabButton, IonFabList,IonBadge,  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonCardContent, IonThumbnail, IonRippleEffect, IonFab, IonFabButton, IonFabList,IonBadge, IonAvatar 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export class Tab1Page { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -162,19 +162,21 @@ export class Tab1Page { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private http: HttpClient // 注入 HttpClient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.loadRealDoctorList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.currentUser = new CloudUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    currentUser: CloudUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async loadRealDoctorList() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.currentUser = new CloudUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       let query = new CloudQuery('Doctor1'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       query.include('user') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       query.include('depart') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.realDoctorList =await query.find() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // console.log(this.realDoctorList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(this.realDoctorList[0].data["user"]?.objectId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(this.realDoctorList[1].data["user"]?.objectId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(this.realDoctorList[2].data["user"]?.objectId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(this.currentUser.id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      for(let i = 0; i < this.realDoctorList.length; i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(this.realDoctorList[i].data["user"]?.objectId == this.currentUser.id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          console.log("欢迎您,医生!") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log(this.currentUser) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   * 轮播图 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -213,53 +215,22 @@ export class Tab1Page { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * Go to the ai page 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   goToPage1(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log(['route']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let user = new CloudUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (!user.id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (!this.currentUser.id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.router.navigate(['/tabs/tab4']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.router.navigate(['/tabs/inquiry/ai']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * Go to the human page 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   goToPage2(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let user = new CloudUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (!user.id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (!this.currentUser.id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.router.navigate(['/tabs/tab4']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.router.navigate(['/tabs/inquiry/human']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  goToPicture(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log(['route']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.router.navigate(['/tabs/picture']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  searchContent:string = ''; //搜索内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  handleInput(ev:any) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log("ev.detail.value: ",ev.detail.value) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.searchContent = ev.detail.value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  search(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (this.searchContent == ''){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log("请输入搜索内容") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log("搜索内容: ",this.searchContent) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.searchContent = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // 功能按钮数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   functionItems1 = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { label: '专属医生', icon: 'document-text', route: '/tabs/create-agent' }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -293,27 +264,13 @@ export class Tab1Page { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for(let i = 0; i < 3; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.doctorList.push(List[i]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // let query1 = new CloudQuery('Consultation'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // let content = await query1.find() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // // 把content中的所有数据都打印出来 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // console.log("content: ",content) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // for (let i = 0; i < content.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   console.log("content: ",content[i].data["allContent"]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // // console.log("content: ",content[0]?.get("allContent")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  goToViewAll(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log(['route']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.router.navigate(['/tabs/inquiry/ai']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  currentUser:CloudUser|undefined 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 示例:问诊根据doctor拼接提示词 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    async openInquiry(doctor:any){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 验证用户登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let currentUser = new CloudUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let userPrompt = `` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if(!currentUser?.id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if(!this.currentUser?.id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       console.log("用户未登录,请登录后重试"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // let user = await openUserLoginModal(this.modalCtrl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // if(!user?.id){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -323,15 +280,15 @@ export class Tab1Page { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.router.navigate(['/tabs/tab4']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log("currentUser: ",currentUser) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if(currentUser?.get("realname")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      userPrompt += `当前来访的患者,姓名:${currentUser?.get("realname")}` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log("currentUser: ",this.currentUser) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if(this.currentUser?.get("realname")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      userPrompt += `当前来访的患者,姓名:${this.currentUser?.get("realname")}` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if(currentUser?.get("gender")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      userPrompt += `,性别:${currentUser?.get("gender")}` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if(this.currentUser?.get("gender")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      userPrompt += `,性别:${this.currentUser?.get("gender")}` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if(currentUser?.get("age")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      userPrompt += `,年龄:${currentUser?.get("age")}` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if(this.currentUser?.get("age")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      userPrompt += `,年龄:${this.currentUser?.get("age")}` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -344,9 +301,6 @@ export class Tab1Page { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let ACL:any = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       "*":{read:true,write:true} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // if(currentUser?.id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   ACL[currentUser?.id] = {read:true,write:true} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     consult.set({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       title:`${doctor.get('depart')?.name || ""}门诊记录${dateStr}-${doctor?.get("name")}`, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       doctor:doctor.toPointer(), 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -355,7 +309,7 @@ export class Tab1Page { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         className:"Department", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         objectId:doctor.get("depart")?.objectId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      user:currentUser.toPointer(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      user:this.currentUser.toPointer(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       ACL:ACL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -403,23 +357,18 @@ ${userPrompt} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             console.log("门诊已完成") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             consult.set({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               allContent:list, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              content:content // 处方内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              content:content, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             consult.save(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       onChatSaved:(chat:FmodeChat)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // chat?.chatSession?.id 本次会话的 chatId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         console.log("onChatSaved",chat,chat?.chatSession,chat?.chatSession?.id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // consult.set({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //   chatId:chat?.chatSession?.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // console.log("chat.MessageList", chat?.messageList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     openChatPanelModal(this.modalCtrl,options) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 |