患者分组
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import { BasicConstant, hdHttp, HdResponse, authStore, HdNav , HdLoadingDialog, ChangeUtil,DefaultHintProWindows,InputPopWindow } from '@itcast/basic/Index'
|
||||
import { BasicConstant, hdHttp, HdResponse, logger , authStore, HdNav , HdLoadingDialog, ChangeUtil,DefaultHintProWindows,InputPopWindow } from '@itcast/basic/Index'
|
||||
import { promptAction, router } from '@kit.ArkUI'
|
||||
import { groupModel } from '../models/PatientsGroupModel'
|
||||
import HashMap from '@ohos.util.HashMap';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { BusinessError } from '@kit.BasicServicesKit'
|
||||
|
||||
@Component
|
||||
export struct GroupManagementComp {
|
||||
@State params:Record<string, string> = router.getParams() as Record<string, string>
|
||||
private hintWindowDialog!: CustomDialogController
|
||||
@State dialogInputValue: string = ''; // 绑定输入框的值
|
||||
// InputPopWindow: CustomDialogController; // 控制器实例
|
||||
@State dialogInputValue: string = '';
|
||||
private inputPopWindow!: CustomDialogController;
|
||||
@State groupList: Array<Record<string,string>> = []
|
||||
@State selectedGroups: Array<Record<string,string>> = []
|
||||
|
||||
@@ -35,8 +35,22 @@ export struct GroupManagementComp {
|
||||
})
|
||||
}
|
||||
|
||||
private inputPopWindowInit() {
|
||||
this.inputPopWindow = new CustomDialogController({
|
||||
builder: InputPopWindow({
|
||||
title: '添加分组',
|
||||
controller:this.inputPopWindow,
|
||||
confirm: this.onConfirm
|
||||
}),
|
||||
alignment: DialogAlignment.Center,
|
||||
cornerRadius:24,
|
||||
backgroundColor: ('rgba(0,0,0,0.5)'),
|
||||
});
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
this.hintPopWindowDialog()
|
||||
this.inputPopWindowInit()
|
||||
this.addShowTagAction()
|
||||
this.fetchGroups()
|
||||
}
|
||||
@@ -56,7 +70,6 @@ export struct GroupManagementComp {
|
||||
let json:Record<string,string | Array<Record<string,string>>> = JSON.parse(res+'') as Record<string,string | Array<Record<string,string>>>
|
||||
if(json.code == '1') {
|
||||
console.info('上一层传过来的group:',this.params.groupNames)
|
||||
// groupUuids
|
||||
this.groupList = json.data as Array<Record<string,string>>
|
||||
} else {
|
||||
console.error('获取分组列表信息失败:'+json.message)
|
||||
@@ -93,43 +106,78 @@ export struct GroupManagementComp {
|
||||
}
|
||||
|
||||
onAddGroup() {
|
||||
|
||||
this.inputPopWindow.open()
|
||||
}
|
||||
|
||||
confirmAddGroup() {
|
||||
// if (!this.newGroupName.trim()) {
|
||||
// promptAction.showToast({ message: '请输入分组名', duration: 1000 })
|
||||
// return
|
||||
// }
|
||||
// if (this.newGroupName.length > 10) {
|
||||
// promptAction.showToast({ message: '最多10个字符', duration: 1000 })
|
||||
// return
|
||||
// }
|
||||
// this.addLoading = true
|
||||
// const params = {
|
||||
// expert_uuid: authStore.getUser().uuid,
|
||||
// name: this.newGroupName.trim(),
|
||||
// patient_uuid: ''
|
||||
// }
|
||||
// hdHttp.post<string>(BasicConstant.addGroup, params).then(async (res: HdResponse<string>) => {
|
||||
// this.addLoading = false
|
||||
// let json = JSON.parse(res + '') as { code: number, message: string }
|
||||
// if (json.code === 1) {
|
||||
// this.showAddDialog = false
|
||||
// this.addDialog.close()
|
||||
// this.fetchGroups()
|
||||
// promptAction.showToast({ message: '添加成功', duration: 1000 })
|
||||
// } else {
|
||||
// promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
// }
|
||||
// }).catch(() => {
|
||||
// this.addLoading = false
|
||||
// })
|
||||
private onConfirm(value: string) {
|
||||
this.confirmAddGroup(value)
|
||||
}
|
||||
|
||||
confirmAddGroup(value:string) {
|
||||
if (!value.trim()) {
|
||||
promptAction.showToast({ message: '请输入分组名', duration: 1000 })
|
||||
return
|
||||
}
|
||||
if (value.length > 10) {
|
||||
promptAction.showToast({ message: '最多10个字符', duration: 1000 })
|
||||
return
|
||||
}
|
||||
this.dialog.open()
|
||||
hdHttp.post<string>(BasicConstant.addGroup, {
|
||||
"expert_uuid": authStore.getUser().uuid,
|
||||
"name":value,
|
||||
"patient_uuid":""
|
||||
} as Record<string,string>).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
let json:Record<string,string | Array<Record<string,string>>> = JSON.parse(res+'') as Record<string,string | Array<Record<string,string>>>
|
||||
if(json.code == '1') {
|
||||
this.fetchGroups()
|
||||
this.groupList = json.data as Array<Record<string,string>>
|
||||
promptAction.showToast({ message: "添加分组成功", duration: 1000 })
|
||||
} else if (json.code == '2') {
|
||||
promptAction.showToast({ message: "该分组已存在", duration: 1000 })
|
||||
} else {
|
||||
console.error('创建分组失败:'+json.message)
|
||||
promptAction.showToast({ message: String(json.message), duration: 1000 })
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close();
|
||||
console.error(`Response fails: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
saveGroupNameAction(){
|
||||
if (this.selectedGroups.length <= 0) {
|
||||
promptAction.showToast({ message: "请选择或者创建分组", duration: 1000 })
|
||||
return
|
||||
}
|
||||
this.dialog.open()
|
||||
const uuidString = this.selectedGroups.map(item => item.uuid).join(',');
|
||||
const nameString = this.selectedGroups.map(item => item.uuid).join(',');
|
||||
const hashMap: HashMap<string, string> = new HashMap()
|
||||
hashMap.set('group_uuid',uuidString)
|
||||
hashMap.set('patient_uuid',this.params.patientUuid)
|
||||
hdHttp.httpReq<string>(BasicConstant.patientCardUpdateGroup,hashMap).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
logger.info('Response patientCardUpdateGroup'+res);
|
||||
let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>;
|
||||
if(json.code == '200') {
|
||||
router.back()
|
||||
} 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 })
|
||||
HdNav({ title: '分组管理', showRightIcon: false, hasBorder: true, rightText: '保存', showRightText: true, rightItemAction:()=>{
|
||||
this.saveGroupNameAction()
|
||||
} })
|
||||
// 已选分组
|
||||
Row() {
|
||||
Flex({ justifyContent: FlexAlign.Start, wrap: FlexWrap.Wrap }) {
|
||||
|
||||
@@ -149,43 +149,43 @@ export struct PatientDetailsComp {
|
||||
}
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
HdNav({
|
||||
title: '患者详情',
|
||||
showRightIcon: true,
|
||||
hasBorder: true,
|
||||
rightIcon:$r("app.media.patient_details_navigation_right"),
|
||||
showRightText: false,
|
||||
rightItemAction: () => {
|
||||
router.pushUrl({
|
||||
url: 'pages/PatientsPage/BuildOrEditGroupPage',
|
||||
params:{"title":"新建分组"}
|
||||
})
|
||||
}
|
||||
})
|
||||
Scroll(this.scroller){
|
||||
Column(){
|
||||
this.patientsView()
|
||||
this.otherMsgView()
|
||||
this.historyView()
|
||||
if (this.patientCase.length > 0) {
|
||||
this.patientCaseView()
|
||||
Row() {
|
||||
Column() {
|
||||
HdNav({
|
||||
title: '患者详情',
|
||||
showRightIcon: true,
|
||||
hasBorder: true,
|
||||
rightIcon: $r("app.media.patient_details_navigation_right"),
|
||||
showRightText: false,
|
||||
rightItemAction: () => {
|
||||
router.pushUrl({
|
||||
url: 'pages/PatientsPage/BuildOrEditGroupPage',
|
||||
params: { "title": "新建分组" }
|
||||
})
|
||||
}
|
||||
this.footerView()
|
||||
})
|
||||
Scroll(this.scroller) {
|
||||
Column() {
|
||||
this.patientsView()
|
||||
this.otherMsgView()
|
||||
this.historyView()
|
||||
if (this.patientCase.length > 0) {
|
||||
this.patientCaseView()
|
||||
}
|
||||
this.footerView()
|
||||
}
|
||||
.width('100%')
|
||||
.justifyContent(FlexAlign.Start)
|
||||
}
|
||||
.width('100%')
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.height('calc(100% - 56vp)')
|
||||
.backgroundColor('#f4f4f4')
|
||||
.scrollBar(BarState.Off)
|
||||
.align(Alignment.TopStart)
|
||||
}
|
||||
.width('100%')
|
||||
.height('calc(100% - 56vp)')
|
||||
.backgroundColor('#f4f4f4')
|
||||
.scrollBar(BarState.Off)
|
||||
.align(Alignment.TopStart)
|
||||
.width('100%').height('100%')
|
||||
}
|
||||
.width('100%').height('100%')
|
||||
}
|
||||
.height('100%')
|
||||
.height('100%')
|
||||
}
|
||||
|
||||
@Builder
|
||||
|
||||
@@ -20,6 +20,7 @@ interface paramsCallData {
|
||||
|
||||
@Component
|
||||
export struct PatientSetMsgPage {
|
||||
pageStack:NavPathStack = new NavPathStack()
|
||||
@State params:paramsCallData = router.getParams() as paramsCallData
|
||||
@State noteName: string | undefined = ChangeUtil.stringIsUndefinedAndNull(this.params.model.nickname)?'':String(this.params.model.nickname)
|
||||
@State contentFrist:string | undefined = ''
|
||||
@@ -36,6 +37,7 @@ export struct PatientSetMsgPage {
|
||||
})
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.pageStack.getParamByName('PatientSetMsgPage')
|
||||
this.contentFrist = getFirstSegment(this.params.model.content)
|
||||
}
|
||||
|
||||
@@ -141,7 +143,7 @@ export struct PatientSetMsgPage {
|
||||
.onClick(()=>{
|
||||
router.pushUrl({
|
||||
url:'pages/PatientsPage/GroupManagementPage',
|
||||
params:{groupNames:this.params.model.groupType,groupUuids:this.params.model.groupUuid}
|
||||
params:{groupNames:this.params.model.groupType,groupUuids:this.params.model.groupUuid,patientUuid:this.params.model.patientUuid}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user