出诊计划相关

This commit is contained in:
XiuYun CHEN 2025-07-30 09:15:14 +08:00
parent b8a894d47d
commit f73ed8ccad

View File

@ -0,0 +1,277 @@
import { hdHttp, HdResponse, BasicConstant, ExpertData, authStore, BaseBean, HdLoadingDialog,
TimestampUtil,
preferenceStore,
EmptyViewComp} from '@itcast/basic'
import { BusinessError } from '@kit.BasicServicesKit';
import promptAction from '@ohos.promptAction';
import { HdNav ,DatePickerDialog} from '@itcast/basic';
import { LengthMetrics, router } from '@kit.ArkUI';
import { HMRouter, HMRouterMgr } from '@hadss/hmrouter';
import { HashMap } from '@kit.ArkTS';
import { StringIsEmpty } from '@nimkit/common';
import { DateListBean } from '../model/StopOutPatientListModel';
import { data } from '@kit.TelephonyKit';
import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet';
import { ListOut, ListWorkPlaceBean } from '../model/ListOutPatientModel';
@HMRouter({ pageUrl: 'Practicelocation' })
@Component
export struct Practicelocation {
@State data: ListOut[] = [];
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
@State deleteUuid:string=''
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
getList() {
this.dialog.open()
const hashMap: HashMap<string, string> = new HashMap();
hdHttp.httpReq<string>(BasicConstant.listWorkPlace, hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close();
let json: ListWorkPlaceBean = JSON.parse(res + '') as ListWorkPlaceBean;
if (json.code == '200') {
this.data = []
if (json.list != null) {
this.data = json.list;
}
if (this.data.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
} else {
promptAction.showToast({ message: json.message, duration: 1000 })
}
}).catch((err: BusinessError) => {
this.dialog.close();
console.info(`Response fails: ${err}`);
})
}
deleteWorkPlace() {
this.dialog.open()
const hashMap: HashMap<string, string> = new HashMap();
hashMap.set('uuid',this.deleteUuid)
hdHttp.httpReq<string>(BasicConstant.deleteWorkPlace,hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close();
let json:BaseBean = JSON.parse(res+'') as BaseBean;
if(json.code == '200') {
this.getList();
} else {
promptAction.showToast({ message: json.message, duration: 1000 })
}
}).catch((err: BusinessError) => {
this.dialog.close();
console.info(`Response fails: ${err}`);
})
}
private dialogs!:CustomDialogController;
@State inputPlaceholder:string='您确定删除此条信息吗'
initDialog() {
this.dialogs = new CustomDialogController({
builder:PerfactInputSheet({
controller:this.dialog,
inputTitle:'删除提示',
inputPlaceholder:this.inputPlaceholder,
style:'2',
okText:'确定',
okColor:$r('app.color.top_title'),
inputCallBack:(input: string,title:string)=>{
this.deleteWorkPlace()
}
}),
keyboardAvoidDistance: LengthMetrics.vp(0), // 设置弹窗底部与键盘顶部间距单位vp
alignment: DialogAlignment.Center,
customStyle: true,
autoCancel: false,
backgroundColor: ('rgba(0,0,0,0.5)'),
height: '100%'
})
}
aboutToAppear(): void {
this.getList()
this.initDialog()
}
build() {
Column() {
HdNav({
title: '执业地点管理',
showRightIcon: false,
hasBorder: true,
isLeftAction: true,
leftItemAction: () => {
HMRouterMgr.pop()
}
})
Text().height(10).width('100%').backgroundColor($r('app.color.home_gray'))
if (this.isEmptyViewVisible){
EmptyViewComp({promptText:'暂无执业地点',isVisibility:this.isEmptyViewVisible}).layoutWeight(1)
}
else {
Column() {
List() {
ForEach(this.data, (item: ListOut, index) => {
ListItem() {
Column()
{
Column() {
Text(item.hospital_name)
.fontColor($r('app.color.common_gray_01'))
.fontSize(18)
.margin({ top: 10 })
Text(item.office_name)
.fontColor($r('app.color.common_gray_03'))
.fontSize(14)
.margin({ top: 10 })
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap, space: { cross: LengthMetrics.vp(10) } }) {
Text(item.location)
.fontColor($r('app.color.common_gray_03'))
.fontSize(14)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.ellipsisMode(EllipsisMode.END)
.padding({ right: 3 })
Text(this.getoutpatientType(item.type))
.fontSize(12)
.borderColor($r('app.color.top_title'))
.fontColor($r('app.color.top_title'))
.borderRadius(8)
.borderWidth(1)
.padding({
left: 4,
right: 4,
top: 2,
bottom: 2
})
}
.margin({ top: 10 })
}
.onClick(()=>{
})
.width('95%')
.margin({left:10,right:10})
.padding({ left: 10, right: 10, bottom: 10 })
.alignItems(HorizontalAlign.Start)
.borderRadius(4)
.backgroundColor(Color.White)
Row()
{
Blank()
Row()
{
Image($r('app.media.edit_icon')).width(15).height(15).margin({right:5})
Text('编辑')
.fontColor($r('app.color.common_gray_01'))
.fontSize(14)
}
.margin({right:30})
Row()
{
Image($r('app.media.delete_icon')).width(15).height(15).margin({right:5})
Text('删除')
.fontColor($r('app.color.common_gray_01'))
.fontSize(14)
}
.onClick(()=>{
this.deleteUuid=item.uuid
this.dialogs.open()
})
}.width('95%')
.margin({left:10,right:10})
.padding(10)
.backgroundColor(Color.White)
.margin({top:2})
.borderRadius(4)
}
}
})
}
.divider({
strokeWidth: 5,
})
.edgeEffect(EdgeEffect.None)
.clip(true)
}
.width('100%')
.layoutWeight(1)
}
Column() {
Text('新增执业地点')
.height(42)
.width(168)
.fontSize(17)
.backgroundColor($r('app.color.top_title'))
.fontColor($r('app.color.white'))
.textAlign(TextAlign.Center)
.borderRadius(4)
.margin({ top: 8 })
}
.width('100%')
.height(57)
.backgroundColor(Color.White)
.onClick(() => {
HMRouterMgr.push({ pageUrl: 'AddLocation' })
})
}
.width('100%')
.height('100%')
.backgroundColor($r('app.color.home_gray'))
}
getoutpatientType(type:number)
{
switch (type)
{
case 1:
return '普通门诊'
break
case 2:
return '专家门诊'
break
case 3:
return '特需门诊'
break
case 4:
return '专科/专病门诊'
break
}
return ''
}
}