患者分组代码优化,解决大数据问题
This commit is contained in:
parent
8d0f7452b5
commit
58931fcf2e
334
features/patient/src/main/ets/components/CopyPatientGroups.ets
Normal file
334
features/patient/src/main/ets/components/CopyPatientGroups.ets
Normal file
@ -0,0 +1,334 @@
|
||||
import { authStore, HdNav, PositionSelectedSheet } from '@itcast/basic';
|
||||
import { promptAction } from '@kit.ArkUI'
|
||||
import { HdLoadingDialog } from '@itcast/basic'
|
||||
import { BasicConstant,hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import HashMap from '@ohos.util.HashMap';
|
||||
import { groupRequest,groupRequestCall,groupModel,patientListModel } from '../models/PatientsGroupModel'
|
||||
import { HMRouterMgr, HMRouterPathInfo, HMRouterPathCallback, HMRouter } from "@hadss/hmrouter"
|
||||
|
||||
@HMRouter({ pageUrl: 'CopyPatientGroups' })
|
||||
@Component
|
||||
export struct CopyPatientGroups {
|
||||
@State groupSort: string = '分组排序'
|
||||
@State innerSort: string = '组内排序'
|
||||
@State groupSortList:sortModel[] = [];
|
||||
@State innerSortList:sortModel[] = [];
|
||||
@State groupSortSelected: boolean = false//是否展开
|
||||
@State innerSortSelected: boolean = false//是否展开
|
||||
@State isGroupSelected: boolean = false//是否选中
|
||||
@State IsInnerSelected: boolean = false//是否选中
|
||||
@State isMaiLanHidden:boolean = false;//麦兰项目是否显示
|
||||
@State group_sort:string = '0'
|
||||
@State list_sort:string = '0'
|
||||
@State groupListArray: groupModel[] = []
|
||||
private params: ESObject = HMRouterMgr.getCurrentParam()
|
||||
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center
|
||||
})
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.getGroupData()
|
||||
this.getIsMaiLanData()
|
||||
this.groupSortList = [{"name":"按首字母","isSeleted":false} as sortModel,{"name":"分组人数","isSeleted":false} as sortModel]
|
||||
this.innerSortList = [{"name":"按首字母","isSeleted":false} as sortModel,{"name":"随访时间","isSeleted":false} as sortModel]
|
||||
}
|
||||
|
||||
getGroupData(){
|
||||
this.dialog.open()
|
||||
hdHttp.post<string>(BasicConstant.groupList, {
|
||||
expert_uuid: authStore.getUser().uuid,
|
||||
group_sort:this.group_sort,
|
||||
list_sort:this.list_sort
|
||||
} as groupRequest).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
this.groupListArray = []
|
||||
logger.info('Response groupList'+res);
|
||||
let json:groupRequestCall = JSON.parse(res+'') as groupRequestCall;
|
||||
if(json.code == 1) {
|
||||
this.groupListArray = json.data
|
||||
} else {
|
||||
console.error('患者分组列表失败:'+json.message)
|
||||
promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close();
|
||||
console.error(`Response fails: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
getIsMaiLanData() {
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
this.dialog.open()
|
||||
hdHttp.httpReq<string>(BasicConstant.isMaiLanExpert,hashMap).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
logger.info('Response isMaiLanExpert'+res);
|
||||
let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>;
|
||||
if(json.code == '200') {
|
||||
let isMaiLanExpert:string = json.isMaiLanExpert;
|
||||
if (isMaiLanExpert == '1') {
|
||||
this.isMaiLanHidden = true;
|
||||
}
|
||||
} else {
|
||||
console.error('麦兰:'+json.message)
|
||||
promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close();
|
||||
console.info(`Response fails: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
HdNav({
|
||||
title: '患者分组',
|
||||
showRightIcon: false,
|
||||
hasBorder: true,
|
||||
rightText: '新建',
|
||||
showRightText: true,
|
||||
isLeftAction:this.params?true:false,
|
||||
leftItemAction:()=>{
|
||||
HMRouterMgr.pop()
|
||||
},
|
||||
rightItemAction: () => {
|
||||
HMRouterMgr.push({pageUrl:'BuildOrEditGroupPage',param:{"title":"新建分组"}})
|
||||
// router.pushUrl({
|
||||
// url: 'pages/PatientsPage/BuildOrEditGroupPage',
|
||||
// params:{"title":"新建分组"}
|
||||
// })
|
||||
}
|
||||
})
|
||||
Stack() {
|
||||
Row() {
|
||||
Row() {
|
||||
Text(this.groupSort)
|
||||
.fontSize(16).fontColor(this.isGroupSelected ? $r('app.color.main_color') : '#333333')
|
||||
Image(this.isGroupSelected ?$r('app.media.triangle_green_theme'):$r('app.media.triangle_normal')).width(10).height(10)
|
||||
}
|
||||
.width('50%')
|
||||
.height(48)
|
||||
.backgroundColor(Color.White)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.onClick(() => {
|
||||
this.groupSortSelected = !this.groupSortSelected
|
||||
this.innerSortSelected = false
|
||||
})
|
||||
|
||||
Blank()
|
||||
.width(1).height(20).margin({ top: 15 })
|
||||
Row() {
|
||||
Text(this.innerSort)
|
||||
.fontSize(16).fontColor(this.IsInnerSelected ? $r('app.color.main_color') : '#333333')
|
||||
Image(this.IsInnerSelected ?$r('app.media.triangle_green_theme'):$r('app.media.triangle_normal')).width(10).height(10)
|
||||
}
|
||||
.width('50%')
|
||||
.height(48)
|
||||
.backgroundColor(Color.White)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.onClick(() => {
|
||||
this.innerSortSelected = !this.innerSortSelected
|
||||
this.groupSortSelected = false
|
||||
})
|
||||
}.width('100%').height(55).backgroundColor('#f4f4f4')
|
||||
|
||||
List() {
|
||||
ForEach(this.groupListArray, (sectionModel: groupModel,index:number) => {
|
||||
ListItemGroup({ header: this.itemHeaderView(sectionModel,index) }) {
|
||||
ForEach(sectionModel.isShow ? sectionModel.patientList : [], (rowModel: patientListModel) => {
|
||||
ListItem() {
|
||||
Stack() {
|
||||
Row({ space: 15 }) {
|
||||
Image(BasicConstant.urlImage + rowModel.photo)
|
||||
.alt($r('app.media.userPhoto_default'))
|
||||
.width(54)
|
||||
.height(54)
|
||||
.borderRadius(6)
|
||||
.margin({ left: 15 })
|
||||
Text(rowModel.nickname ? rowModel.nickname : rowModel.realName)
|
||||
.fontSize(16).fontColor('#666666')
|
||||
if (Number(rowModel.type) === 0) {
|
||||
Image($r('app.media.group_vip'))
|
||||
.objectFit(ImageFit.Cover)
|
||||
.width(10).height(10)
|
||||
}
|
||||
}.width('100%').height(80)
|
||||
|
||||
Text('随访于' + rowModel.join_date?.substring(0, 10))
|
||||
.fontSize(14)
|
||||
.fontColor('#999999')
|
||||
.textAlign(TextAlign.End)
|
||||
.margin({ right: 15 })
|
||||
.height(30)
|
||||
Row()
|
||||
.width('95%').height(0.5)
|
||||
.backgroundColor('#999999')
|
||||
}.width('100%').height(80).alignContent(Alignment.BottomEnd)
|
||||
.onClick(()=>{
|
||||
HMRouterMgr.push({pageUrl:'PatientDetailsComp',param:{"patient_uuid":rowModel.uuid}})
|
||||
// router.pushUrl({
|
||||
// url:'pages/PatientsPage/PatientDetailsPage',
|
||||
// params:{"patient_uuid":rowModel.uuid}
|
||||
// })
|
||||
})
|
||||
}.width('100%')
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.height('calc(100% - 55vp - 56vp)')
|
||||
.backgroundColor('#f4f4f4')
|
||||
.scrollBar(BarState.Off)
|
||||
.sticky(StickyStyle.Header)
|
||||
.margin({top:55})
|
||||
|
||||
List() {
|
||||
ForEach(this.groupSortList, (item: sortModel) => {
|
||||
ListItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Text(item.name)
|
||||
.fontSize(16)
|
||||
.fontColor(item.isSeleted ? $r('app.color.main_color') : 'rgba(144,144,144)')
|
||||
.margin({ left: 20 })
|
||||
Blank()
|
||||
if (item.isSeleted) {
|
||||
Image($r('app.media.chose_card'))
|
||||
.width(20).height(20).margin({ right: 25 })
|
||||
}
|
||||
}.width('100%').height(50).backgroundColor(Color.White)
|
||||
|
||||
Blank()
|
||||
.width('100%').height(1).backgroundColor($r('app.color.main_color')).margin({left:20})
|
||||
}.onClick(()=>{
|
||||
this.isGroupSelected = true;
|
||||
this.innerSortSelected = false
|
||||
this.groupSortSelected = false
|
||||
this.groupSort = String(item.name);
|
||||
this.group_sort = item.name == '按首字母' ? '0' : '1'
|
||||
this.groupSortList.forEach((element: sortModel) => {
|
||||
element.isSeleted = false
|
||||
})
|
||||
const indexof = this.groupSortList.indexOf(item)
|
||||
if (indexof !== -1) {
|
||||
this.groupSortList[indexof].isSeleted = true
|
||||
}
|
||||
this.groupSortList = [...this.groupSortList]
|
||||
this.getGroupData()
|
||||
})
|
||||
}
|
||||
})
|
||||
}.width('100%').height('calc(100% - 55vp)').backgroundColor('rgba(0,0,0,0.5)').margin({top:55})
|
||||
.visibility(this.groupSortSelected?Visibility.Visible:Visibility.Hidden)
|
||||
|
||||
List() {
|
||||
ForEach(this.innerSortList, (item: sortModel) => {
|
||||
ListItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Text(item.name)
|
||||
.fontSize(16)
|
||||
.fontColor(item.isSeleted ? $r('app.color.main_color') : 'rgba(144,144,144)')
|
||||
.margin({ left: 20 })
|
||||
Blank()
|
||||
if (item.isSeleted) {
|
||||
Image($r('app.media.chose_card'))
|
||||
.width(20).height(20).margin({ right: 25 })
|
||||
}
|
||||
}.width('100%').height(50).backgroundColor(Color.White)
|
||||
|
||||
Blank()
|
||||
.width('95%').height(1).backgroundColor($r('app.color.main_color'))
|
||||
}
|
||||
.onClick(()=>{
|
||||
this.IsInnerSelected = true
|
||||
this.innerSortSelected = false
|
||||
this.groupSortSelected = false
|
||||
this.innerSort = String(item.name);
|
||||
this.list_sort = item.name == '按首字母' ? '0' : '1'
|
||||
this.innerSortList.forEach((element: sortModel) => {
|
||||
element.isSeleted = false
|
||||
});
|
||||
const indexof = this.innerSortList.indexOf(item)
|
||||
if (indexof !== -1) {
|
||||
this.innerSortList[indexof].isSeleted = true
|
||||
}
|
||||
this.innerSortList = [...this.innerSortList]
|
||||
this.getGroupData()
|
||||
})
|
||||
}
|
||||
})
|
||||
}.width('100%').height('calc(100% - 55vp)').backgroundColor('rgba(0,0,0,0.5)').margin({top:55})
|
||||
.visibility(this.innerSortSelected?Visibility.Visible:Visibility.Hidden)
|
||||
|
||||
Image($r('app.media.lifetime_right_icon'))
|
||||
.width(76).height(40)
|
||||
.position({ x: '80%', y: '80%' }) // 定位到右下角
|
||||
.visibility(this.isMaiLanHidden?Visibility.Visible:Visibility.Hidden)
|
||||
|
||||
}.width('100%').height('calc(100% - 56vp)').backgroundColor('#f4f4f4').alignContent(Alignment.TopStart)
|
||||
}
|
||||
}
|
||||
|
||||
@Builder
|
||||
itemHeaderView(model:groupModel,index:number) {
|
||||
Column() {
|
||||
Row() {
|
||||
Image(model.isShow ? $r('app.media.group_turnDown') : $r('app.media.group_turnRight'))
|
||||
.width(model.isShow ? 10 : 5).height(model.isShow ? 5 : 10).margin({ left: 15 })
|
||||
Text(model.name + ' | ' + model.patientNum)
|
||||
.fontSize(16)
|
||||
.fontColor('#333333')
|
||||
.margin({ left: 15 })
|
||||
.layoutWeight(1)
|
||||
Text('编辑')
|
||||
.width(60)
|
||||
.height(60)
|
||||
.fontSize(15)
|
||||
.fontColor('#981308')
|
||||
.margin({ right: 15 })
|
||||
.textAlign(TextAlign.End)
|
||||
.visibility(model.name != '待分组患者'?Visibility.Visible:Visibility.Hidden)
|
||||
.onClick(()=>{
|
||||
const pathInfo1: HMRouterPathInfo = {
|
||||
pageUrl: 'BuildOrEditGroupPage',
|
||||
param:{"title":"编辑分组","group_uuid":model.uuid,"group_name":model.name}
|
||||
};
|
||||
const callback: HMRouterPathCallback = {
|
||||
onResult: (popInfo: PopInfo) => {
|
||||
const result = popInfo.result as Record<string,string>
|
||||
const isFreash = Boolean(result.nameString)
|
||||
if (isFreash) {
|
||||
this.getGroupData()
|
||||
}
|
||||
}
|
||||
};
|
||||
HMRouterMgr.push(pathInfo1,callback)
|
||||
// router.pushUrl({
|
||||
// url: 'pages/PatientsPage/BuildOrEditGroupPage',
|
||||
// params:{"title":"编辑分组","group_uuid":model.uuid,"group_name":model.name}
|
||||
// })
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.height(60)
|
||||
.onClick(() => {
|
||||
let newModel = new groupModel(model);
|
||||
newModel.isShow = !model.isShow;
|
||||
this.groupListArray[index] = newModel;
|
||||
this.groupListArray = [...this.groupListArray];
|
||||
})
|
||||
Blank()
|
||||
.width('100%').height(1).backgroundColor('#666666')
|
||||
}.width('100%').height(61).backgroundColor(Color.White)
|
||||
}
|
||||
}
|
||||
|
||||
export class sortModel {
|
||||
name?:string;
|
||||
isSeleted:boolean = false;
|
||||
}
|
||||
@ -4,8 +4,8 @@ import { HdLoadingDialog } from '@itcast/basic'
|
||||
import { BasicConstant, hdHttp, HdResponse, logger } from '@itcast/basic/Index'
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import HashMap from '@ohos.util.HashMap';
|
||||
import { groupRequest,groupRequestCall,groupModel,patientListModel } from '../models/PatientsGroupModel'
|
||||
import { HMRouterMgr, HMRouterPathInfo, HMRouterPathCallback, HMRouter } from "@hadss/hmrouter"
|
||||
import { groupRequest, groupRequestCall, groupModel, patientListModel,PatientDataSource } from '../models/PatientsGroupModel'
|
||||
import { HMRouterMgr, HMRouterPathInfo, HMRouterPathCallback, HMRouter, HMLifecycleState } from "@hadss/hmrouter"
|
||||
|
||||
@HMRouter({ pageUrl: 'PatientsGroup' })
|
||||
@Component
|
||||
@ -23,6 +23,10 @@ export struct PatientsGroup {
|
||||
@State list_sort: string = '0'
|
||||
@State groupListArray: groupModel[] = []
|
||||
private params: ESObject = HMRouterMgr.getCurrentParam()
|
||||
private lifecycleOwner = HMRouterMgr.getCurrentLifecycleOwner()
|
||||
private handleCallback = () => {
|
||||
this.getGroupData()
|
||||
}
|
||||
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||
@ -31,25 +35,35 @@ export struct PatientsGroup {
|
||||
})
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.getGroupData()
|
||||
this.getIsMaiLanData()
|
||||
// this.getGroupData()
|
||||
// this.getIsMaiLanData()
|
||||
this.groupSortList = [{ "name": "按首字母", "isSeleted": false } as sortModel, { "name": "分组人数", "isSeleted": false } as sortModel]
|
||||
this.innerSortList = [{ "name": "按首字母", "isSeleted": false } as sortModel, { "name": "随访时间", "isSeleted": false } as sortModel]
|
||||
this.lifecycleOwner?.addObserver(HMLifecycleState.onShown,this.handleCallback)
|
||||
}
|
||||
|
||||
aboutToDisappear(): void {
|
||||
this.lifecycleOwner?.removeObserver(HMLifecycleState.onShown,this.handleCallback)
|
||||
}
|
||||
|
||||
getGroupData() {
|
||||
this.dialog.open()
|
||||
this.groupListArray = []
|
||||
hdHttp.post<string>(BasicConstant.groupList, {
|
||||
expert_uuid: authStore.getUser().uuid,
|
||||
group_sort: this.group_sort,
|
||||
list_sort: this.list_sort
|
||||
} as groupRequest).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
this.groupListArray = []
|
||||
logger.info('Response groupList' + res);
|
||||
let json: groupRequestCall = JSON.parse(res + '') as groupRequestCall;
|
||||
if (json.code == 1) {
|
||||
this.groupListArray = json.data
|
||||
// 初始化每个分组的数据源
|
||||
this.groupListArray = json.data.map(group => {
|
||||
group.isShow = false
|
||||
group.dataSource = new PatientDataSource(group.patientList || [])
|
||||
return group
|
||||
})
|
||||
} else {
|
||||
console.error('患者分组列表失败:' + json.message)
|
||||
promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
@ -96,10 +110,6 @@ export struct PatientsGroup {
|
||||
},
|
||||
rightItemAction: () => {
|
||||
HMRouterMgr.push({ pageUrl: 'BuildOrEditGroupPage', param: { "title": "新建分组" } })
|
||||
// router.pushUrl({
|
||||
// url: 'pages/PatientsPage/BuildOrEditGroupPage',
|
||||
// params:{"title":"新建分组"}
|
||||
// })
|
||||
}
|
||||
})
|
||||
Stack() {
|
||||
@ -138,7 +148,10 @@ export struct PatientsGroup {
|
||||
List() {
|
||||
ForEach(this.groupListArray, (sectionModel: groupModel, index: number) => {
|
||||
ListItemGroup({ header: this.itemHeaderView(sectionModel, index) }) {
|
||||
ForEach(sectionModel.isShow ? sectionModel.patientList : [], (rowModel: patientListModel) => {
|
||||
// 仅当分组展开时才渲染患者列表
|
||||
if (sectionModel.isShow) {
|
||||
// 使用LazyForEach渲染大量数据
|
||||
LazyForEach(sectionModel.dataSource as PatientDataSource, (rowModel: patientListModel, rowIndex: number) => {
|
||||
ListItem() {
|
||||
Stack() {
|
||||
Row({ space: 15 }) {
|
||||
@ -168,14 +181,19 @@ export struct PatientsGroup {
|
||||
.backgroundColor('#999999')
|
||||
}.width('100%').height(80).alignContent(Alignment.BottomEnd)
|
||||
.onClick(() => {
|
||||
HMRouterMgr.push({pageUrl:'PatientDetailsComp',param:{"patient_uuid":rowModel.uuid}})
|
||||
// router.pushUrl({
|
||||
// url:'pages/PatientsPage/PatientDetailsPage',
|
||||
// params:{"patient_uuid":rowModel.uuid}
|
||||
// })
|
||||
HMRouterMgr.push({
|
||||
pageUrl: 'PatientDetailsComp',
|
||||
param: { "patient_uuid": rowModel.uuid }
|
||||
}, {
|
||||
onResult: () => {
|
||||
// 从详情页返回时刷新整个列表
|
||||
this.getGroupData();
|
||||
}
|
||||
});
|
||||
})
|
||||
}.width('100%')
|
||||
})
|
||||
}, (rowModel: patientListModel) => rowModel.uuid)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -308,19 +326,18 @@ export struct PatientsGroup {
|
||||
}
|
||||
};
|
||||
HMRouterMgr.push(pathInfo1, callback)
|
||||
// router.pushUrl({
|
||||
// url: 'pages/PatientsPage/BuildOrEditGroupPage',
|
||||
// params:{"title":"编辑分组","group_uuid":model.uuid,"group_name":model.name}
|
||||
// })
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.height(60)
|
||||
.onClick(() => {
|
||||
let newModel = new groupModel(model);
|
||||
newModel.isShow = !model.isShow;
|
||||
this.groupListArray[index] = newModel;
|
||||
this.groupListArray = [...this.groupListArray];
|
||||
// 找到对应的分组并更新状态
|
||||
const groupIndex = this.groupListArray.findIndex(group => group.uuid === model.uuid)
|
||||
if (groupIndex !== -1) {
|
||||
this.groupListArray[groupIndex].isShow = !this.groupListArray[groupIndex].isShow
|
||||
// 强制触发UI更新
|
||||
this.groupListArray = [...this.groupListArray]
|
||||
}
|
||||
})
|
||||
Blank()
|
||||
.width('100%').height(1).backgroundColor('#666666')
|
||||
|
||||
@ -1,34 +1,159 @@
|
||||
// export interface groupRequest {
|
||||
// expert_uuid:string,
|
||||
// group_sort:string,
|
||||
// list_sort:string,
|
||||
// }
|
||||
//
|
||||
// export interface groupRequestCall {
|
||||
// code:number,
|
||||
// msg:string,
|
||||
// data:groupModel[],
|
||||
// message:string,
|
||||
// }
|
||||
//
|
||||
// export class groupModel {
|
||||
// patientList:patientListModel[] = []
|
||||
// patientNum:number = 0
|
||||
// expert_uuid:string = ''
|
||||
// name:string = ''
|
||||
// type:number = 0
|
||||
// uuid:string = ''
|
||||
// isShow:boolean = false
|
||||
// isSelected:boolean = false
|
||||
//
|
||||
// constructor(data: groupModel) {
|
||||
// this.patientList = data.patientList
|
||||
// this.patientNum = data.patientNum
|
||||
// this.expert_uuid = data.expert_uuid
|
||||
// this.name = data.name
|
||||
// this.type = data.type
|
||||
// this.uuid = data.uuid
|
||||
// this.isShow = data.isShow
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// export class patientListModel {
|
||||
// nickname?:string;
|
||||
// is_start?:string;
|
||||
// join_date?:string;
|
||||
// note?:string;
|
||||
// type?:string;
|
||||
// photo?:string;
|
||||
// birthDate?:string;
|
||||
// uuid?:string;
|
||||
// isEnable?:string;
|
||||
// height?:string;
|
||||
// ctdidId?:string;
|
||||
// mobile?:string;
|
||||
// nation?:string;
|
||||
// bloodType?:string;
|
||||
// fixedTelephone?:string;
|
||||
// mailingAddress?:string;
|
||||
// postalCode?:string;
|
||||
// detailed_address?:string;
|
||||
// weight?:string;
|
||||
// diagnosis?:string;
|
||||
// sex?:string;
|
||||
// provId?:string;
|
||||
// countyId?:string;
|
||||
// cityId?:string;
|
||||
// realName?:string;
|
||||
// realname?:string;
|
||||
// isSelected:boolean = false;
|
||||
// }
|
||||
|
||||
// PatientsGroupModel.ts 文件
|
||||
export interface groupRequest {
|
||||
expert_uuid:string,
|
||||
group_sort:string,
|
||||
list_sort:string,
|
||||
expert_uuid: string;
|
||||
group_sort: string;
|
||||
list_sort: string;
|
||||
}
|
||||
|
||||
export interface groupRequestCall {
|
||||
code:number,
|
||||
msg:string,
|
||||
data:groupModel[],
|
||||
message:string,
|
||||
code: number;
|
||||
msg: string;
|
||||
data: groupModel[];
|
||||
message: string;
|
||||
}
|
||||
|
||||
// 定义患者列表数据源接口
|
||||
interface IDataSource {
|
||||
totalCount(): number;
|
||||
getData(index: number): patientListModel;
|
||||
registerDataChangeListener(listener: DataChangeListener): void;
|
||||
unregisterDataChangeListener(listener: DataChangeListener): void;
|
||||
}
|
||||
|
||||
// 实现患者列表数据源
|
||||
export class PatientDataSource implements IDataSource {
|
||||
private patients: patientListModel[] = [];
|
||||
private listeners: DataChangeListener[] = [];
|
||||
|
||||
constructor(patients: patientListModel[]) {
|
||||
this.patients = patients || [];
|
||||
}
|
||||
|
||||
totalCount(): number {
|
||||
return this.patients.length;
|
||||
}
|
||||
|
||||
getData(index: number): patientListModel {
|
||||
return this.patients[index];
|
||||
}
|
||||
|
||||
registerDataChangeListener(listener: DataChangeListener): void {
|
||||
this.listeners.push(listener);
|
||||
}
|
||||
|
||||
unregisterDataChangeListener(listener: DataChangeListener): void {
|
||||
const pos = this.listeners.indexOf(listener);
|
||||
if (pos >= 0) {
|
||||
this.listeners.splice(pos, 1);
|
||||
}
|
||||
}
|
||||
|
||||
notifyDataReload(): void {
|
||||
this.listeners.forEach(listener => {
|
||||
listener.onDataReloaded?.();
|
||||
});
|
||||
}
|
||||
|
||||
updatePatients(newPatients: patientListModel[]): void {
|
||||
this.patients = newPatients || [];
|
||||
this.notifyDataReload();
|
||||
}
|
||||
}
|
||||
|
||||
export class groupModel {
|
||||
patientList:patientListModel[] = []
|
||||
patientNum:number = 0
|
||||
expert_uuid:string = ''
|
||||
name:string = ''
|
||||
type:number = 0
|
||||
uuid:string = ''
|
||||
isShow:boolean = false
|
||||
isSelected:boolean = false
|
||||
patientList: patientListModel[] = [];
|
||||
patientNum: number = 0;
|
||||
expert_uuid: string = '';
|
||||
name: string = '';
|
||||
type: number = 0;
|
||||
uuid: string = '';
|
||||
isShow: boolean = false;
|
||||
isSelected: boolean = false;
|
||||
|
||||
// 添加数据源属性
|
||||
dataSource: PatientDataSource = new PatientDataSource([]);
|
||||
|
||||
constructor(data: groupModel) {
|
||||
this.patientList = data.patientList
|
||||
this.patientNum = data.patientNum
|
||||
this.expert_uuid = data.expert_uuid
|
||||
this.name = data.name
|
||||
this.type = data.type
|
||||
this.uuid = data.uuid
|
||||
this.isShow = data.isShow
|
||||
this.patientList = data.patientList || [];
|
||||
this.patientNum = data.patientNum || 0;
|
||||
this.expert_uuid = data.expert_uuid || '';
|
||||
this.name = data.name || '';
|
||||
this.type = data.type || 0;
|
||||
this.uuid = data.uuid || '';
|
||||
this.isShow = data.isShow || false;
|
||||
|
||||
// 初始化数据源
|
||||
this.dataSource = new PatientDataSource(this.patientList);
|
||||
}
|
||||
|
||||
// 添加更新患者列表的方法
|
||||
updatePatientList(patients: patientListModel[]): void {
|
||||
this.patientList = patients || [];
|
||||
this.dataSource.updatePatients(this.patientList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user