患者回话列表筛选
This commit is contained in:
parent
b843007d7a
commit
63b13d7ccd
@ -300,6 +300,24 @@ export class PatientDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getPatientTypeByUuid(uuid: string): Promise<number | null> {
|
||||||
|
this.checkDatabaseState();
|
||||||
|
if (!this.rdbStore) {
|
||||||
|
throw new Error('数据库连接为空');
|
||||||
|
}
|
||||||
|
const sql = 'SELECT type FROM patients WHERE LOWER(uuid) = LOWER(?)';
|
||||||
|
const resultSet = await this.rdbStore.querySql(sql, [uuid]);
|
||||||
|
if (resultSet.rowCount > 0) {
|
||||||
|
resultSet.goToFirstRow();
|
||||||
|
const typeIndex = resultSet.getColumnIndex('type');
|
||||||
|
const type = typeIndex >= 0 ? resultSet.getDouble(typeIndex) : null;
|
||||||
|
resultSet.close();
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
resultSet.close();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// 删除指定专家的所有患者数据
|
// 删除指定专家的所有患者数据
|
||||||
async deletePatientsByExpertUuid(expertUuid: string): Promise<void> {
|
async deletePatientsByExpertUuid(expertUuid: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
@ -855,6 +873,16 @@ export class PatientDatabaseManager {
|
|||||||
async addPatient(patient: PatientData): Promise<boolean> {
|
async addPatient(patient: PatientData): Promise<boolean> {
|
||||||
return await this.addPatients(patient);
|
return await this.addPatients(patient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 在 PatientDatabaseManager 类内添加
|
||||||
|
async getPatientTypeByUuid(uuid: string): Promise<number | null> {
|
||||||
|
if (!this.isDatabaseReady()) {
|
||||||
|
console.error('数据库未准备好,无法获取患者type');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return await this.getPatientDao().getPatientTypeByUuid(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出单例实例
|
// 导出单例实例
|
||||||
|
|||||||
@ -236,21 +236,31 @@ export class LocalConversationViewModel {
|
|||||||
}
|
}
|
||||||
this.offset = result.offset
|
this.offset = result.offset
|
||||||
this.isFinished = result.finished
|
this.isFinished = result.finished
|
||||||
let newConversation = result.conversationList
|
// let newConversation = result.conversationList
|
||||||
if (this.conversationList.length > 0 && newConversation.length > 0) {
|
// if (this.conversationList.length > 0 && newConversation.length > 0) {
|
||||||
this.conversationList =
|
// this.conversationList =
|
||||||
this.conversationList.filter(conversation => !newConversation.find((m) => m.conversationId ===
|
// this.conversationList.filter(conversation => !newConversation.find((m) => m.conversationId ===
|
||||||
conversation.conversationId))
|
// conversation.conversationId))
|
||||||
}
|
// }
|
||||||
this.conversationList?.push(...newConversation)
|
// this.conversationList?.push(...newConversation)
|
||||||
//异步有问题
|
//异步有问题
|
||||||
if (this.conversationList.length > 0 ) {
|
// if (this.conversationList.length > 0 ) {
|
||||||
const resultconversationList =await this.conversationList.filter(async conversation =>
|
// const resultconversationList =await this.conversationList.filter(async conversation =>
|
||||||
await patientDbManager.getPatientByUuid(ChatKitClient.nim.conversationIdUtil.parseConversationTargetId(conversation.conversationId))!=null
|
// await patientDbManager.getPatientByUuid(ChatKitClient.nim.conversationIdUtil.parseConversationTargetId(conversation.conversationId))!=null
|
||||||
)
|
// )
|
||||||
this.conversationList =resultconversationList;
|
// this.conversationList =resultconversationList;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
const filteredConversations: V2NIMLocalConversation[] = [];
|
||||||
|
for (const conversation of result.conversationList) {
|
||||||
|
const uuid = ChatKitClient.nim.conversationIdUtil.parseConversationTargetId(conversation.conversationId);
|
||||||
|
// 假设 selectUserStyleWithModel 返回 "1" 表示 type=1
|
||||||
|
const style = await patientDbManager.getPatientTypeByUuid(uuid);
|
||||||
|
if (style == 1) {
|
||||||
|
filteredConversations.push(conversation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.conversationList = filteredConversations;
|
||||||
|
|
||||||
this.conversationList?.sort((a, b) => this.sortConversation(a, b))
|
this.conversationList?.sort((a, b) => this.sortConversation(a, b))
|
||||||
this.isFinishedSyncLoad = true
|
this.isFinishedSyncLoad = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user