334 lines
13 KiB
Plaintext
334 lines
13 KiB
Plaintext
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: 'PatientsGroup' })
|
|
@Component
|
|
export struct PatientsGroup {
|
|
@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;
|
|
} |