出诊计划相关

This commit is contained in:
XiuYun CHEN
2025-07-30 16:22:38 +08:00
parent 0d7ddb5854
commit 1e99ff4dfa
23 changed files with 1028 additions and 190 deletions
@@ -3,7 +3,7 @@ import { HdNav,EmptyViewComp, authStore, HdLoadingDialog, hdHttp, BasicConstant,
HdResponse,
ChangeUtil} from "@itcast/basic";
import { PullToRefreshLayout, RefreshController } from "refreshlib";
import { promptAction } from "@kit.ArkUI";
import { promptAction, router } from "@kit.ArkUI";
import { BusinessError } from "@kit.BasicServicesKit";
import { it } from "@ohos/hypium";
@@ -18,6 +18,11 @@ export struct FollowPlanListComp {
public controller:RefreshController = new RefreshController()
@State isShowAddPlan:boolean = false
@State uuid:string=this.params?this.params.FollowUpUuid?this.params.FollowUpUuid:'':''
@State patientUuid:string=this.params?this.params.patient_uuid?this.params.patient_uuid:'':''
@State nickname:string=this.params?this.params.nickname?this.params.nickname:'':''
@State realName:string=this.params?this.params.realName?this.params.realName:'':''
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
@@ -29,11 +34,21 @@ export struct FollowPlanListComp {
}
getFollowListData() {
const entity = {
let entity = {
"expert_uuid": authStore.getUser().uuid,
"patient_uuid": this.params.patient_uuid,
"page":this.pageNumber.toString()
} as Record<string,string>
if(this.patientUuid!='')
{
entity = {
"expert_uuid": authStore.getUser().uuid,
"patient_uuid": this.params.patient_uuid,
"page":this.pageNumber.toString()
} as Record<string,string>
}
this.dialog.open()
hdHttp.post<string>(BasicConstant.followUpList, entity).then(async (res: HdResponse<string>) => {
this.dialog.close();
@@ -88,7 +103,15 @@ export struct FollowPlanListComp {
HdNav({title:'随访计划',isLeftAction:true,rightText:'添加',showRightText:true,showRightIcon:false,rightItemAction:()=>{
this.isShowAddPlan = !this.isShowAddPlan
},leftItemAction:()=>{
HMRouterMgr.pop()
if(this.patientUuid=='')
{
router.back()
}
else
{
HMRouterMgr.pop()
}
}})
PullToRefreshLayout({
@@ -230,10 +253,10 @@ export struct FollowPlanListComp {
HMRouterMgr.push({
pageUrl:'AddScheduleFollowComp',
param:{
"uuid":this.params.FollowUpUuid,
"patientUuid":this.params.patient_uuid,
"nickname":this.params.nickname,
"realName":this.params.realName
"uuid":this.uuid,
"patientUuid":this.patientUuid,
"nickname":this.nickname,
"realName":this.realName
}},{
onResult:(popInfo:HMPopInfo)=>{
if (popInfo && popInfo.result && popInfo.result["isRefresh"] !== undefined) {
@@ -263,10 +286,10 @@ export struct FollowPlanListComp {
HMRouterMgr.push({
pageUrl:'AddFollowPlanComp',
param:{
"uuid":this.params.FollowUpUuid,
"patientUuid":this.params.patient_uuid,
"nickname":this.params.nickname,
"realName":this.params.realName
"uuid":this.uuid,
"patientUuid":this.patientUuid,
"nickname":this.nickname,
"realName":this.realName
}},{
onResult:(popInfo:HMPopInfo)=>{
if (popInfo && popInfo.result && popInfo.result["isRefresh"] !== undefined) {
@@ -0,0 +1,209 @@
import { HdNav, EmptyViewComp,HdLoadingDialog, authStore } from '@itcast/basic';
import { promptAction } from '@kit.ArkUI'
import { BasicConstant,hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
import { BusinessError } from '@kit.BasicServicesKit';
import HashMap from '@ohos.util.HashMap'
import { patientListModel } from '../models/PatientsGroupModel'
import { HMPopInfo, HMRouter, HMRouterMgr } from "@hadss/hmrouter"
@HMRouter({ pageUrl: 'PatientsListSearchComp' })
@Component
export struct PatientsListSearchComp {
private params: ESObject = HMRouterMgr.getCurrentParam()
// @State params:Record<string, string | patientListModel[]> = router.getParams() as Record<string, string | patientListModel[]>
@State patientsArray:patientListModel[] = []
@State patientsList:patientListModel[] = []
@State inputString:string = ''
@State naviRightTitle:string = '确定(0)'
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
aboutToAppear(): void {
const groupPatientsList = this.params?.selectedPatients as patientListModel[] | undefined
if (groupPatientsList?.length) {
this.getPatientsListData()
} else {
this.getAllPatientsListData()
}
}
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
getPatientsListData() {
const hashMap: HashMap<string, string> = new HashMap()
hashMap.set('group_uuid',this.params.group_uuid)
this.dialog.open()
hdHttp.httpReq<string>(BasicConstant.patientListNoInThisGroup,hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close()
logger.info('Response patientListNoInThisGroup'+res)
let json:Record<string,string | patientListModel[]> = JSON.parse(res+'') as Record<string,string | patientListModel[]>
if(json.code == '1') {
const patientsList = this.params?.selectedPatients as patientListModel[] | undefined
if (patientsList?.length) {
const uuidSet = new Set(patientsList.map(item => item.uuid))
const dataArray = json.data as patientListModel[];
for (const model of dataArray) {
if (!uuidSet.has(model.uuid)) {
this.patientsList.push(model)
this.patientsArray.push(model)
}
}
} else {
this.patientsList = json.data as patientListModel[];
this.patientsArray = json.data as patientListModel[];
}
this.isEmptyViewVisible = this.patientsList.length>0?false:true
} else {
console.error('分组患者列表失败:'+json.message)
promptAction.showToast({ message: String(json.message), duration: 1000 })
}
}).catch((err: BusinessError) => {
this.dialog.close();
console.info(`Response fails: ${err}`);
})
}
getAllPatientsListData() {
this.dialog.open()
hdHttp.post<string>(BasicConstant.patientList, {
"expertUuid": authStore.getUser().uuid
} as Record<string,string>).then(async (res: HdResponse<string>) => {
this.dialog.close()
logger.info('Response patientList'+res)
let json:Record<string,string | patientListModel[]> = JSON.parse(res+'') as Record<string,string | patientListModel[]>
if(json.code == '1') {
this.patientsList = json.data as patientListModel[];
this.patientsArray = json.data as patientListModel[];
} else {
console.error('患者列表失败:'+json.message)
promptAction.showToast({ message: String(json.message), duration: 1000 })
}
}).catch((err: BusinessError) => {
this.dialog.close();
console.error(`Response fails: ${err}`);
})
}
searchPatientAction(){
if (this.inputString.length > 0) {
this.patientsList = []
for (const model of this.patientsArray) {
if (model.realname?.includes(this.inputString) || model.mobile?.includes(this.inputString) || model.nickname?.includes(this.inputString)) {
this.patientsList.push(model)
}
}
} else {
this.patientsList = this.patientsArray
}
this.isEmptyViewVisible = this.patientsList.length>0?false:true
}
build() {
Column() {
HdNav({showLeftIcon:true,title:'搜索患者',showRightText:false,rightTextColor:Color.White,rightBackColor:$r('app.color.main_color'),showRightIcon:false,
isLeftAction:true,
leftItemAction:()=>{
HMRouterMgr.pop()
}})
Row(){
Row(){
TextInput({placeholder:'搜索患者的备注名、昵称或手机号'})
.fontSize(15)
.backgroundColor(Color.White)
.layoutWeight(1)
.onChange((value:string)=>{
this.inputString = value
})
.onSubmit(()=>{
this.searchPatientAction()
})
Blank()
.width(0.5)
.height(20)
.backgroundColor($r('app.color.main_color'))
Image($r('app.media.selected_hospital_ws'))
.width(30)
.height(30)
.margin({left:10,right:10})
.onClick(()=>{
this.searchPatientAction()
})
}
.width('95%')
.height(50)
.borderRadius(5)
.borderWidth(1)
.margin({left:10})
.borderColor($r('app.color.main_color'))
}
.backgroundColor(Color.White)
.width('100%')
.height(70)
if (this.isEmptyViewVisible) {
EmptyViewComp({promptText:'无搜索结果',isVisibility:this.isEmptyViewVisible})
.width('100%')
.height('calc(100% - 56vp - 70vp)')
} else {
List(){
ForEach(this.patientsList,(model:patientListModel)=>{
ListItem() {
this.patientListItem(model)
}
})
}
.width('100%')
.height('calc(100% - 56vp - 70vp)')
.backgroundColor('#f4f4f4')
.scrollBar(BarState.Off)
}
}
.width('100%')
.height('calc(100% - 56vp)')
.backgroundColor('#f4f4f4')
.justifyContent(FlexAlign.Start)
}
@Builder
patientListItem(item:patientListModel) {
Column() {
Row() {
Image(BasicConstant.urlImage + item.photo)
.alt($r('app.media.userPhoto_default'))
.borderRadius(6)
.width(50)
.height(50)
.margin({ left: 15 })
Text(item.nickname ? item.nickname : item.realname?item.realname:item.realName)
.fontSize(16)
.fontColor('#333333')
.margin({ left: 15 })
Blank()
// Image(item.isSelected?$r('app.media.patiemts_list_selected'):$r('app.media.patients_list_noSelect'))
// .width(22).height(22)
// .objectFit(ImageFit.Fill)
// .margin({ right: 15 })
}
.width('100%')
.height(80)
.backgroundColor(Color.White)
.onClick(()=>{
HMRouterMgr.push({pageUrl:'PatientDetailsComp',param:{"patient_uuid":item.uuid}})
// item.isSelected = !item.isSelected;
// this.patientsList = [...this.patientsList];
// const selectedNum = this.patientsList.filter(item => item.isSelected == true).length;
// this.naviRightTitle = '确定('+selectedNum+')'
})
Blank()
.width('80%')
.height(1)
.backgroundColor('#f4f4f4')
.margin({left:60})
}
}
}