feat: initialize ERP base platform (extracted from HMS)
- Stripped 11 business crates (health, ai, dialysis, plugins) - Cleaned AppState, AppConfig, main.rs from business coupling - Reduced migrations from 169 to 53 (base-only) - Removed health_provider trait from erp-core - Removed business integration tests - Removed gateway rate limiting middleware - Base capabilities: auth, RBAC, JWT, config, workflow, message, plugin, audit, crypto, RLS, multi-tenant Cargo check: OK Cargo test: OK
This commit is contained in:
56
apps/web/e2e/pages/appointment.page.ts
Normal file
56
apps/web/e2e/pages/appointment.page.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
// apps/web/e2e/pages/appointment.page.ts
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
export class AppointmentPage {
|
||||
readonly page: Page;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
async gotoSchedule() {
|
||||
await this.page.goto('/#/health/schedules');
|
||||
await this.page.waitForSelector('.ant-table, .ant-fullcalendar, [class*="calendar"]', { timeout: 10000 });
|
||||
}
|
||||
|
||||
async gotoAppointments() {
|
||||
await this.page.goto('/#/health/appointments');
|
||||
await this.page.waitForSelector('.ant-table', { timeout: 10000 });
|
||||
}
|
||||
|
||||
async clickCreateSchedule() {
|
||||
await this.page.click('button:has-text("新增排班"), button:has-text("创建")');
|
||||
await this.page.waitForSelector('.ant-modal, .ant-drawer', { timeout: 5000 });
|
||||
}
|
||||
|
||||
async fillScheduleForm(data: { doctor_id?: string; date: string; start_time: string; end_time: string }) {
|
||||
if (data.doctor_id) {
|
||||
await this.page.click('.ant-select');
|
||||
await this.page.click('.ant-select-item-option');
|
||||
}
|
||||
await this.page.fill('input[placeholder*="日期"]', data.date);
|
||||
await this.page.fill('input[placeholder*="开始"]', data.start_time);
|
||||
await this.page.fill('input[placeholder*="结束"]', data.end_time);
|
||||
}
|
||||
|
||||
async submitScheduleForm() {
|
||||
await this.page.click('.ant-modal button[type="submit"], .ant-btn-primary');
|
||||
await this.page.waitForSelector('.ant-message-success', { timeout: 10000 });
|
||||
}
|
||||
|
||||
async clickCreateAppointment() {
|
||||
await this.page.click('button:has-text("新增预约"), button:has-text("创建")');
|
||||
await this.page.waitForSelector('.ant-modal, .ant-drawer', { timeout: 5000 });
|
||||
}
|
||||
|
||||
async fillAppointmentForm(data: { patient_id: string; doctor_id: string; date: string; reason?: string }) {
|
||||
if (data.reason) {
|
||||
await this.page.fill('textarea, input[placeholder*="原因"]', data.reason);
|
||||
}
|
||||
}
|
||||
|
||||
async submitAppointmentForm() {
|
||||
await this.page.click('.ant-modal button[type="submit"], .ant-btn-primary');
|
||||
await this.page.waitForSelector('.ant-message-success', { timeout: 10000 });
|
||||
}
|
||||
}
|
||||
78
apps/web/e2e/pages/health-data.page.ts
Normal file
78
apps/web/e2e/pages/health-data.page.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
// apps/web/e2e/pages/health-data.page.ts
|
||||
import type { Page, Locator } from '@playwright/test';
|
||||
|
||||
export class HealthDataPage {
|
||||
readonly page: Page;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
async clickAddVitalSigns() {
|
||||
await this.page.click('button:has-text("录入体征"), button:has-text("新增")');
|
||||
await this.page.waitForSelector('.ant-modal', { timeout: 5000 });
|
||||
}
|
||||
|
||||
private formField(labelText: string): Locator {
|
||||
const modal = this.page.locator('.ant-modal');
|
||||
return modal.locator('.ant-form-item').filter({ hasText: labelText }).locator('input');
|
||||
}
|
||||
|
||||
async fillVitalSignsForm(data: {
|
||||
record_date?: string;
|
||||
systolic_bp_morning?: number;
|
||||
diastolic_bp_morning?: number;
|
||||
heart_rate?: number;
|
||||
body_temperature?: number;
|
||||
spo2?: number;
|
||||
weight?: number;
|
||||
blood_sugar?: number;
|
||||
}) {
|
||||
const modal = this.page.locator('.ant-modal');
|
||||
|
||||
// Fill date - DatePicker needs special handling
|
||||
const dateToFill = data.record_date || new Date().toISOString().slice(0, 10);
|
||||
const datePicker = modal.locator('.ant-form-item').filter({ hasText: '记录日期' }).locator('input');
|
||||
await datePicker.click();
|
||||
await datePicker.fill(dateToFill);
|
||||
await this.page.keyboard.press('Enter');
|
||||
await this.page.waitForTimeout(300);
|
||||
|
||||
if (data.systolic_bp_morning) {
|
||||
await this.formField('收缩压(晨)').fill(String(data.systolic_bp_morning));
|
||||
}
|
||||
if (data.diastolic_bp_morning) {
|
||||
await this.formField('舒张压(晨)').fill(String(data.diastolic_bp_morning));
|
||||
}
|
||||
if (data.heart_rate) {
|
||||
await this.formField('心率').fill(String(data.heart_rate));
|
||||
}
|
||||
if (data.weight) {
|
||||
await this.formField('体重').fill(String(data.weight));
|
||||
}
|
||||
if (data.blood_sugar) {
|
||||
await this.formField('血糖').fill(String(data.blood_sugar));
|
||||
}
|
||||
}
|
||||
|
||||
async submitVitalSigns() {
|
||||
const modal = this.page.locator('.ant-modal');
|
||||
await modal.locator('.ant-modal-footer button.ant-btn-primary').click();
|
||||
await this.page.waitForSelector('.ant-message-success', { timeout: 10000 });
|
||||
}
|
||||
|
||||
async getVitalSignsList(): Promise<string[]> {
|
||||
const rows = this.page.locator('.ant-table-tbody tr');
|
||||
const count = await rows.count();
|
||||
const texts: string[] = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
texts.push(await rows.nth(i).textContent() ?? '');
|
||||
}
|
||||
return texts;
|
||||
}
|
||||
|
||||
async trendChartIsVisible(): Promise<boolean> {
|
||||
const chart = this.page.locator('canvas, .recharts-wrapper, [class*="chart"]');
|
||||
return chart.isVisible();
|
||||
}
|
||||
}
|
||||
6
apps/web/e2e/pages/index.ts
Normal file
6
apps/web/e2e/pages/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
// apps/web/e2e/pages/index.ts
|
||||
export { LoginPage } from './login.page';
|
||||
export { PatientListPage } from './patient-list.page';
|
||||
export { PatientDetailPage } from './patient-detail.page';
|
||||
export { HealthDataPage } from './health-data.page';
|
||||
export { AppointmentPage } from './appointment.page';
|
||||
48
apps/web/e2e/pages/login.page.ts
Normal file
48
apps/web/e2e/pages/login.page.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
// apps/web/e2e/pages/login.page.ts
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
export class LoginPage {
|
||||
readonly page: Page;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
async goto() {
|
||||
await this.page.goto('/#/login');
|
||||
await this.page.waitForSelector('.ant-card, .ant-form');
|
||||
}
|
||||
|
||||
async fillUsername(username: string) {
|
||||
await this.page.fill('input[id="username"], input[placeholder*="用户名"]', username);
|
||||
}
|
||||
|
||||
async fillPassword(password: string) {
|
||||
await this.page.fill('input[type="password"]', password);
|
||||
}
|
||||
|
||||
async clickSubmit() {
|
||||
await this.page.click('button[type="submit"]');
|
||||
}
|
||||
|
||||
async login(username: string, password: string) {
|
||||
await this.goto();
|
||||
await this.fillUsername(username);
|
||||
await this.fillPassword(password);
|
||||
await this.clickSubmit();
|
||||
}
|
||||
|
||||
async getErrorMessage(): Promise<string> {
|
||||
const el = this.page.locator('.ant-form-item-explain-error, .ant-message-error, .ant-alert-error');
|
||||
return el.first().textContent() ?? '';
|
||||
}
|
||||
|
||||
async isLoggedIn(): Promise<boolean> {
|
||||
try {
|
||||
await this.page.waitForURL('**/#/', { timeout: 5000 });
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
44
apps/web/e2e/pages/patient-detail.page.ts
Normal file
44
apps/web/e2e/pages/patient-detail.page.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
// apps/web/e2e/pages/patient-detail.page.ts
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
export class PatientDetailPage {
|
||||
readonly page: Page;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
async goto(id: string) {
|
||||
await this.page.goto(`/#/health/patients/${id}`);
|
||||
await this.page.waitForSelector('.ant-descriptions, .ant-tabs', { timeout: 10000 });
|
||||
}
|
||||
|
||||
async getPatientName(): Promise<string> {
|
||||
const el = this.page.locator('div[style*="font-weight"]').first();
|
||||
return el.textContent() ?? '';
|
||||
}
|
||||
|
||||
async clickTab(tabName: string) {
|
||||
await this.page.click(`.ant-tabs-tab:has-text("${tabName}")`);
|
||||
await this.page.waitForTimeout(500);
|
||||
}
|
||||
|
||||
async getVitalSignsCount(): Promise<number> {
|
||||
return this.page.locator('.ant-table-tbody tr').count();
|
||||
}
|
||||
|
||||
async clickAssignDoctor() {
|
||||
await this.page.click('button:has-text("分配医生")');
|
||||
await this.page.waitForSelector('.ant-modal, .ant-drawer', { timeout: 5000 });
|
||||
}
|
||||
|
||||
async selectDoctor(doctorName: string) {
|
||||
await this.page.click('.ant-select');
|
||||
await this.page.click(`.ant-select-item-option:has-text("${doctorName}")`);
|
||||
}
|
||||
|
||||
async confirmAssign() {
|
||||
await this.page.click('.ant-modal button[type="submit"], .ant-btn-primary');
|
||||
await this.page.waitForSelector('.ant-message-success', { timeout: 5000 });
|
||||
}
|
||||
}
|
||||
66
apps/web/e2e/pages/patient-list.page.ts
Normal file
66
apps/web/e2e/pages/patient-list.page.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
// apps/web/e2e/pages/patient-list.page.ts
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
export class PatientListPage {
|
||||
readonly page: Page;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
async goto() {
|
||||
await this.page.goto('/#/health/patients');
|
||||
await this.page.waitForSelector('.ant-table', { timeout: 15000 });
|
||||
}
|
||||
|
||||
async clickCreate() {
|
||||
await this.page.click('button:has-text("新增"), button:has-text("新建"), button:has-text("创建")');
|
||||
await this.page.waitForSelector('.ant-modal, .ant-drawer', { timeout: 5000 });
|
||||
}
|
||||
|
||||
async fillCreateForm(data: { name: string; gender?: string; birth_date?: string }) {
|
||||
const drawer = this.page.locator('.ant-drawer');
|
||||
await drawer.locator('input').first().waitFor({ state: 'visible' });
|
||||
await this.page.locator('.ant-drawer [name="name"] input, .ant-drawer input').first().fill(data.name);
|
||||
if (data.gender) {
|
||||
await drawer.locator('.ant-select').first().click();
|
||||
await this.page.locator(`.ant-select-item-option:has-text("${data.gender === 'male' ? '男' : '女'}")`).first().click();
|
||||
}
|
||||
if (data.birth_date) {
|
||||
await drawer.locator('[name="birth_date"] input, input[placeholder*="出生"]').fill(data.birth_date);
|
||||
}
|
||||
}
|
||||
|
||||
async submitForm() {
|
||||
await this.page.click('.ant-drawer button.ant-btn-primary, button:has-text("保存"), .ant-modal .ant-btn-primary');
|
||||
await this.page.waitForSelector('.ant-message-success', { timeout: 10000 });
|
||||
}
|
||||
|
||||
async searchPatient(name: string) {
|
||||
const searchInput = this.page.locator('input[placeholder*="搜索"]').first();
|
||||
await searchInput.fill(name);
|
||||
await searchInput.press('Enter');
|
||||
await this.page.waitForTimeout(1000);
|
||||
}
|
||||
|
||||
async clickPatientRow(row: number) {
|
||||
const rows = this.page.locator('.ant-table-tbody tr');
|
||||
await rows.nth(row).click();
|
||||
}
|
||||
|
||||
async clickPatientByName(name: string) {
|
||||
await this.searchPatient(name);
|
||||
const row = this.page.locator(`.ant-table-tbody tr:has-text("${name}")`).first();
|
||||
await row.click();
|
||||
}
|
||||
|
||||
async getTableRowCount(): Promise<number> {
|
||||
return this.page.locator('.ant-table-tbody tr').count();
|
||||
}
|
||||
|
||||
async hasPatientInTable(name: string): Promise<boolean> {
|
||||
await this.searchPatient(name);
|
||||
const count = await this.page.locator(`.ant-table-tbody tr:has-text("${name}")`).count();
|
||||
return count > 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user