yuebuzu-creater преди 4 месеца
родител
ревизия
783338c16c

+ 142 - 0
wisdom-app/src/app/tab1/schema.md

@@ -0,0 +1,142 @@
+## 时序图
+```plantuml
+@startuml
+title AI问诊服务时序图
+
+actor User as U
+participant AIDoctor as AD
+participant Department as D
+participant Consultation as C
+participant Prescription as P
+
+U -> U: 决定选择或创建AI医生
+alt 选择已有医生
+    U -> AD: 选择现有AI医生
+else 创建新医生
+    U -> AD: 输入医生属性信息创建新AI医生
+end
+U -> AD: 发起问诊,提供信息
+AD -> AD: 接收用户信息
+AD -> AD: 与用户对话
+AD -> P: 生成处方
+AD -> U: 返回对话结果及处方
+U -> C: 创建问诊记录实例,关联相关对象(自身、医生、科室等)
+C -> D: 获取科室信息(若需要完整记录科室情况)
+D -> C: 返回科室信息
+C -> C: 整合问诊信息(包含处方等)
+C -> C: 保存到数据库
+U -> C: 查询问诊记录(可按需指定查询条件)
+C -> U: 返回相应问诊记录
+@enduml
+```
+
+## 类图
+```plantuml
+@startuml
+class User {
+    - userId : int
+    + selectExistingDoctor() : AIDoctor
+    + createCustomDoctor(doctorInfo : Map<String, String>) : AIDoctor
+    + startConsultation(doctor : AIDoctor) : void
+    + viewConsultationRecords() : List<Consultation>
+}
+
+class AIDoctor {
+    - objectid : int
+    - avator : String
+    - name : String
+    - gender : String
+    - age : int
+    - title : String
+    - qualications : String
+    - desc : String
+    - depart : String
+    - specialty : String
+    - scrid : int
+    + haveConversation(userInfo : String) : String
+    + generatePrescription() : Prescription
+}
+
+class Department {
+    - objectid : int
+    - desc : String
+    - name : String
+    - srcid : int
+}
+
+class Consultation {
+    - objectid : int
+    - user : User
+    - content : String
+    - doctor : AIDoctor
+    - department : Department
+    - title : String
+    + saveToDatabase() : void
+    + queryFromDatabase(queryParams : Map<String, String>) : Consultation
+}
+
+class Prescription {
+    - prescriptionId : int
+    - medicineList : List<String>
+    - usageInstructions : String
+}
+
+User "1" --> "0..*" AIDoctor : selects/ creates
+User "1" --> "0..*" Consultation : initiates/ views
+AIDoctor "1" --> "1" Prescription : generates
+Consultation "1" --> "1" Prescription : contains
+Consultation "1" --> "1" Department : belongs to
+@enduml
+```
+
+# 状态图
+```plantuml
+@startuml
+[*] --> Initiated
+state Initiated {
+    [*] --> SelectingDoctor
+    SelectingDoctor : 用户决定选择已有或创建新AI医生
+    SelectingDoctor --> DoctorSelected : 完成医生选择
+}
+state DoctorSelected {
+    [*] --> ProvidingInfo
+    ProvidingInfo : 用户向选定医生提供问诊信息
+    ProvidingInfo --> ConversationInProgress : 医生开始对话交流
+}
+state ConversationInProgress {
+    [*] --> PrescriptionGenerated
+    PrescriptionGenerated : AI医生生成处方
+    PrescriptionGenerated --> ConversationFinished : 对话结束
+}
+state ConversationFinished {
+    [*] --> CreatingRecord
+    CreatingRecord : 创建问诊记录实例
+    CreatingRecord --> SavingRecord : 整合记录信息
+    SavingRecord --> RecordSaved : 保存到数据库
+    RecordSaved --> [*]
+}
+@enduml
+```
+
+## 活动图
+```plantuml
+@startuml
+start
+:用户发起问诊;
+if (选择已有AI医生?) then (是)
+    :选择已有的AI医生;
+else (否)
+    :输入信息创建新的AI医生;
+endif
+:用户提供问诊信息;
+:AI医生接收信息并对话;
+:AI医生生成处方;
+:结束对话;
+:创建问诊记录实例;
+:关联用户、医生、科室等信息;
+:整合问诊记录内容(包含处方);
+:保存问诊记录到数据库;
+:用户查询问诊记录;
+stop
+@enduml
+```

+ 2 - 2
wisdom-app/src/app/tab1/tab1.page.html

@@ -15,8 +15,8 @@
   </ion-toolbar>
 </ion-header>
 <!-- 内存不足 使用以下代码 -->
-<!-- set NODE_OPTIONS=--max_old_space_size=8192 -->
-<!-- node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng serve -->
+set NODE_OPTIONS=--max_old_space_size=8192
+node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng serve
 
 <ion-content [fullscreen]="true">
 

+ 1 - 1
wisdom-app/src/app/tab1/tab1.page.ts

@@ -252,7 +252,7 @@ export class Tab1Page {
 - 完成处方时,请在消息结尾附带: [处方完成]
 
 # 开始话语
-当您准备好了,可以以一个医生的身份,向来访的用户打招呼。
+当您准备好了,可以以一个医生的身份,向来访的用户亲切地打招呼。
 ${userPrompt}
 `);
       },

+ 34 - 38
wisdom-app/src/app/tab2/tab2.page.html

@@ -1,43 +1,43 @@
 <ion-header [translucent]="true">
   <ion-toolbar>
-    <ion-title>
-      健康科普
-    </ion-title>
+    <div class="search-bar">
+      <input type="text" placeholder="输入关键词搜索科普文章">
+    </div>
+    <div class="header">
+      <ion-card>
+        <ion-card-header>
+          <ion-card-title>
+            <ion-segment [scrollable]="true" value="hotdot" [value]="type" (ionChange)="typeChange($event)">
+              <ion-segment-button value="hotdot" content-id="hotdot">
+                <ion-label>热点</ion-label>
+              </ion-segment-button>
+              <ion-segment-button value="export" content-id="export">
+                <ion-label>专家科普</ion-label>
+              </ion-segment-button>
+              <ion-segment-button value="sleep" content-id="sleep">
+                <ion-label>睡眠</ion-label>
+              </ion-segment-button>
+              <ion-segment-button value="life" content-id="life">
+                <ion-label>生活</ion-label>
+              </ion-segment-button>
+              <ion-segment-button value="male" content-id="male">
+                <ion-label>男性</ion-label>
+              </ion-segment-button>
+              <ion-segment-button value="female" content-id="female">
+                <ion-label>女性</ion-label>
+              </ion-segment-button>
+            </ion-segment>
+          </ion-card-title>
+        </ion-card-header>
+      </ion-card>
+    </div>
   </ion-toolbar>
 </ion-header>
 
 <ion-content class="knowledge" [fullscreen]="true">
-  <div class="search-bar">
-    <input type="text" placeholder="输入关键词搜索科普文章">
-  </div>
+  
   <div class="content">
     <ion-card>
-      <ion-card-header>
-        <ion-card-title>
-          <ion-segment [scrollable]="true" value="hotdot" [value]="type" (ionChange)="typeChange($event)">
-            <ion-segment-button value="hotdot" content-id="hotdot">
-              <ion-label>热点</ion-label>
-            </ion-segment-button>
-            <ion-segment-button value="export" content-id="export">
-              <ion-label>专家科普</ion-label>
-            </ion-segment-button>
-            <ion-segment-button value="sleep" content-id="sleep">
-              <ion-label>睡眠</ion-label>
-            </ion-segment-button>
-            <ion-segment-button value="life" content-id="life">
-              <ion-label>生活</ion-label>
-            </ion-segment-button>
-            <ion-segment-button value="male" content-id="male">
-              <ion-label>男性</ion-label>
-            </ion-segment-button>
-            <ion-segment-button value="female" content-id="female">
-              <ion-label>女性</ion-label>
-            </ion-segment-button>
-          </ion-segment>
-        </ion-card-title>
-        <!-- <ion-card-subtitle>请输入账号密码</ion-card-subtitle> -->
-      </ion-card-header>
-    
       <ion-card-content>
         <ion-segment-view>
           <ion-segment-content id="hotdot">
@@ -51,7 +51,7 @@
           <ion-segment-content id="sleep">
             <app-article-card *ngFor="let card of cards" [card]="card"></app-article-card>
           </ion-segment-content>
-          
+
           <ion-segment-content id="life">
             <app-article-card *ngFor="let card of cards" [card]="card"></app-article-card>
           </ion-segment-content>
@@ -65,9 +65,5 @@
       </ion-card-content>
     </ion-card>
   </div>
-
-  <div class="knowledge-cards">
-      
-  </div>
-
+  
 </ion-content>

+ 16 - 6
wisdom-app/src/app/tab2/tab2.page.scss

@@ -9,12 +9,25 @@
   border: 1px solid #ccc;
   border-radius: 4px;
 }
-.content {
-  margin-top: -10px;
+.header {
+  height: 80px;
+  margin-top:-10px
+}
+ion-content {
   height: 100%;
   width: 100%;
 }
 
+.content {
+  margin-top: -5px;
+  -height: 100%;
+  width: 100%;
+}
+ion-card-header {
+  font-size: 1.5em;
+  height: auto;
+}
+
 ion-card {
   width: 100%;
   height: 100%;
@@ -23,10 +36,7 @@ ion-card {
   border-radius: 0;
   box-shadow: none;
 }
-ion-card-header {
-  font-size: 1.5em;
-  height: auto;
-}
+
 
 ion-card-content {
   font-size: 1.2em;