首页、患者分组、审核、列表等
@@ -0,0 +1,304 @@
|
||||
import { authStore, HdNav, PositionSelectedSheet } from '@itcast/basic';
|
||||
import { promptAction, router } from '@kit.ArkUI'
|
||||
import { HdLoadingDialog,DefaultHintProWindows } from '@itcast/basic'
|
||||
import { BasicConstant,hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { patientListModel } from '../models/PatientsGroupModel'
|
||||
|
||||
@Component
|
||||
export struct BuildOrEditGroupPage {
|
||||
@State params:Record<string, string> = router.getParams() as Record<string, string>
|
||||
scrollerCon:Scroller = new Scroller()
|
||||
@State groupPatientList:patientListModel[] = []
|
||||
@State groupName:string = ''
|
||||
private hintWindowDialog!: CustomDialogController
|
||||
@Consume@Watch('onRefreshAction') refreshFlag: boolean;
|
||||
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center
|
||||
})
|
||||
|
||||
private hintPopWindowDialog() {
|
||||
this.hintWindowDialog = new CustomDialogController({
|
||||
builder:DefaultHintProWindows({
|
||||
controller:this.hintWindowDialog,
|
||||
message:'确定删除该分组',
|
||||
cancleTitleColor: '#333333',
|
||||
confirmTitleColor: '#333333',
|
||||
selectedButton: (index:number)=>{
|
||||
if (index === 1) {
|
||||
this.deleGroupAction()
|
||||
}
|
||||
this.hintWindowDialog.close();
|
||||
}
|
||||
}),
|
||||
alignment: DialogAlignment.Center,
|
||||
cornerRadius:24,
|
||||
backgroundColor: ('rgba(0,0,0,0.5)'),
|
||||
})
|
||||
}
|
||||
|
||||
onRefreshAction(flag: boolean) {
|
||||
const returnParams = this.getUIContext().getRouter().getParams() as Record<string, string | patientListModel[]>;
|
||||
const patients = returnParams?.selectedPatients as patientListModel[] | undefined;
|
||||
if (patients?.length) {
|
||||
for (const model of returnParams.selectedPatients as patientListModel[]) {
|
||||
if (model.isSelected) {
|
||||
this.groupPatientList.push(model)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aboutToAppear(): void {
|
||||
if (this.params.title != '新建分组') {
|
||||
this.getGroupPatientsData()
|
||||
}
|
||||
this.hintPopWindowDialog()
|
||||
}
|
||||
|
||||
getGroupPatientsData() {
|
||||
this.dialog.open()
|
||||
hdHttp.post<string>(BasicConstant.patientListByGroup, {
|
||||
"expert_uuid": authStore.getUser().uuid,
|
||||
"group_uuid":this.params.group_uuid
|
||||
} as Record<string,string>).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
logger.info('Response patientListByGroup'+res);
|
||||
let json:Record<string,string | patientListModel[]> = JSON.parse(res+'') as Record<string,string | patientListModel[]>;
|
||||
if(json.code == '1') {
|
||||
this.groupPatientList = 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}`);
|
||||
})
|
||||
}
|
||||
|
||||
deleGroupAction() {
|
||||
this.dialog.open()
|
||||
hdHttp.post<string>(BasicConstant.deleteGroup, {
|
||||
"expert_uuid": authStore.getUser().uuid,
|
||||
"group_uuid":this.params.group_uuid
|
||||
} as Record<string,string>).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
logger.info('Response patientListByGroup'+res);
|
||||
let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>;
|
||||
if(json.code == '1') {
|
||||
promptAction.showToast({ message: '删除分组成功', duration: 1000 })
|
||||
router.back();
|
||||
} else {
|
||||
console.error('删除患者分组列表失败:'+json.message)
|
||||
promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close();
|
||||
console.error(`Response fails: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
setCreatOrEditGroup(index:number) {
|
||||
if (this.groupName.length <= 0) {
|
||||
promptAction.showToast({ message: '请输入分组名称', duration: 1000 })
|
||||
return
|
||||
}
|
||||
const uuidString:string = this.groupPatientList.map(item => item.uuid).join(",");
|
||||
this.dialog.open()
|
||||
hdHttp.post<string>(index == 0 ? BasicConstant.addGroup:BasicConstant.updateGroup, index == 0 ? {
|
||||
"expert_uuid": authStore.getUser().uuid,
|
||||
"name":this.groupName,
|
||||
"patient_uuid":uuidString
|
||||
} as Record<string,string> : {
|
||||
"uuid": this.params.group_uuid,
|
||||
"name":this.groupName,
|
||||
"patient_uuid":uuidString
|
||||
} as Record<string,string>).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
logger.info('Response patientListByGroup'+res);
|
||||
let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>;
|
||||
if(json.code == '1') {
|
||||
promptAction.showToast({ message:'分组成功', duration: 1000 })
|
||||
router.back();
|
||||
} else if (json.code == '2') {
|
||||
promptAction.showToast({ message:'该分组已存在', duration: 1000 })
|
||||
} else {
|
||||
console.error('删除患者分组列表失败:'+json.message)
|
||||
promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close();
|
||||
console.error(`Response fails: ${err}`);
|
||||
})
|
||||
|
||||
|
||||
// const postContent = new rcp.MultipartForm({
|
||||
// "uuid": this.params.group_uuid,
|
||||
// "name":this.groupName,
|
||||
// "patient_uuid":uuidString
|
||||
// })
|
||||
// const session = rcp.createSession();
|
||||
// session.post(BasicConstant.updateGroup, postContent)
|
||||
// .then((response) => {
|
||||
// this.dialog.close();
|
||||
// logger.info('Response patientListByGroup'+response);
|
||||
// let json:Record<string,string> = JSON.parse(response+'') as Record<string,string>;
|
||||
// if(json.code == '1') {
|
||||
// promptAction.showToast({ message:'分组成功', duration: 1000 })
|
||||
// router.back();
|
||||
// } else if (json.code == '2') {
|
||||
// promptAction.showToast({ message:'该分组已存在', duration: 1000 })
|
||||
// } else {
|
||||
// console.error('删除患者分组列表失败:'+json.message)
|
||||
// promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
// }
|
||||
// })
|
||||
// .catch((err: BusinessError) => {
|
||||
// this.dialog.close();
|
||||
// console.error(`Response err: Code is ${JSON.stringify(err.code)}, message is ${JSON.stringify(err)}`);
|
||||
// })
|
||||
}
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
HdNav({
|
||||
title: this.params.title,
|
||||
showRightIcon: false,
|
||||
hasBorder: true,
|
||||
rightText: '保存',
|
||||
showRightText: true,
|
||||
rightItemAction: () => {
|
||||
if (this.params.title == '新建分组') {
|
||||
this.setCreatOrEditGroup(0);
|
||||
} else {
|
||||
this.setCreatOrEditGroup(1);
|
||||
}
|
||||
}
|
||||
})
|
||||
Scroll(this.scrollerCon){
|
||||
Column() {
|
||||
Text('分组名称')
|
||||
.fontSize(15)
|
||||
.fontColor('#333333')
|
||||
.margin({ left: 15 })
|
||||
.height(50)
|
||||
.textAlign(TextAlign.Start)
|
||||
|
||||
TextInput({placeholder:'设置分组名称',text:this.params.group_name})
|
||||
.padding({left:15})
|
||||
.width('100%')
|
||||
.height(50)
|
||||
.backgroundColor(Color.White)
|
||||
.onChange((input:string)=>{
|
||||
this.groupName = input;
|
||||
})
|
||||
|
||||
Text('分组成员')
|
||||
.fontSize(15)
|
||||
.fontColor('#333333')
|
||||
.margin({ left: 15 })
|
||||
.height(50)
|
||||
.textAlign(TextAlign.Start)
|
||||
|
||||
Row(){
|
||||
Image($r('app.media.add_patients_to_roup'))
|
||||
.width(50).height(50)
|
||||
.margin({left:15})
|
||||
|
||||
Text('添加组患者')
|
||||
.fontSize(16)
|
||||
.fontColor('#333333')
|
||||
.margin({left:15})
|
||||
}
|
||||
.width('100%')
|
||||
.height(80)
|
||||
.backgroundColor(Color.White)
|
||||
.onClick(()=>{
|
||||
router.pushUrl({
|
||||
url:'pages/PatientsPage/PatientsListPage',
|
||||
params:{group_uuid:this.params.group_uuid,selectedPatients:this.groupPatientList}
|
||||
})
|
||||
})
|
||||
|
||||
List(){
|
||||
ListItemGroup({footer:this.footerView()}) {
|
||||
ForEach(this.groupPatientList,(item:patientListModel,index:number)=>{
|
||||
ListItem(){
|
||||
this.patientsListItem(item,index)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}.width('100%').alignItems(HorizontalAlign.Start).justifyContent(FlexAlign.Start)
|
||||
}
|
||||
.width('100%').height('calc(100% - 56vp - 55vp)')
|
||||
.scrollBar(BarState.Off)
|
||||
.backgroundColor('#f4f4f4')
|
||||
.align(Alignment.TopStart)
|
||||
}
|
||||
.width('100%').height('100%')
|
||||
}
|
||||
.height('100%')
|
||||
}
|
||||
|
||||
@Builder
|
||||
footerView (){
|
||||
Column() {
|
||||
Text('删除分组')
|
||||
.fontSize(16)
|
||||
.fontColor(Color.White)
|
||||
.backgroundColor($r('app.color.main_color'))
|
||||
.borderRadius(5)
|
||||
.height(50)
|
||||
.textAlign(TextAlign.Center)
|
||||
.width('90%')
|
||||
.onClick(()=>{
|
||||
this.hintWindowDialog.open();
|
||||
})
|
||||
.visibility(this.params.title == '新建分组'?Visibility.Hidden:Visibility.Visible)
|
||||
}.width('100%')
|
||||
.height(120)
|
||||
.justifyContent(FlexAlign.End)
|
||||
}
|
||||
|
||||
@Builder
|
||||
patientsListItem(item:patientListModel,index:number) {
|
||||
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)
|
||||
.fontSize(16)
|
||||
.fontColor('#333333')
|
||||
.margin({ left: 15 })
|
||||
Blank()
|
||||
Image($r('app.media.dele_patient_inThe_group'))
|
||||
.width(22).height(22)
|
||||
.objectFit(ImageFit.Fill)
|
||||
.margin({ right: 15 })
|
||||
.onClick(()=>{
|
||||
this.groupPatientList.splice(index,1);
|
||||
this.groupPatientList = [...this.groupPatientList];
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.height(80)
|
||||
.backgroundColor(Color.White)
|
||||
Blank()
|
||||
.width('80%')
|
||||
.height(1)
|
||||
.backgroundColor(Color.Gray)
|
||||
.margin({left:60})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
@Component
|
||||
export struct MainPage {
|
||||
@State message: string = 'Hello World';
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
Text(this.message)
|
||||
.fontSize($r('app.float.page_text_font_size'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.onClick(() => {
|
||||
this.message = 'Welcome';
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
}
|
||||
.height('100%')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
import { ApplyViews } from '../views/ApplyViews'
|
||||
import { authStore, HdNav } from '@itcast/basic';
|
||||
import { applyListCallBacl,applyListModel,applyHistoryCallBacl,historyModel } from '../models/ApplyModel'
|
||||
import HashMap from '@ohos.util.HashMap';
|
||||
import { HdLoadingDialog } from '@itcast/basic'
|
||||
import { BasicConstant,hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { promptAction, router } from '@kit.ArkUI'
|
||||
import { patientDbManager, PatientData } from '@itcast/basic';
|
||||
import { PullToRefreshLayout, RefreshController } from 'refreshlib'
|
||||
|
||||
interface extraData {
|
||||
expertUuid: string,
|
||||
page: number,
|
||||
uuid: string,
|
||||
status: string
|
||||
}
|
||||
|
||||
@Component
|
||||
export struct PatientApplyPage {
|
||||
public controller:RefreshController = new RefreshController();
|
||||
scroller = new Scroller();
|
||||
@State applyArray:applyListModel[] = [];
|
||||
@State historyArray:historyModel[] = [];
|
||||
@State pageNumber:number = 1;
|
||||
@State totalPageNumer:number = 1;
|
||||
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center
|
||||
})
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.getApplyList();
|
||||
this.getHistoryApplyList();
|
||||
}
|
||||
|
||||
getHistoryApplyList() {
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
hashMap.set('page',this.pageNumber.toString());
|
||||
this.dialog.open()
|
||||
hdHttp.httpReq<string>(BasicConstant.relationRecordLately,hashMap).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
this.controller.refreshSuccess();
|
||||
this.controller.loadSuccess();
|
||||
logger.info('Response relationRecordLately'+res);
|
||||
let json:applyHistoryCallBacl = JSON.parse(res+'') as applyHistoryCallBacl;
|
||||
if(json.code == 200) {
|
||||
this.historyArray = json.data.list;
|
||||
this.totalPageNumer = Number(json.data.total);
|
||||
} else {
|
||||
console.error('患者申请记录列表失败:'+json.message)
|
||||
promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close();
|
||||
this.controller.refreshError();
|
||||
console.info(`Response fails: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
getApplyList() {
|
||||
this.dialog.open()
|
||||
hdHttp.post<string>(BasicConstant.applyList, {
|
||||
expertUuid: authStore.getUser().uuid,
|
||||
} as extraData).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
this.controller.refreshSuccess();
|
||||
this.controller.loadSuccess();
|
||||
logger.info('Response applyList'+res);
|
||||
let json:applyListCallBacl = JSON.parse(res+'') as applyListCallBacl;
|
||||
if(json.code == 1) {
|
||||
this.applyArray = json.data;
|
||||
} else {
|
||||
console.error('新的患者列表失败:'+json.message)
|
||||
promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close();
|
||||
this.controller.refreshError();
|
||||
console.info(`Response fails: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
getApplyListOperate(status: string,model:applyListModel) {
|
||||
this.dialog.open()
|
||||
hdHttp.post<string>(BasicConstant.applyListOperate, {
|
||||
uuid: model.uuid,
|
||||
status: status
|
||||
} as extraData).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
logger.info('Response applyListOperate'+res);
|
||||
let json:applyListCallBacl = JSON.parse(res+'') as applyListCallBacl;
|
||||
if(json.code == 1) {
|
||||
if (status == '2') {
|
||||
this.getApplyList();
|
||||
// 添加单个患者
|
||||
const singlePatient: PatientData = {
|
||||
uuid:model.patientUuid as string,
|
||||
nickname: '',
|
||||
mobile: model.mobile as string,
|
||||
realName: model.realName as string,
|
||||
nation: '',
|
||||
sex: model.sex as number,
|
||||
type: 1,
|
||||
photo: model.photo as string,
|
||||
expertUuid: authStore.getUser().uuid
|
||||
};
|
||||
const success1 = await patientDbManager.addPatient(singlePatient);
|
||||
if (success1) {
|
||||
console.info('添加成功');
|
||||
const patients = await patientDbManager.getAllPatients();
|
||||
promptAction.showToast({message:`现在一共是 ${patients.length} 个患者`})
|
||||
} else {
|
||||
console.info('添加失败');
|
||||
}
|
||||
promptAction.showToast({ message: '消息已处理', duration: 1000 })
|
||||
router.pushUrl({
|
||||
url:'pages/PatientsPage/PatientMsgSetPage',
|
||||
params:{ 'model':model }
|
||||
})
|
||||
} else if (status == '3') {
|
||||
this.pageNumber = 1;
|
||||
this.getApplyList();
|
||||
this.getHistoryApplyList();
|
||||
}
|
||||
} 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 })
|
||||
PullToRefreshLayout({
|
||||
scroller:this.scroller,
|
||||
viewKey:"ListPage",
|
||||
controller:this.controller,
|
||||
contentView:()=>{
|
||||
this.contentView()
|
||||
},
|
||||
onRefresh:()=>{
|
||||
this.pageNumber = 1;
|
||||
this.getApplyList();
|
||||
this.getHistoryApplyList();
|
||||
},
|
||||
onCanPullRefresh:()=>{
|
||||
if (!this.scroller.currentOffset()) {
|
||||
/*处理无数据,为空的情况*/
|
||||
return true
|
||||
}
|
||||
//如果列表到顶,返回true,表示可以下拉,返回false,表示无法下拉
|
||||
return this.scroller.currentOffset().yOffset <= 0
|
||||
},
|
||||
onLoad:()=>{
|
||||
this.pageNumber++;
|
||||
this.getApplyList();
|
||||
this.getHistoryApplyList();
|
||||
},
|
||||
onCanPullLoad: () => {
|
||||
if (this.pageNumber >= this.totalPageNumer) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}).width('100%').height('calc(100% - 156vp)').clip(true)
|
||||
|
||||
Row(){
|
||||
Text('加患者')
|
||||
.fontSize(16)
|
||||
.fontColor(Color.White)
|
||||
.backgroundColor('rgb(63,199,193)')
|
||||
.width('100%').height(50).textAlign(TextAlign.Center)
|
||||
.onClick(()=>{
|
||||
router.pushUrl({
|
||||
url: 'pages/WebView/WebPage', // 目标url
|
||||
params: {url:BasicConstant.wxUrl+'expert/expertcodeimg?expert_uuid='+authStore.getUser().uuid,title:'我的二维码'}
|
||||
})
|
||||
})
|
||||
}.width('100%').height(56).backgroundColor(Color.White).alignItems(VerticalAlign.Top)
|
||||
}.width('100%').height('100%')
|
||||
}
|
||||
|
||||
@Builder
|
||||
contentView(){
|
||||
Column(){
|
||||
Row({space:5}){
|
||||
Image($r('app.media.addPatientApply_reminder_icon'))
|
||||
.width(18).height(21)
|
||||
Text('提醒: 为了避免不必要的纠纷,请您务必选择线下就诊过的患者')
|
||||
.fontSize(16).fontColor('#666666')
|
||||
}.width('100%').padding({left:10,top:10,right:20,bottom:10}).backgroundColor(Color.White)
|
||||
if (this.applyArray.length > 0) {
|
||||
Column(){
|
||||
Text('随访申请')
|
||||
.fontSize(15).fontColor('#333333').margin({left:10}).height(42)
|
||||
ForEach(this.applyArray,(item:applyListModel)=>{
|
||||
ApplyViews({applyItme:item,isApply:true,applyItemAction:((status: string,model:applyListModel)=>{
|
||||
this.getApplyListOperate(status,model)
|
||||
})})
|
||||
})
|
||||
}.width('100%').alignItems(HorizontalAlign.Start)
|
||||
}
|
||||
if (this.historyArray.length > 0) {
|
||||
Column(){
|
||||
Text('申请记录(近一月)')
|
||||
.fontSize(15).fontColor('#333333').margin({left:10}).height(42)
|
||||
ForEach(this.historyArray,(item:historyModel)=>{
|
||||
ApplyViews({historyItem:item,isApply:false})
|
||||
})
|
||||
}.width('100%').alignItems(HorizontalAlign.Start)
|
||||
}
|
||||
}.width('100%').height('100%').backgroundColor('#f4f4f4')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
import { authStore, HdNav, PositionSelectedSheet } from '@itcast/basic';
|
||||
import { promptAction, router } from '@kit.ArkUI'
|
||||
import { HdLoadingDialog,DefaultHintProWindows } from '@itcast/basic'
|
||||
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 measure from '@ohos.measure';
|
||||
|
||||
@Component
|
||||
export struct PatientDetailsComp {
|
||||
scroller:Scroller = new Scroller()
|
||||
@Consume@Watch('onRefreshAction') refreshFlag: boolean
|
||||
@State params:Record<string, string> = router.getParams() as Record<string, string>
|
||||
@State groupArray:Array<Record<string,string>> = []
|
||||
@State footerArray:Array<Record<string,string | ResourceStr>> = []
|
||||
@State patientCase:Array<Record<string,string>> = []
|
||||
@State patientData:Record<string,string> = {}
|
||||
@State patientData2:Record<string,string> = {}
|
||||
@State medicalHistoryContent:string = ''
|
||||
@State isExpanded: boolean = false; // 展开状态
|
||||
@State showExpandBtn: boolean = false; // 是否显示操作按钮
|
||||
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center
|
||||
})
|
||||
|
||||
onRefreshAction() {
|
||||
this.getPatientCardData()
|
||||
}
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.getPatientCardData()
|
||||
this.footerArray = [{"img":$r('app.media.sendMessage_blackBtn'),"title":"发消息"},{"img":$r('app.media.fuifangPlan_blackBtn'),"title":"制定随访计划"},{"img":$r('app.media.listBing_blackBtn'),"title":"记录病情"}]
|
||||
}
|
||||
|
||||
getPatientCardData(){
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
hashMap.set('patient_uuid',String(this.params.patient_uuid));
|
||||
this.dialog.open()
|
||||
hdHttp.httpReq<string>(BasicConstant.patientCard,hashMap).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
logger.info('Response patientCard'+res);
|
||||
let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>
|
||||
const isFriend = String(json.isFriend)
|
||||
if (isFriend == '0') {
|
||||
promptAction.showToast({ message: '随访关系已解除', duration: 1000 })
|
||||
router.back()
|
||||
} else {
|
||||
if(json.code == '200') {
|
||||
this.getPatientDetailsData(String(json.group["name"]))
|
||||
} else {
|
||||
console.error('患者详情请求失败:'+json.message)
|
||||
}
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close();
|
||||
console.info(`Response fails: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
getPatientDetailsData(groupType:string){
|
||||
this.dialog.open()
|
||||
hdHttp.post<string>(BasicConstant.toAddNickname, {
|
||||
"expertUuid": authStore.getUser().uuid,
|
||||
"patientUuid":String(this.params.patient_uuid)
|
||||
} as Record<string,string>).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
logger.info('Response toAddNickname'+res);
|
||||
let json:Record<string,string | Record<string,string>> = JSON.parse(res+'') as Record<string,string | Record<string,string>>;
|
||||
if(json.code == '1') {
|
||||
this.getPatientData()
|
||||
this.patientData = json.patientEx as Record<string,string>
|
||||
let nickname = this.patientData.nickname
|
||||
let note = this.patientData.note
|
||||
let mobile = this.patientData.mobile
|
||||
if (nickname.length>0) {
|
||||
this.groupArray = [{"title":"备注","content":String(nickname),"prompt":"给患者添加备注名"},{"title":"分组","content":String(groupType),"prompt":"通过分组给患者分类"},{"title":"描述","content":String(note),"prompt":"补充患者关键信息,方便随访患者"},{"title":"电话号码","content":String(mobile),"prompt":""}]
|
||||
} else {
|
||||
this.groupArray = [{"title":"分组","content":String(groupType),"prompt":"通过分组给患者分类"},{"title":"描述","content":String(note),"prompt":"补充患者关键信息,方便随访患者"},{"title":"电话号码","content":String(mobile),"prompt":""}]
|
||||
}
|
||||
} else {
|
||||
console.error('获取患者信息失败:'+json.message)
|
||||
promptAction.showToast({ message: String(json.message), duration: 1000 })
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close();
|
||||
console.error(`Response fails: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
getPatientData() {
|
||||
this.dialog.open()
|
||||
hdHttp.post<string>(BasicConstant.patientDetail, {
|
||||
"patientUuid":String(this.params.patient_uuid)
|
||||
} as Record<string,string>).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
logger.info('Response patientDetail'+res);
|
||||
let json:Record<string,string | Record<string,string> | Array<Record<string,string>>> = JSON.parse(res+'') as Record<string,string | Record<string,string> | Array<Record<string,string>>>;
|
||||
if(json.code == '1') {
|
||||
this.patientData2 = json.data as Record<string,string>
|
||||
this.medicalHistoryContent = String(json.medicalHistoryContent)
|
||||
this.patientCase = json.patientCase as Array<Record<string,string>>
|
||||
} else {
|
||||
console.error('获取患者信息失败:'+json.message)
|
||||
promptAction.showToast({ message: String(json.message), duration: 1000 })
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close();
|
||||
console.error(`Response fails: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
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){
|
||||
this.historyView()
|
||||
this.footerView()
|
||||
}.width('100%').height('calc(100% - 56vp)').backgroundColor('#f4f4f4')
|
||||
.scrollBar(BarState.Off)
|
||||
}
|
||||
.width('100%').height('100%')
|
||||
}
|
||||
.height('100%')
|
||||
}
|
||||
|
||||
@Builder
|
||||
historyView(){
|
||||
Column({space:10}){
|
||||
Text('患者病史')
|
||||
.fontSize(15)
|
||||
.fontColor('#333333')
|
||||
|
||||
Text(this.medicalHistoryContent)
|
||||
.fontSize(16)
|
||||
.lineHeight(22)
|
||||
.maxLines(this.isExpanded ? 0 : 2)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.onAreaChange((_, area) => {
|
||||
let fullHeight = measure.measureTextSize({
|
||||
textContent: this.medicalHistoryContent,
|
||||
fontSize: 15,
|
||||
maxLines:2
|
||||
}).height;
|
||||
this.showExpandBtn = Number(area.height) < Number(fullHeight);
|
||||
})
|
||||
// 操作按钮(独立可点击区域)
|
||||
if (this.showExpandBtn) {
|
||||
Text(this.isExpanded ? "...收起" : "..展开全部")
|
||||
.fontSize(15)
|
||||
.fontColor($r('app.color.main_color')) // 红色标识可点击
|
||||
.onClick(() => {
|
||||
this.isExpanded = !this.isExpanded; // 切换状态
|
||||
})
|
||||
}
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.backgroundColor(Color.White)
|
||||
.width('100%')
|
||||
.padding(15)
|
||||
}
|
||||
|
||||
@Builder
|
||||
footerView(){
|
||||
List(){
|
||||
ForEach(this.footerArray,(item:Record<string,string>,index:number)=>{
|
||||
ListItem(){
|
||||
Row(){
|
||||
Image(item.img)
|
||||
.width(20).height(20)
|
||||
Text(item.title)
|
||||
.fontSize(15)
|
||||
}
|
||||
.height(49)
|
||||
.width('100%')
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.backgroundColor(Color.White)
|
||||
}.width('100%').height(50)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
import { authStore, HdNav } from '@itcast/basic';
|
||||
import { applyListModel } from '../models/ApplyModel'
|
||||
import HashMap from '@ohos.util.HashMap';
|
||||
import { HdLoadingDialog } from '@itcast/basic'
|
||||
import { BasicConstant,hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { Font, promptAction, router } from '@kit.ArkUI'
|
||||
import { patientDbManager, PatientData } from '@itcast/basic';
|
||||
|
||||
interface callBackData {
|
||||
code: string,
|
||||
data: object,
|
||||
msg: string,
|
||||
message: string
|
||||
}
|
||||
|
||||
interface paramsCallData {
|
||||
model:applyListModel;
|
||||
}
|
||||
|
||||
@Component
|
||||
export struct PatientSetMsgPage {
|
||||
@State params:paramsCallData = router.getParams() as paramsCallData;
|
||||
@State noteName: string | undefined = '';
|
||||
@State contentFrist:string | undefined = '';
|
||||
@State groupName: string = '通过分组给患者分类';
|
||||
@State maxDescribe:string = '0';
|
||||
@State descibe:string = '';
|
||||
@State isNote:boolean = false;
|
||||
@State isDescibe:boolean = false;
|
||||
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center
|
||||
})
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.contentFrist = getFirstSegment(this.params.model.content)
|
||||
}
|
||||
|
||||
patientMsgSubmit(){
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
hashMap.set('patient_uuid',this.params.model.patientUuid);
|
||||
hashMap.set('nickname',this.noteName);
|
||||
hashMap.set('note',this.descibe);
|
||||
this.dialog.open()
|
||||
hdHttp.httpReq<string>(BasicConstant.updateNicknameNote,hashMap).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
logger.info('Response relationRecordLately'+res);
|
||||
let json:callBackData = JSON.parse(res+'') as callBackData;
|
||||
if(json.code == '200') {
|
||||
// 添加单个患者
|
||||
const singlePatient: PatientData = {
|
||||
uuid:this.params.model.patientUuid as string,
|
||||
nickname: this.noteName as string,
|
||||
mobile: this.params.model.mobile as string,
|
||||
realName: this.params.model.realName as string,
|
||||
nation: '',
|
||||
sex: this.params.model.sex as number,
|
||||
type: 1,
|
||||
photo: this.params.model.photo as string,
|
||||
expertUuid: authStore.getUser().uuid
|
||||
};
|
||||
const success1 = await patientDbManager.addPatient(singlePatient);
|
||||
if (success1) {
|
||||
console.info('添加成功');
|
||||
const patients = await patientDbManager.getAllPatients();
|
||||
promptAction.showToast({message:`现在一共是 ${patients.length} 个患者`})
|
||||
} else {
|
||||
console.info('添加失败');
|
||||
}
|
||||
promptAction.showToast({ message: '设置成功', duration: 1000 })
|
||||
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 })
|
||||
|
||||
Text('备注')
|
||||
.margin({left:15,top:15})
|
||||
.fontSize(15).fontColor('#333333')
|
||||
|
||||
TextInput({placeholder:'给患者添加备注名',text:this.noteName})
|
||||
.fontSize(15).fontColor('#333333').placeholderColor('#999999')
|
||||
.padding({left:10,right:10})
|
||||
.width('calc(100% - 30vp)')
|
||||
.height(50)
|
||||
.backgroundColor('#f4f4f4')
|
||||
.borderRadius(4)
|
||||
.maxLength(20)
|
||||
.margin({left:15,top:10})
|
||||
.onChange((value:string)=>{
|
||||
this.noteName = value;
|
||||
if (value.length > 0) {
|
||||
this.isNote = true;
|
||||
}else {
|
||||
this.isNote = false;
|
||||
}
|
||||
})
|
||||
|
||||
Row() {
|
||||
Text('申请消息为:'+this.contentFrist)
|
||||
.fontSize(15).fontColor('#666666')
|
||||
Text('填入')
|
||||
.fontSize(15).fontColor('#3CC7C0')
|
||||
}.justifyContent(FlexAlign.Start).margin({left:15,top:5})
|
||||
// .visibility(this.contentFrist?Visibility.Visible:Visibility.Hidden)
|
||||
.onClick(()=>{
|
||||
this.noteName = this.contentFrist?.substring(2);
|
||||
})
|
||||
|
||||
Text('分组')
|
||||
.margin({left:15,top:15})
|
||||
.fontSize(15).fontColor('#333333')
|
||||
|
||||
Row(){
|
||||
Text(this.groupName)
|
||||
.fontSize(15).fontColor(this.groupName.includes('通过分组给患者分类')?'#999999':'#333333')
|
||||
.margin({left:10})
|
||||
.layoutWeight(1)
|
||||
Image($r('sys.media.ohos_ic_public_arrow_right'))
|
||||
.width(15).height(15).margin({right:10})
|
||||
}
|
||||
.height(50)
|
||||
.width('calc(100% - 30vp)')
|
||||
.backgroundColor('#f4f4f4')
|
||||
.borderRadius(4)
|
||||
.margin({left:15,top:10})
|
||||
.onClick(()=>{
|
||||
|
||||
})
|
||||
|
||||
Text('描述')
|
||||
.margin({left:15,top:15})
|
||||
.fontSize(15).fontColor('#333333')
|
||||
|
||||
Column() {
|
||||
TextArea({ placeholder: '补充患者关键信息,方便随访患者' })
|
||||
.fontSize(15).placeholderColor('#999999')
|
||||
.fontColor('#333333')
|
||||
.backgroundColor('#f4f4f4')
|
||||
.borderRadius(4)
|
||||
.maxLength(100)
|
||||
.padding({
|
||||
left: 10,
|
||||
top: 10,
|
||||
right: 10,
|
||||
bottom: 10
|
||||
})
|
||||
.width('100%').height(100)
|
||||
.onChange((value: string) => {
|
||||
this.maxDescribe = value.length.toString();
|
||||
this.descibe = value;
|
||||
if (value.length > 0) {
|
||||
this.isDescibe = true;
|
||||
} else {
|
||||
this.isDescibe = false;
|
||||
}
|
||||
})
|
||||
Text('已输入'+this.maxDescribe+'/100')
|
||||
.fontSize(13).fontColor('#cccccc').textAlign(TextAlign.End).width('90%')
|
||||
.margin({top:-20})
|
||||
}
|
||||
.margin({ left: 15,top: 10,}).width('calc(100% - 30vp)').height(120).borderRadius(4)
|
||||
.layoutWeight(1)
|
||||
|
||||
Text('完成')
|
||||
.width('100%').height(45)
|
||||
.fontSize(18).fontColor(Color.White).textAlign(TextAlign.Center)
|
||||
.backgroundColor(this.isNote||this.isDescibe?'#3CC7C0':'#cccccc')
|
||||
.margin({bottom:10})
|
||||
.onClick(()=>{
|
||||
if (this.isNote || this.isDescibe) {
|
||||
this.patientMsgSubmit();
|
||||
}
|
||||
})
|
||||
|
||||
}.justifyContent(FlexAlign.Start).alignItems(HorizontalAlign.Start)
|
||||
.height('100%')
|
||||
}
|
||||
}
|
||||
|
||||
function getFirstSegment(content?: string): string | undefined {
|
||||
if (!content) return undefined;
|
||||
const segments: string[] = content.split(/[\uFF0C,]/);
|
||||
return segments.find(seg => seg.trim() !== '');
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
import { authStore, HdNav, PositionSelectedSheet } from '@itcast/basic';
|
||||
import { promptAction, router } 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'
|
||||
|
||||
@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[] = [];
|
||||
@Consume@Watch('onRefreshAction') refreshFlag: boolean;
|
||||
|
||||
onRefreshAction(flag: boolean) {
|
||||
this.getGroupData();
|
||||
}
|
||||
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center
|
||||
})
|
||||
|
||||
aboutToAppear(): void {
|
||||
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();
|
||||
logger.info('Response groupList'+res);
|
||||
let json:groupRequestCall = JSON.parse(res+'') as groupRequestCall;
|
||||
if(json.code == 1) {
|
||||
this.groupListArray = []
|
||||
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,
|
||||
rightItemAction: () => {
|
||||
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(()=>{
|
||||
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(()=>{
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
import { authStore, ChangeUtil, HdNav, PositionSelectedSheet, EmptyViewComp,HdLoadingDialog } from '@itcast/basic';
|
||||
import { promptAction, router } 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'
|
||||
|
||||
@Component
|
||||
export struct PatientsListComp {
|
||||
@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 {
|
||||
this.getPatientsListData();
|
||||
}
|
||||
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center
|
||||
})
|
||||
|
||||
getPatientsListData() {
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
hashMap.set('group_uuid',String(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}`);
|
||||
})
|
||||
}
|
||||
|
||||
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:'选择患者',rightText:this.naviRightTitle,showRightText:true,rightTextColor:Color.White,rightBackColor:$r('app.color.main_color'),showRightIcon:false,rightItemAction:()=>{
|
||||
router.back({
|
||||
url:'pages/PatientsPage/BuildOrEditGroupPage',
|
||||
params:{'selectedPatients':this.patientsList}
|
||||
})
|
||||
}})
|
||||
|
||||
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)
|
||||
.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(()=>{
|
||||
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(Color.Gray)
|
||||
.margin({left:60})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
export interface applyListCallBacl {
|
||||
code:number,
|
||||
msg:string,
|
||||
data:applyListModel[],
|
||||
message:string,
|
||||
}
|
||||
|
||||
export interface applyHistoryCallBacl {
|
||||
code:number,
|
||||
msg:string,
|
||||
data:historyObjectModel,
|
||||
message:string,
|
||||
}
|
||||
|
||||
export class applyListModel {
|
||||
mobile?:string;
|
||||
photo?:string;
|
||||
birthDate?:string;
|
||||
sex?:number;
|
||||
realName?:string;
|
||||
checkDate?:string;
|
||||
uuid?:string;
|
||||
createDate?:string;
|
||||
patientUuid?:string;
|
||||
expertUuid?:string;
|
||||
status?:number;
|
||||
content?:string;
|
||||
}
|
||||
|
||||
export interface historyObjectModel {
|
||||
list:historyModel[];
|
||||
isFirstPage?:string;
|
||||
isLastPage?:string;
|
||||
pageNum?:string;
|
||||
pages?:string;
|
||||
pageSize?:string;
|
||||
total?:string;
|
||||
}
|
||||
|
||||
export class historyModel {
|
||||
status?:string;//审核状态(1.待审核2.审核通过3.拒绝4.已过期 5.患者取消 6专家解除)
|
||||
patient_photo?:string;
|
||||
create_date?:string;
|
||||
content?:string;
|
||||
nickname?:string;
|
||||
patient_name?:string;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import { applyListModel,historyModel } from '../models/ApplyModel'
|
||||
import { BasicConstant } from '@itcast/basic/Index'
|
||||
|
||||
@Component
|
||||
export struct ApplyViews {
|
||||
@Prop applyItme:applyListModel;
|
||||
@Prop historyItem:historyModel;
|
||||
@Prop isApply:boolean = true;//随访申请的样式还是申请记录的样式
|
||||
|
||||
private applyItemAction: (status: string,model:applyListModel) => void = () => {};
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Column(){
|
||||
Row({space:10}){
|
||||
Image(this.isApply?this.applyItme.photo:BasicConstant.urlImage+this.historyItem.patient_photo)
|
||||
.alt($r('app.media.userPhoto_default'))
|
||||
.width(50).height(50).borderRadius(5)
|
||||
Column(){
|
||||
Text(this.isApply?this.applyItme.createDate:this.historyItem.create_date)
|
||||
.fontSize(14).fontColor('#333333').width('100%').textAlign(TextAlign.End)
|
||||
if (!this.isApply) {
|
||||
Text('昵称:'+this.historyItem.patient_name)
|
||||
.fontSize(16).fontColor($r('app.color.main_color')).width('100%')
|
||||
}
|
||||
Text(this.isApply?this.applyItme.content:this.historyItem.content)
|
||||
.fontSize(16).fontColor('#333333').width('100%').margin({top:this.isApply?10:0})
|
||||
.maxLines(this.isApply?3:1).textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
}.width('calc(100% - 60vp)')
|
||||
}.width('calc(100% - 20vp)').margin({top:10,bottom:5}).alignItems(VerticalAlign.Top)
|
||||
if (this.isApply) {
|
||||
Row({ space: 40 }) {
|
||||
Text('拒绝')
|
||||
.fontColor($r('app.color.main_color'))
|
||||
.borderColor($r('app.color.main_color'))
|
||||
.customTextStyle()
|
||||
.onClick(()=>this.applyItemAction('3',this.applyItme))
|
||||
Text('同意')
|
||||
.fontColor(Color.White)
|
||||
.backgroundColor($r('app.color.main_color'))
|
||||
.customTextStyle()
|
||||
.onClick(()=>this.applyItemAction('2',this.applyItme))
|
||||
}.padding({ top: 5, bottom: 10 }).justifyContent(FlexAlign.Center).width('calc(100% - 20vp)')
|
||||
} else {
|
||||
Row(){
|
||||
if (this.historyItem.status == '2') {
|
||||
Image($r('app.media.Patients_Apply_History_Status')).width(14).height(14)
|
||||
Text('已同意').height(28).fontColor('#999999').fontSize(15)
|
||||
} else if (this.historyItem.status == '3') {
|
||||
Text('已拒绝').height(28).fontColor('#999999').fontSize(15)
|
||||
} else if (this.historyItem.status == '4' || this.historyItem.status == '5') {
|
||||
Text('已过期').height(28).fontColor('#999999').fontSize(15)
|
||||
}
|
||||
}.padding({ top: 5, bottom: 5 }).justifyContent(FlexAlign.End).width('calc(100% - 20vp)')
|
||||
}
|
||||
Blank()
|
||||
.width('100%').height(1)
|
||||
.backgroundColor('#f4f4f4')
|
||||
}.width('100%').margin({left:10,right:10}).alignItems(HorizontalAlign.Start)
|
||||
}.width('100%').backgroundColor(Color.White)
|
||||
}
|
||||
}
|
||||
|
||||
@Extend(Text)
|
||||
function customTextStyle() {
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(15)
|
||||
.borderRadius(4)
|
||||
.borderWidth(0.5)
|
||||
.width(77)
|
||||
.height(30)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "patient",
|
||||
"type": "har",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet",
|
||||
"2in1"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"float": [
|
||||
{
|
||||
"name": "page_text_font_size",
|
||||
"value": "50fp"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "page_show",
|
||||
"value": "page from package"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,35 @@
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
||||
|
||||
export default function abilityTest() {
|
||||
describe('ActsAbilityTest', () => {
|
||||
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
||||
beforeAll(() => {
|
||||
// Presets an action, which is performed only once before all test cases of the test suite start.
|
||||
// This API supports only one parameter: preset action function.
|
||||
})
|
||||
beforeEach(() => {
|
||||
// Presets an action, which is performed before each unit test case starts.
|
||||
// The number of execution times is the same as the number of test cases defined by **it**.
|
||||
// This API supports only one parameter: preset action function.
|
||||
})
|
||||
afterEach(() => {
|
||||
// Presets a clear action, which is performed after each unit test case ends.
|
||||
// The number of execution times is the same as the number of test cases defined by **it**.
|
||||
// This API supports only one parameter: clear action function.
|
||||
})
|
||||
afterAll(() => {
|
||||
// Presets a clear action, which is performed after all test cases of the test suite end.
|
||||
// This API supports only one parameter: clear action function.
|
||||
})
|
||||
it('assertContain', 0, () => {
|
||||
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
|
||||
let a = 'abc';
|
||||
let b = 'b';
|
||||
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
|
||||
expect(a).assertContain(b);
|
||||
expect(a).assertEqual(a);
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import abilityTest from './Ability.test';
|
||||
|
||||
export default function testsuite() {
|
||||
abilityTest();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "patient_test",
|
||||
"type": "feature",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet",
|
||||
"2in1"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import localUnitTest from './LocalUnit.test';
|
||||
|
||||
export default function testsuite() {
|
||||
localUnitTest();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
||||
|
||||
export default function localUnitTest() {
|
||||
describe('localUnitTest', () => {
|
||||
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
||||
beforeAll(() => {
|
||||
// Presets an action, which is performed only once before all test cases of the test suite start.
|
||||
// This API supports only one parameter: preset action function.
|
||||
});
|
||||
beforeEach(() => {
|
||||
// Presets an action, which is performed before each unit test case starts.
|
||||
// The number of execution times is the same as the number of test cases defined by **it**.
|
||||
// This API supports only one parameter: preset action function.
|
||||
});
|
||||
afterEach(() => {
|
||||
// Presets a clear action, which is performed after each unit test case ends.
|
||||
// The number of execution times is the same as the number of test cases defined by **it**.
|
||||
// This API supports only one parameter: clear action function.
|
||||
});
|
||||
afterAll(() => {
|
||||
// Presets a clear action, which is performed after all test cases of the test suite end.
|
||||
// This API supports only one parameter: clear action function.
|
||||
});
|
||||
it('assertContain', 0, () => {
|
||||
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
|
||||
let a = 'abc';
|
||||
let b = 'b';
|
||||
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
|
||||
expect(a).assertContain(b);
|
||||
expect(a).assertEqual(a);
|
||||
});
|
||||
});
|
||||
}
|
||||