chore(hmos): 导入生产环境鸿蒙工程
- 以 D:\SmartSenior 生产工程为源,纳入 AppScope、entry、cjagent、hvigor 及根配置 - 移除 build-profile.json5 的 signingConfigs(p12/p7b/cer 路径与加密口令)及 products.signingConfig 引用 - 不纳入本地与开发产物:local.properties、.idea、.hvigor、.codegenie、demo、backup_a2a_native、SESSION_LOG.md、build_err.txt、build/、oh_modules - .gitignore 追加 .codegenie 与密钥文件通配(*.p12/*.p7b/*.cer/*.jks/*.keystore/*.pem)
This commit is contained in:
@@ -0,0 +1,272 @@
|
||||
// 护士 · 体检评估与护理方案(ArkTS 严格类型,无 any)
|
||||
// 接口:GET /care-plans/plans/、GET /care-plans/assessments/
|
||||
import { promptAction } from '@kit.ArkUI';
|
||||
import { HdsNavigation, HdsNavigationTitleMode, ScrollEffectType } from '@kit.UIDesignKit';
|
||||
import { hdsMaterial } from '@hms.hds.hdsMaterial';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { Page, normalizeError } from '../../common/ApiConstants';
|
||||
import { api, RequestError } from '../../utils/Request';
|
||||
|
||||
interface CarePlan {
|
||||
id: number;
|
||||
elderly_name: string;
|
||||
version: number;
|
||||
status: string;
|
||||
generation_status: string;
|
||||
review_status: string;
|
||||
summary: string;
|
||||
suggested_care_level: string;
|
||||
suggested_care_level_reason: string;
|
||||
effective_from: string;
|
||||
}
|
||||
|
||||
interface Assessment {
|
||||
id: number;
|
||||
elderly_name: string;
|
||||
source: string;
|
||||
title: string;
|
||||
report_date: string;
|
||||
ocr_status: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
function planStatusLabel(status: string): string {
|
||||
if (status === 'draft') {
|
||||
return '草稿';
|
||||
}
|
||||
if (status === 'published') {
|
||||
return '已发布';
|
||||
}
|
||||
return '已取代';
|
||||
}
|
||||
|
||||
function planStatusColor(status: string): string {
|
||||
if (status === 'published') {
|
||||
return '#34C759';
|
||||
}
|
||||
if (status === 'draft') {
|
||||
return '#FF9500';
|
||||
}
|
||||
return '#8E8E93';
|
||||
}
|
||||
|
||||
function careLevelLabel(level: string): string {
|
||||
if (level === 'self_care') {
|
||||
return '自理';
|
||||
}
|
||||
if (level === 'semi_care') {
|
||||
return '半护理';
|
||||
}
|
||||
if (level === 'full_care') {
|
||||
return '全护理';
|
||||
}
|
||||
if (level === 'special_care') {
|
||||
return '特殊护理';
|
||||
}
|
||||
if (level === 'cognitive_care') {
|
||||
return '认知护理';
|
||||
}
|
||||
if (level === 'intensive_care') {
|
||||
return '专护';
|
||||
}
|
||||
return level || '--';
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct NurseCarePlan {
|
||||
@State plans: Array<CarePlan> = [];
|
||||
@State assessments: Array<Assessment> = [];
|
||||
@State loading: boolean = true;
|
||||
private scroller: Scroller = new Scroller();
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.load();
|
||||
}
|
||||
|
||||
private async load(): Promise<void> {
|
||||
this.loading = true;
|
||||
try {
|
||||
const results: Array<Page<CarePlan> | Page<Assessment> | null> = await Promise.all([
|
||||
api.get<Page<CarePlan>>('/care-plans/plans/', { page_size: 50 }).catch((): Page<CarePlan> | null => null),
|
||||
api.get<Page<Assessment>>('/care-plans/assessments/', { page_size: 50 }).catch((): Page<Assessment> | null => null),
|
||||
]);
|
||||
const p = results[0] as Page<CarePlan> | null;
|
||||
const a = results[1] as Page<Assessment> | null;
|
||||
this.plans = p ? p.results : [];
|
||||
this.assessments = a ? a.results : [];
|
||||
} catch (err) {
|
||||
const message = err instanceof RequestError ? err.message : normalizeError(err as BusinessError | Error);
|
||||
promptAction.showToast({ message: message });
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Builder
|
||||
PlanCard(p: CarePlan) {
|
||||
Column({ space: 6 }) {
|
||||
Row({ space: 8 }) {
|
||||
Text(p.elderly_name)
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor($r('app.color.text_primary'))
|
||||
Text(`v${p.version}`)
|
||||
.fontSize(12)
|
||||
.fontColor($r('app.color.text_secondary'))
|
||||
Blank()
|
||||
Text(planStatusLabel(p.status))
|
||||
.fontSize(12)
|
||||
.fontColor(planStatusColor(p.status))
|
||||
}
|
||||
.width('100%')
|
||||
|
||||
Text(careLevelLabel(p.suggested_care_level))
|
||||
.fontSize(13)
|
||||
.fontColor($r('app.color.accent_blue'))
|
||||
.width('100%')
|
||||
|
||||
if (p.summary && p.summary.length > 0) {
|
||||
Text(p.summary)
|
||||
.fontSize(13)
|
||||
.fontColor($r('app.color.text_secondary'))
|
||||
.maxLines(2)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.width('100%')
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.padding(14)
|
||||
.backgroundColor($r('app.color.background_card'))
|
||||
.borderRadius(12)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
}
|
||||
|
||||
@Builder
|
||||
AssessmentCard(a: Assessment) {
|
||||
Row({ space: 10 }) {
|
||||
Column({ space: 4 }) {
|
||||
Text(a.elderly_name)
|
||||
.fontSize(15)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor($r('app.color.text_primary'))
|
||||
Text(`${a.source === 'upload' ? '上传报告' : '人工录入'} · ${a.report_date || '--'}`)
|
||||
.fontSize(12)
|
||||
.fontColor($r('app.color.text_secondary'))
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
Text(a.ocr_status === 'succeeded' ? '已解析' : (a.ocr_status === 'pending' ? '解析中' : a.ocr_status || '--'))
|
||||
.fontSize(12)
|
||||
.fontColor($r('app.color.inactive_tab'))
|
||||
}
|
||||
.width('100%')
|
||||
.padding(14)
|
||||
.backgroundColor($r('app.color.background_card'))
|
||||
.borderRadius(12)
|
||||
}
|
||||
|
||||
build() {
|
||||
HdsNavigation() {
|
||||
Column() {
|
||||
if (this.loading) {
|
||||
Text('加载中...')
|
||||
.fontSize(15)
|
||||
.fontColor($r('app.color.inactive_tab'))
|
||||
.margin({ top: 60 })
|
||||
} else {
|
||||
Scroll(this.scroller) {
|
||||
Column({ space: 12 }) {
|
||||
Column({ space: 8 }) {
|
||||
Text(`护理方案(${this.plans.length})`)
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor($r('app.color.text_primary'))
|
||||
.width('100%')
|
||||
if (this.plans.length === 0) {
|
||||
Text('暂无护理方案')
|
||||
.fontSize(13)
|
||||
.fontColor($r('app.color.text_secondary'))
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor($r('app.color.background_card'))
|
||||
.borderRadius(12)
|
||||
} else {
|
||||
ForEach(this.plans, (p: CarePlan) => {
|
||||
Column() {
|
||||
this.PlanCard(p)
|
||||
}
|
||||
.width('100%')
|
||||
}, (p: CarePlan) => String(p.id))
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
|
||||
Column({ space: 8 }) {
|
||||
Text(`体检评估(${this.assessments.length})`)
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor($r('app.color.text_primary'))
|
||||
.width('100%')
|
||||
if (this.assessments.length === 0) {
|
||||
Text('暂无体检评估')
|
||||
.fontSize(13)
|
||||
.fontColor($r('app.color.text_secondary'))
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor($r('app.color.background_card'))
|
||||
.borderRadius(12)
|
||||
} else {
|
||||
ForEach(this.assessments, (a: Assessment) => {
|
||||
Column() {
|
||||
this.AssessmentCard(a)
|
||||
}
|
||||
.width('100%')
|
||||
}, (a: Assessment) => String(a.id))
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.margin({ bottom: 20 })
|
||||
}
|
||||
.width('100%')
|
||||
.padding({ left: 16, right: 16, top: 92, bottom: 30 })
|
||||
}
|
||||
.width('100%')
|
||||
.layoutWeight(1)
|
||||
.scrollBar(BarState.Auto)
|
||||
.edgeEffect(EdgeEffect.Spring)
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
.mode(NavigationMode.Stack)
|
||||
.titleBar({
|
||||
content: {
|
||||
title: {
|
||||
mainTitle: '护理方案',
|
||||
},
|
||||
},
|
||||
style: {
|
||||
scrollEffectOpts: {
|
||||
enableScrollEffect: false,
|
||||
scrollEffectType: ScrollEffectType.GRADIENT_BLUR,
|
||||
},
|
||||
systemMaterialEffect: {
|
||||
materialType: hdsMaterial.MaterialType.ADAPTIVE,
|
||||
materialLevel: hdsMaterial.MaterialLevel.EXQUISITE,
|
||||
},
|
||||
},
|
||||
avoidLayoutSafeArea: false,
|
||||
enableComponentSafeArea: false,
|
||||
})
|
||||
.bindToScrollable([this.scroller])
|
||||
.hideBackButton(false)
|
||||
.titleMode(HdsNavigationTitleMode.MINI)
|
||||
.ignoreLayoutSafeArea([LayoutSafeAreaType.SYSTEM], [LayoutSafeAreaEdge.TOP, LayoutSafeAreaEdge.BOTTOM])
|
||||
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
|
||||
.backgroundColor($r('app.color.background'))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user