首页、患者分组、审核、列表等

This commit is contained in:
xiaoxiao
2025-07-10 09:27:17 +08:00
parent 5954f51701
commit 4641e9ecee
136 changed files with 7577 additions and 171 deletions
@@ -0,0 +1,108 @@
import { FlipperOptions,FlipperView,FlipperOptionsBuilder } from '@hshare/hshare-flipper'
import { promptAction } from '@kit.ArkUI';
import { router } from '@kit.ArkUI'
import { meetingModel } from '../model/HomeModel'
import { TimestampUtil } from '@itcast/basic'
@Component
export struct FlipperComp {
@Prop bankAdBeans: meetingModel[];
@State processedData: meetingModel[] = [];
options: FlipperOptions = FlipperOptionsBuilder.getInstance()
.setHeight(56)//View高度
.setInterval(3000)//上下滚动间隔,单位为毫秒
.setAnimateParam(500)//动画持续时间,单位为毫秒
.setOnItemClicked((item: meetingModel, index: number) => {
router.pushUrl({
url: 'pages/WebView/WebPage', // 目标url
params: {url:item.liveurl,title:item.title}
})
})
.setOnItemScrolled((item: meetingModel, index: number) => {
//滚动事件
})
.build()
aboutToAppear() {
if (this.bankAdBeans.length === 1) {
this.processedData = [...this.bankAdBeans, ...this.bankAdBeans, ...this.bankAdBeans];
} else {
this.processedData = this.bankAdBeans;
}
}
build() {
Column() {
Row() {
FlipperView({
options: this.options,
sourceBeans: this.processedData,
itemContentView: (data: meetingModel, index: number) => {
this.itemContentView(data, index)
}
})
}
}
.width('100%').height('100%').backgroundColor('#F4F4F4')
}
@Builder
itemContentView(item: meetingModel, index: number) {
Stack({alignContent:Alignment.Center}){
Image($r('app.media.meeting_back_icon'))
.width('100%').height(46).margin({top:10})
Row(){
Column() {
Row({space:2}){
Image($r('app.media.meeting_live_icon')).width(30).height(13)
if (item.state === '1') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Image($r('app.media.meeting_begin_play_icon')).width(16).height(16)
} else {
Image($r('app.media.meeting_noPlay_icon')).width(16).height(16)
}
} else if (item.state === '0' || item.state === '3') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Image($r('app.media.meeting_begin_play_icon')).width(16).height(16)
} else {
Image($r('app.media.meeting_noPlay_icon')).width(16).height(16)
}
} else {
Image($r('app.media.meeting_begin_play_icon')).width(16).height(16)
}
}
Stack({alignContent:Alignment.Center}){
Image($r('app.media.meeting_timeBack_icon')).width(74).height(15).margin({top:-3})
if (item.state === '1') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Text('开播'+TimestampUtil.format(item.begin_date_timestamp,'HH:mm'))
.fontSize(12).fontColor(Color.White)
} else {
Text(TimestampUtil.format(item.begin_date_timestamp,'MM月dd日'))
.fontSize(12).fontColor(Color.White)
}
} else if (item.state === '0' || item.state === '3') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Text('开播'+TimestampUtil.format(item.begin_date_timestamp,'HH:mm'))
.fontSize(12).fontColor(Color.White)
} else {
Text(TimestampUtil.format(item.begin_date_timestamp,'MM月dd日'))
.fontSize(12).fontColor(Color.White)
}
} else {
Text('正在直播')
.fontSize(12).fontColor(Color.White)
}
}
}.margin({left:10}).alignItems(HorizontalAlign.Start)
Blank()
.width(1).height(28).margin({left:9}).backgroundColor('#C5C5C5')
Text(item.title)
.fontSize(14)
.fontColor('#333333')
.margin({left:9})
}.margin({top:10}).width('100%').height(46)
}
}
}
@@ -0,0 +1,65 @@
import { iconsModel } from '../model/HomeModel'
import { patientDbManager, PatientEntity } from '@itcast/basic';
import { promptAction } from '@kit.ArkUI';
// interface iconsModel {
// img:string;
// name:string;
// isRed:boolean;
// }
@Component
export struct HomeIconComp {
@Prop iconList: iconsModel[];
@State patientIcon: string = '';
@State patientName: string = '我的患者';
@State videoIcon: string = '';
@State videoName: string = '肝胆视频';
aboutToAppear(): void {
for (const icons of this.iconList) {
if (icons.name === '我的患者') {
this.patientIcon = icons.img;
} else if (icons.name === '肝胆视频') {
this.videoIcon = icons.img;
}
}
for (let index = 0; index < this.iconList!.length; index++) {
const iconModel = this.iconList![index] as iconsModel ;
if (index == 0) {
iconModel.isRed = true;
}
}
}
build() {
Row() {
Grid() {
ForEach(this.iconList, (item: iconsModel) => {//[{ 'img': this.patientIcon, 'name': this.patientName },{ 'img': this.videoIcon, 'name': this.videoName}]
GridItem(){
Stack() {
Column() {
Image(item.img)
.width(24).height(24)
.objectFit(ImageFit.Auto)
Text(item.name)
.fontSize(14)
.fontColor('#333333')
.margin({ top: 10 })
}.width('100%')
if (item.isRed) {
Text().backgroundColor(Color.Red).width(10).height(10).borderRadius(5)
}
}.width('25%').alignContent(Alignment.TopEnd)
}.margin({top:20,bottom:20})
.onClick(async ()=>{
const patients = await patientDbManager.getAllPatients();
console.info(`添加了 ${patients.length} 个患者`);
promptAction.showToast({message:`添加了 ${patients.length} 个患者`})
})
})
}.width('100%').backgroundColor(Color.White)
}
}
}
@@ -0,0 +1,56 @@
import { videoModel } from '../model/HomeModel'
import { router } from '@kit.ArkUI';
import { BasicConstant } from '@itcast/basic'
import { videoTools } from '../polyv/VideoUtil'
import { getDisplayWindowWidth } from 'media-player-common'
@Component
export struct HomeReplayVideoComp {
@Prop videoList: videoModel[];
@State newVideosList: videoModel[] = this.videoList.slice(0, 4);
build() {
Column() {
Row(){
Text('精彩回放')
.fontSize(17)
.fontWeight(FontWeight.Bold)
.margin({left:15})
Blank()
.layoutWeight(1)
Row(){
Text('更多 ')
.fontSize(15)
.fontColor('#999999')
Image($r('app.media.course_invoice_to_details'))
.width(15).height(15)
}.margin({right:15})
.onClick(()=>{
router.pushUrl({
url:'pages/VideoPage/VideoGandanPage',
})
})
}.height(50)
Grid(){
ForEach(this.newVideosList,(item:videoModel,index:number)=>{
GridItem(){
Column() {
Image(item.imgpath).alt($r('app.media.default_video')).width('100%').height(102)
.objectFit(ImageFit.Fill)
Text(item.name).maxLines(2).fontSize(15).fontColor('app.color.666666').textAlign(TextAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis }).width('100%').height(56).padding({left:10,top:10,right:10,bottom:10})
}.backgroundColor(Color.White)
.borderRadius(5)
.height('auto')
.clip(true)
.width('calc((100% - 45vp)/2)')
.margin({left:15,bottom:15})
.onClick(()=>{
videoTools.getVideoDetail(item.uuid)
})
}
})
}.width('100%')
}.width('100%')
}
}
@@ -0,0 +1,57 @@
import { newsModel,expertDetailModel } from '../model/HomeModel'
import { router } from '@kit.ArkUI'
@Preview
@Component
export struct HomeSwiperComp {
@Prop newslist: newsModel[];
@Prop expertData:expertDetailModel;
build() {
Column() {
Swiper() {
ForEach(this.newslist, (item: newsModel,index:number) => {
Stack({alignContent:Alignment.Center}) {
Image(item.headImg)
.objectFit(ImageFit.Fill)// 图片填充模式
.width('100%').height('100%')
if (index == 0) {
Column({space:5}){
Text(this.expertData.realName+'专家工作室')
.fontSize(19)
.fontColor(Color.White)
.margin({left:20,top:60})
Text(this.expertData.hospitalName)
.fontSize(16)
.fontColor(Color.White)
.margin({left:20})
}.width('100%').alignItems(HorizontalAlign.Start)
}
}.onClick(()=>{
if (index == 0) {
router.pushUrl({url:'pages/MinePage/EditUserDataPage'})
} else {
router.pushUrl({
url: 'pages/WebView/WebPage', // 目标url
params: {url:item.path,title:item.title}
})
}
})
}, (item: newsModel) => JSON.stringify(item))
}
.indicator(
Indicator.dot()
.itemWidth(8)
.itemHeight(8)
.selectedItemWidth(8)
.selectedItemHeight(8)
.color(Color.Gray)
.selectedColor($r('app.color.main_color'))
)
.loop(true)
.autoPlay(true)
.interval(5000)
}
.width('100%')
}
}
@@ -0,0 +1,92 @@
import { esiteModel } from '../model/HomeModel'
import { router } from '@kit.ArkUI'
@Component
export struct SpeciallyEStandingComp {
@Prop esiteArray: esiteModel[];
@State newEsiteArr: esiteModel[][] = [];
@State selectedIndex:number = 0;
aboutToAppear(): void {
this.newEsiteArr = convertTo2DArray(this.esiteArray)
}
changeGroup() {
animateTo({
duration: 500,
curve: Curve.EaseIn,
}, () => {
if (this.selectedIndex === this.newEsiteArr.length - 1) {
this.selectedIndex = 0;
} else {
this.selectedIndex++;
}
})
}
build() {
Column() {
Row(){
Text('专题E站')
.fontSize(17)
.fontWeight(FontWeight.Bold)
.margin({left:15})
Blank()
.layoutWeight(1)
if (this.newEsiteArr.length>=2) {
Row(){
Image($r('app.media.new_home_choose_icon'))
.width(15).height(15)
Text(' 换一换')
.fontSize(15)
.fontColor('#999999')
}.margin({right:15})
.onClick(()=>{
this.changeGroup();
})
}
}.height(50)
Column(){
ForEach(getSubArray(this.newEsiteArr,this.selectedIndex),(item:esiteModel,index:number)=>{
Image(item.img_path)
.objectFit(ImageFit.Cover)
.margin({left:10,top:10,right:10})
.height(45).width('95%')
.onClick(()=>{
router.pushUrl({
url: 'pages/WebView/WebPage', // 目标url
params: {url:item.url,title:item.name}
})
})
})
}.backgroundColor(Color.White).borderRadius(4).height(175).width('93%')
.margin({left:15,right:15})
}.width('100%').alignItems(HorizontalAlign.Start)
}
}
function convertTo2DArray<T extends esiteModel>(sourceArray: T[], groupSize: number = 3): T[][] {
const resultArray: T[][] = [];
for (let i = 0; i < sourceArray.length; i += groupSize) {
const group = sourceArray.slice(i, i + groupSize);
if (group.length < groupSize) {
const emptyObj: esiteModel = {} as esiteModel;
const emptyItems = Array(groupSize - group.length).fill(emptyObj) as T[];
resultArray.push([...group, ...emptyItems]);
} else {
resultArray.push(group);
}
}
return resultArray;
}
// 获取指定下标的子数组(带边界检查)
function getSubArray<T>(data: T[][], index: number): T[] {
if (index < 0 || index >= data.length) {
// 越界返回空数组(或抛异常)
return [];
}
return data[index];
}
@@ -0,0 +1,126 @@
export interface HomeModel {
code:string;
data:dataModel;
message:string;
}
export interface dataModel{
consult_list?:consultModel;
news_list?:newsModel[];
gandanfile_list?:gandanfileModel[];
isOnlineToday?:string;
has_unread?:string;
guide_ist?:guideModel[];
expertDetail?:expertDetailModel;
excellencourse_list?:excellencourseModel[];
video_list?:videoModel[];
meeting_list?:meetingModel[];
icons_list?:iconsModel[];
welfare_notice?:welfareModel;
esite_list?:esiteModel[];
sign_in?:string
}
export interface consultModel {
yetDayTotalNum:string;
count:string;
list:[];
yetDayTotalnumEPNum:string
}
export interface newsModel {
uuid:string;
title:string;
headImg:string;
color:string;
type:string;
path:string;
}
export interface gandanfileModel {
type:string;
article_uuid:string;
title:string;
tags:string;
path:string
}
export interface guideModel {
create_date:string;
guide_type_uuid:string;
guide_type:string;
guide_uuid:string;
article_uuid:string;
title:string;
tags:string;
path:string
}
export interface expertDetailModel {
photo:string;
officeName:string;
positionName:string;
hospitalName:string;
qrcode:string;
realName:string;
}
export interface excellencourseModel {
video_num:string;
discount_type:string;
account:string;
discount_price:string;
title:string;
search_second_list:string;
study_num:string;
sroll_img:string;
index_img:string;
upload_num:string;
back_bon:string;
fuli_bon:string;
special_type_name:string;
tags:string;
id:string;
}
export interface videoModel {
readnum:string;
uuid:string;
imgpath:string;
polyv_uuid:string;
public_name:string;
imgUrl:string;
note:string;
name:string;
path:string;
content:string;
}
export interface meetingModel {
title:string;
begin_date_timestamp:string;
end_date_timestamp:string;
liveurl:string;
begin_date:string;
end_date:string;
state:string;
path:string;
}
export interface iconsModel {
fixed:string;
img:string;
name:string;
isRed:boolean;
}
export interface welfareModel {
one_last_notice:boolean;
receive_notice:boolean;
}
export interface esiteModel {
url:string;
img_path:string;
name:string;
}
+176 -10
View File
@@ -1,19 +1,185 @@
import { FlipperComp } from '../components/FlipperComp'
import { HomeIconComp } from '../components/HomeIconComp'
import { HomeSwiperComp } from '../components/HomeSwiperComp'
import { SpeciallyEStandingComp } from '../components/SpeciallyEStandingComp'
import { HomeReplayVideoComp } from '../components/HomeReplayVideoComp'
import { getDisplayWindowWidth } from 'media-player-common'
import { BusinessError } from '@kit.BasicServicesKit';
import HashMap from '@ohos.util.HashMap';
import { BasicConstant,hdHttp, HdResponse ,logger,HdHomeNav} from '@itcast/basic/Index'
import { HomeModel,dataModel, newsModel,iconsModel } from '../model/HomeModel';
import { DefaultHintProWindows,SignPopWindow,HdLoadingDialog } from '@itcast/basic'
import { promptAction, router } from '@kit.ArkUI';
@Entry
@Component
export struct HomePage {
@State message: string = 'Hello World';
@State homeData:dataModel = {} as dataModel;
@State navAlpha: number = 0;
@State navBackColor: string = 'FFFFFF'
@Consume@Watch('gotoTop')
toTop:boolean;
@State hintMessage:string = '';
@State signData:Record<string,string> = {};
scroller:Scroller = new Scroller()
private hintWindowDialog!: CustomDialogController;
private signWindowDialog!:CustomDialogController;
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
private hintPopWindowDialog() {
this.hintWindowDialog = new CustomDialogController({
builder:DefaultHintProWindows({
controller:this.hintWindowDialog,
message:this.hintMessage,
cancleTitle:'',
confirmTitle:'关闭',
confirmTitleColor: '#000000',
selectedButton: (index:number)=>{
this.hintWindowDialog.close();
}
}),
alignment: DialogAlignment.Center,
cornerRadius:24,
autoCancel:false,
backgroundColor: ('rgba(0,0,0,0.5)'),
})
}
private signPopWindowDialog(){
this.signWindowDialog = new CustomDialogController({
builder:SignPopWindow({
controller:this.signWindowDialog,
signDay:'今天是我们相识的第'+this.signData.gdxzday+'天',
signWeek:this.signData.totalDay,
signMouth:this.signData.continuous_day,
signNews:this.signData.news['title'],
signHtml:this.signData.news['path'],
}),
alignment: DialogAlignment.Center,
cornerRadius:8,
autoCancel:false,
backgroundColor: Color.Transparent,
backgroundBlurStyle: BlurStyle.NONE,
})
}
gotoTop() {
this.scroller.scrollToIndex(0);
this.initData()
}
aboutToAppear(): void {
this.initData()
this.hintPopWindowDialog();
this.signPopWindowDialog();
}
initData() {
const hashMap: HashMap<string, string> = new HashMap();
this.dialog.open()
hashMap.clear();
hdHttp.httpReq<string>(BasicConstant.indexV2,hashMap).then(async (res: HdResponse<string>) => {
logger.info('Response indexV2'+res);
let json:HomeModel = JSON.parse(res+'') as HomeModel;
this.dialog.close();
this.homeData = json.data;
for (const item of this.homeData.news_list as newsModel[]) {
if (item.type == '1') {
this.navBackColor = item.color;
}
}
}).catch((err: BusinessError) => {
this.dialog.close();
})
}
getSignData() {
const hashMap: HashMap<string, string> = new HashMap();
this.dialog.open()
hashMap.clear();
hashMap.set('score_type','1');
hdHttp.httpReq<string>(BasicConstant.addBonusPoints,hashMap).then(async (res: HdResponse<string>) => {
logger.info('Response addBonusPoints'+res);
this.dialog.close();
let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>;
if (json.code == '1') {
this.homeData.sign_in = '1';
this.signData = json;
this.signWindowDialog.open();
} else if (json.code == '201') {
this.homeData.sign_in = '1';
this.hintMessage = '今日已签到,每日只能签到一次。\n请明日继续哦~';
this.hintWindowDialog.open();
}
}).catch((err: BusinessError) => {
this.dialog.close();
})
}
build() {
Row() {
Column() {
Text(this.message)
.fontSize($r('app.float.page_text_font_size'))
.fontWeight(FontWeight.Bold)
.onClick(() => {
this.message = 'Welcome';
})
Stack(){
Scroll(this.scroller) {
Column() {
if (this.homeData.news_list && this.homeData.news_list.length > 0) {
HomeSwiperComp({ newslist: this.homeData.news_list, expertData: this.homeData.expertDetail })
.height(getDisplayWindowWidth().vp / 16 * 9)
}
if (this.homeData.icons_list && this.homeData.icons_list.length > 0) {
HomeIconComp({iconList:this.homeData.icons_list})
}
if (this.homeData.meeting_list && this.homeData.meeting_list.length > 0) {
FlipperComp({ bankAdBeans: this.homeData.meeting_list })
.height(56)
.backgroundColor(Color.Yellow)
}
if (this.homeData.esite_list && this.homeData.esite_list.length > 0) {
SpeciallyEStandingComp({ esiteArray: this.homeData.esite_list })
}
if (this.homeData.video_list && this.homeData.video_list.length > 0) {
HomeReplayVideoComp({ videoList: this.homeData.video_list })
}
}
}
.width('100%')
.edgeEffect(EdgeEffect.Spring)
.scrollBar(BarState.Off)
.onWillScroll(() => {
const yOffset = this.scroller.currentOffset().yOffset;
const threshold = 56;
if (yOffset <= 0) {
this.navAlpha = 0;
} else if (yOffset >= threshold) {
this.navAlpha = 1;
} else {
this.navAlpha = yOffset / threshold;
}
})
HdHomeNav({
leftIcon:this.homeData.sign_in == '0'?$r('app.media.home_no_qiandao_icon'):$r('app.media.home_qiandao_icon'),
placeholder:'搜索视频、会议',
alpha:this.navAlpha,
backColor:this.navBackColor,
leftItemAction:()=>{
this.getSignData();
},
searchItemAction:()=>{
router.pushUrl({
url:'pages/SearchPage/VideoSearchPage',
params: {
params:{'pageName':'视频'}
}
})
}
})
}
.alignContent(Alignment.Top)
.backgroundColor('#f4f4f4')
.width('100%')
.height('100%')
}
}
@@ -5,4 +5,4 @@
"value": "50fp"
}
]
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -4,11 +4,13 @@ export class MyPageSectionClass {
imageSrc:ResourceStr = '';
title:string = '';
path:string = '';
status:boolean = false;
constructor(id:string,imageSrc:ResourceStr,title:string,path:string) {
constructor(id:string,imageSrc:ResourceStr,title:string,path:string,status:boolean) {
this.id = id;
this.imageSrc = imageSrc;
this.title = title;
this.path = path;
this.status = status;
}
}
@@ -1,11 +1,17 @@
import { HeaderView } from '../view/HeaderView'
import { HdNav, getTimeText, hdHttp, HdUser } from '@itcast/basic'
import { OneSection } from '../view/OneSection'
import { TwoSection } from '../view/TwoSection'
import { ThreeSection } from '../view/ThreeSection'
import { FourSection } from '../view/FourSection'
import { OtherList } from '../view/OtherList'
import { emitter } from '@kit.BasicServicesKit'
import { HdNav,hdHttp,HdResponse,BasicConstant,ExpertData,authStore,RequestDefaultModel } from '@itcast/basic'
import { BusinessError, emitter } from '@kit.BasicServicesKit';
import HashMap from '@ohos.util.HashMap'
interface heroFirst {
id: string;
nick_name: string;
}
@Component
export struct MyHomePage {
@@ -13,21 +19,64 @@ export struct MyHomePage {
@StorageProp('topHeight')
topHeight: number = 0
@State myInfoBackGround:string = '';
@State heroArray:Array<object> = [];
@State expertData:object | string = new Object;
scroller = new Scroller()
aboutToAppear(): void {
this.uploadBackImgAction();
emitter.on({ eventId: BasicConstant.notification_home_tab_change }, (eventData: emitter.EventData) => {
if (eventData.data?.changeIndex === 2) {
this.uploadBackImgAction();
}
});
}
uploadBackImgAction() {
const hashMap: HashMap<string, string> = new HashMap();
hdHttp.httpReq<string>(BasicConstant.myData,hashMap).then(async (res: HdResponse<string>) => {
console.info(`我的背景图: ${res}`);
let json:Record<string,object | string> = JSON.parse(res+'') as Record<string,object | string>;
if(json.code == '200') {
this.heroArray = json.data["honor_list"];
this.myInfoBackGround = json.data['myInfoBackGround'];
this.expertData = json.data;
// 获取ranking值(带安全类型转换)
const ranking: string = json.data["ranking"]?.toString() ?? "";
if (Number(ranking) > 0) {
// 创建排名对象
const rankDic: heroFirst = {
"id": "ranking",
"nick_name": `随访达人 I 排名${ranking}`
};
// 插入数组首位
this.heroArray.unshift(rankDic);
}
} else {
console.error('我的背景图:'+json.message)
}
}).catch((err: BusinessError) => {
console.info(`Response login fail: ${err}`);
})
}
build() {
Column() {
HdNav({ title: '我的', showLeftIcon:false , showRightIcon: false, hasBorder: true })
Scroll(this.scroller) {
Column() {
HeaderView()
// OneSection()
// TwoSection()
// ThreeSection()
FourSection()
OtherList()
}
Stack() {
Image(this.myInfoBackGround)
.backgroundImageSize(ImageSize.Cover)
.width('100%')
Column() {
HeaderView({heroArray:this.heroArray,expertData:this.expertData})
OneSection()
FourSection()
OtherList()
}
}.alignContent(Alignment.Top)
}
.width('100%')
.height('100%')
@@ -21,10 +21,10 @@ export struct FourSection {
// new MyPageSectionClass('threeItem',this.pushIconPath,this.pushStatus,''),
// new MyPageSectionClass('fourItem',$r('app.media.my_page_version'),'发现新版本','')
new MyPageSectionClass('oneItem',$r('app.media.my_page_choosePhone'),'更换手机号','pages/MinePage/ChangePhonePage'),
new MyPageSectionClass('twoItem',this.pushIconPath,this.pushStatus,''),
new MyPageSectionClass('threeItem',$r('app.media.my_page_guanyu_icon'),'关于肝胆相照','pages/WebView/WebPage'),
new MyPageSectionClass('fourItem',$r('app.media.my_page_zhibo_icon'),'肝胆相照直播群','pages/WebView/WebPage')
new MyPageSectionClass('oneItem',$r('app.media.my_page_choosePhone'),'更换手机号','pages/MinePage/ChangePhonePage',false),
new MyPageSectionClass('twoItem',this.pushIconPath,this.pushStatus,'',false),
new MyPageSectionClass('threeItem',$r('app.media.my_page_guanyu_icon'),'关于肝胆相照','pages/WebView/WebPage',false),
new MyPageSectionClass('fourItem',$r('app.media.my_page_zhibo_icon'),'肝胆相照直播群','pages/WebView/WebPage',false)
];
aboutToAppear() {
@@ -60,7 +60,7 @@ export struct FourSection {
// 更新数组中的标题
this.fourSectionList = this.fourSectionList.map((item, index) => {
if (index === 1) {
return new MyPageSectionClass(item.id, this.pushIconPath, this.pushStatus, item.path);
return new MyPageSectionClass(item.id, this.pushIconPath, this.pushStatus, item.path,false);
}
return item;
});
@@ -33,8 +33,8 @@ export struct HeaderView {
@State heroIndex: number = 0 // 当前页索引
@State photoPath:string = BasicConstant.urlImage+authStore.getUser().photo;
@State name:string = authStore.getUser().realName;
@State myPageData:object = new Object;
@State heroArray:Array<object> = [];
@Prop heroArray:Array<object> = [];
@Prop expertData:object | string= new Object;
@State clickHeroId:string = '';
@Consume@Watch('gotoTop')
toTop:boolean;
@@ -48,11 +48,9 @@ export struct HeaderView {
aboutToAppear(): void {
this.uploadUserDataAction();
this.uploadBackImgAction();
emitter.on({ eventId: BasicConstant.notification_home_tab_change }, (eventData: emitter.EventData) => {
if (eventData.data?.changeIndex === 2) {
this.uploadUserDataAction();
this.uploadBackImgAction();
}
});
}
@@ -81,103 +79,82 @@ export struct HeaderView {
})
}
uploadBackImgAction() {
const hashMap: HashMap<string, string> = new HashMap();
hdHttp.httpReq<string>(BasicConstant.myData,hashMap).then(async (res: HdResponse<string>) => {
console.info(`我的背景图: ${res}`);
let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel;
if(json.code == '200') {
this.heroArray = json.data["honor_list"];
this.myPageData = json.data;
// 获取ranking值(带安全类型转换)
const ranking: string = this.myPageData["ranking"]?.toString() ?? "";
if (Number(ranking) > 0) {
// 创建排名对象
const rankDic: heroFirst = {
"id": "ranking",
"nick_name": `随访达人 I 排名${ranking}`
};
// 插入数组首位
this.heroArray.unshift(rankDic);
}
} else {
console.error('我的背景图:'+json.message)
}
}).catch((err: BusinessError) => {
console.info(`Response login fail: ${err}`);
})
}
handleAvatarClick() {
router.pushUrl({url:'pages/MinePage/EditUserDataPage'})
}
build() {
// Row() {
Column({space:5}) {
Row({space:10}) {
Image(this.photoPath)
.alt($r('app.media.userPhoto_default'))
.margin({left:15})
.width(60)
.height(60)
.borderRadius(5)
.objectFit(ImageFit.Cover)
.onClick(()=>this.handleAvatarClick())
Column({space:5}) {
Text(this.name)
.fontSize(18)
.fontColor('#FFFFFF')
.onClick(()=>this.handleAvatarClick())
List({space:5,initialIndex:this.heroIndex,scroller:this.scrollerForList}) {
ForEach(this.heroArray, (item: heroFirst) => {
ListItem() {
Row() {
Image(item.id === 'ranking'?$r('app.media.my_home_hero_ranking'):$r('app.media.my_page_header_hertIcon'))
.width(13)
.height(13)
.margin({left:7})
Text(item.nick_name)
.fontColor(Color.White)
.fontSize(11)
.margin({left:4,right:10})
}
.height(18)
.margin({right:5})
.borderRadius(9)
.borderWidth(1)
.borderColor(Color.White)
.onClick(()=>{
if (item.id !== 'ranking') {
this.clickHeroId = item.id;
this.dialogController.open();
}
})
}
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
.height(18)
}
.alignItems(HorizontalAlign.Start)
Column({space:15}) {
Row({space:10}) {
Image(this.photoPath)
.alt($r('app.media.userPhoto_default'))
.margin({left:15})
.width(60)
.height(60)
.width('70%')
.margin({top:22})
.borderRadius(5)
.objectFit(ImageFit.Cover)
.onClick(()=>this.handleAvatarClick())
Column({space:5}) {
Text(this.name)
.fontSize(18)
.fontColor('#FFFFFF')
.onClick(()=>this.handleAvatarClick())
List({space:5,initialIndex:this.heroIndex,scroller:this.scrollerForList}) {
ForEach(this.heroArray, (item: heroFirst) => {
ListItem() {
Row() {
Image(item.id === 'ranking'?$r('app.media.my_home_hero_ranking'):$r('app.media.my_page_header_hertIcon'))
.width(13)
.height(13)
.margin({left:7})
Text(item.nick_name)
.fontColor(Color.White)
.fontSize(11)
.margin({left:4,right:10})
}
.height(18)
.margin({right:5})
.borderRadius(9)
.borderWidth(1)
.borderColor(Color.White)
.onClick(()=>{
if (item.id !== 'ranking') {
this.clickHeroId = item.id;
this.dialogController.open();
}
})
}
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
.height(18)
}.alignItems(HorizontalAlign.Start).width('calc(100% - 100vp)')
}.width('100%').margin({top:20})
Column(){
Row({space:70}){
ForEach([{'title':'随访患者数','content':this.expertData['expert_apply_num'] || '0'},
{'title':'公益咨询数','content':this.expertData['consult_total_num'] || '0'}],
// {'title':'患者送花数','content':this.expertData['ping_flowewr_num'] || '0'}],
(item:object)=>{
Column(){
Text(item['content']?.toString() || '0')
.fontSize(20)
.fontColor('#000000')
.height(28)
Text(item['title'])
.fontSize(12)
.fontColor('#333333')
.height(17)
}.height('100%').justifyContent(FlexAlign.Center)
})
}
.width('100%')
.height(97)
}
.width('100%')
.height(97)
.backgroundImage(this.myPageData["myInfoBackGround"]).backgroundImageSize(ImageSize.Cover)
}.width('95%').height(65).borderRadius(5).backgroundColor(Color.White)
}
// }
gotoTop()
{
.width('100%')
}
gotoTop() {
this.photoPath = BasicConstant.urlImage+authStore.getUser().photo;
}
}
@@ -5,15 +5,19 @@ export struct MyPageSectionItem {
@Prop sectionItem: MyPageSectionClass;
build() {
Column(){
Image(this.sectionItem.imageSrc)
.width(35).height(35)
.borderRadius(17.5)
.objectFit(ImageFit.Auto)
Text(this.sectionItem.title)
.fontSize(12)
.fontColor(Color.Black)
.margin({top:6})
}
Stack() {
Column() {
Image(this.sectionItem.imageSrc)
.width(24).height(24)
.objectFit(ImageFit.Auto)
Text(this.sectionItem.title)
.fontSize(14)
.fontColor('#333333')
.margin({ top: 10 })
}.width('100%')
if (this.sectionItem.status) {
Text().backgroundColor(Color.Red).width(10).height(10).borderRadius(5)
}
}.width('100%').height('100%').alignContent(Alignment.TopEnd)
}
}
@@ -1,19 +1,34 @@
import { it } from "@ohos/hypium";
import { MyPageSectionClass } from "../model/MyPageSectionClass";
import { MyPageSectionItem } from '../view/MyPageSectionItem'
import { router } from "@kit.ArkUI";
import { BasicConstant,hdHttp, HdResponse ,logger,authStore} from '@itcast/basic/Index'
import { BusinessError } from '@kit.BasicServicesKit';
import { it } from "@ohos/hypium";
interface extraData {
expertUuid: string
}
interface requestCallBack {
code:string;
msg:string;
message:string;
data:Array<object>
}
@Preview
@Component
export struct OneSection {
@State sectionTitle: string = "随访服务";
@State currentIndex: number = 0;
@Consume@Watch('gotoTop')
toTop:boolean;
@State oneSectionList: Array<MyPageSectionClass> = [
new MyPageSectionClass('oneItem', $r('app.media.app_icon'), '患者审核', '/pages/MyHomePage'),
new MyPageSectionClass('twoItem', $r('app.media.app_icon'), '患者分组', '/pages/MyHomePage'),
new MyPageSectionClass('threeItem', $r('app.media.app_icon'), '群发消息', '/pages/MyHomePage'),
new MyPageSectionClass('fourItem', $r('app.media.app_icon'), '随访二维码', '/pages/MyHomePage'),
new MyPageSectionClass('fiveItem', $r('app.media.app_icon'), '出诊计划', '/pages/MyHomePage')
new MyPageSectionClass('oneItem', $r('app.media.my_page_patientAudit'), '患者审核', '/pages/MyHomePage',false),
new MyPageSectionClass('twoItem', $r('app.media.my_page_patientList'), '患者分组', '/pages/MyHomePage',false),
new MyPageSectionClass('threeItem', $r('app.media.my_page_message'), '群发消息', '/pages/MyHomePage',false),
new MyPageSectionClass('fourItem', $r('app.media.my_page_QrCode'), '随访二维码', '/pages/MyHomePage',false),
new MyPageSectionClass('fiveItem', $r('app.media.my_page_visitPlan'), '出诊计划', '/pages/MyHomePage',false)
];
private getPagedItems(): Array<Array<MyPageSectionClass>> {
@@ -25,6 +40,35 @@ export struct OneSection {
return pages;
}
aboutToAppear(): void {
this.getApplyListData();
}
gotoTop() {
this.getApplyListData();
}
getApplyListData(){
hdHttp.post<string>(BasicConstant.applyList, {
expertUuid: authStore.getUser().uuid,
} as extraData).then(async (res: HdResponse<string>) => {
logger.info('Response applyList'+res);
let json:requestCallBack = JSON.parse(res+'') as requestCallBack;
if(json.code == '1') {
if (json.data.length > 0) {
this.oneSectionList = this.oneSectionList.map((item, index) => {
if (index === 0) {
return new MyPageSectionClass(item.id,item.imageSrc,item.title,item.path,true);
}
return item;
});
}
}
}).catch((err: BusinessError) => {
console.info(`Response fails: ${err}`);
})
}
build() {
Column() {
// 标题
@@ -42,6 +86,17 @@ export struct OneSection {
ForEach(pageItems, (item: MyPageSectionClass) => {
GridItem() {
MyPageSectionItem({ sectionItem: item })
.onClick(()=>{
if (item.title === '患者审核') {
router.pushUrl({
url:'pages/PatientsPage/PatientPages'
})
} else if (item.title === '患者分组') {
router.pushUrl({
url:'pages/PatientsPage/PatientsGroupPage'
})
}
})
}
}, (item: MyPageSectionClass) => item.id)
}
@@ -51,13 +106,13 @@ export struct OneSection {
.height('100%')
.width('100%')
})
}
}.width('100%')
.index(this.currentIndex)
.onChange((index: number) => {
this.currentIndex = index;
})
.height(78)
.indicator(false)
.indicator(false).loop(false)
Row() {
ForEach(new Array(Math.ceil(this.oneSectionList.length / 4)).fill(0), (item: number, idx: number) => {
@@ -9,12 +9,12 @@ export struct ThreeSection {
@State currentIndex: number = 0;
@State threeSectionList:Array<MyPageSectionClass> = [
new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'我的账户','/pages/MyHomePage'),
new MyPageSectionClass('twoItem',$r('app.media.app_icon'),'我的积分','/pages/MyHomePage'),
new MyPageSectionClass('threeItem',$r('app.media.app_icon'),'我的福利','/pages/MyHomePage'),
new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'我的鲜花','/pages/MyHomePage'),
new MyPageSectionClass('fiveItem',$r('app.media.app_icon'),'课件明细','/pages/MyHomePage'),
new MyPageSectionClass('fiveItem',$r('app.media.app_icon'),'课程明细','/pages/MyHomePage')
new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'我的账户','/pages/MyHomePage',false),
new MyPageSectionClass('twoItem',$r('app.media.app_icon'),'我的积分','/pages/MyHomePage',false),
new MyPageSectionClass('threeItem',$r('app.media.app_icon'),'我的福利','/pages/MyHomePage',false),
new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'我的鲜花','/pages/MyHomePage',false),
new MyPageSectionClass('fiveItem',$r('app.media.app_icon'),'课件明细','/pages/MyHomePage',false),
new MyPageSectionClass('fiveItem',$r('app.media.app_icon'),'课程明细','/pages/MyHomePage',false)
];
private getPagedItems(): Array<Array<MyPageSectionClass>> {
@@ -9,10 +9,10 @@ export struct TwoSection {
@State currentIndex: number = 0;
@State twoSectionList:Array<MyPageSectionClass> = [
new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'我的视频','/pages/MyHomePage'),
new MyPageSectionClass('twoItem',$r('app.media.app_icon'),'我的课程','/pages/MyHomePage'),
new MyPageSectionClass('threeItem',$r('app.media.app_icon'),'我的下载','/pages/MyHomePage'),
new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'我的收藏','/pages/MyHomePage')
new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'我的视频','/pages/MyHomePage',false),
new MyPageSectionClass('twoItem',$r('app.media.app_icon'),'我的课程','/pages/MyHomePage',false),
new MyPageSectionClass('threeItem',$r('app.media.app_icon'),'我的下载','/pages/MyHomePage',false),
new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'我的收藏','/pages/MyHomePage',false)
];
private getPagedItems(): Array<Array<MyPageSectionClass>> {
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

+6
View File
@@ -0,0 +1,6 @@
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
+17
View File
@@ -0,0 +1,17 @@
/**
* Use these variables when you tailor your ArkTS code. They must be of the const type.
*/
export const HAR_VERSION = '1.0.0';
export const BUILD_MODE_NAME = 'debug';
export const DEBUG = true;
export const TARGET_NAME = 'default';
/**
* BuildProfile Class is used only for compatibility purposes.
*/
export default class BuildProfile {
static readonly HAR_VERSION = HAR_VERSION;
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
static readonly DEBUG = DEBUG;
static readonly TARGET_NAME = TARGET_NAME;
}
+17
View File
@@ -0,0 +1,17 @@
export { MainPage } from './src/main/ets/components/MainPage';
export { PatientApplyPage } from './src/main/ets/components/PatientApplyPage'
export { PatientSetMsgPage } from './src/main/ets/components/PatientSetMsgPage'
export { applyListCallBacl, applyListModel, applyHistoryCallBacl , historyObjectModel, historyModel } from './src/main/ets/models/ApplyModel'
export { PatientsGroup } from './src/main/ets/components/PatientsGroup'
export { groupRequest,groupRequestCall,groupModel,patientListModel } from './src/main/ets/models/PatientsGroupModel'
export { BuildOrEditGroupPage } from './src/main/ets/components/BuildOrEditGroupPage'
export { PatientsListComp } from './src/main/ets/components/PatientsListComp'
export { PatientDetailsComp } from './src/main/ets/components/PatientDetailsComp'
+31
View File
@@ -0,0 +1,31 @@
{
"apiType": "stageMode",
"buildOption": {
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": false,
"files": [
"./obfuscation-rules.txt"
]
},
"consumerFiles": [
"./consumer-rules.txt"
]
}
},
},
],
"targets": [
{
"name": "default"
},
{
"name": "ohosTest"
}
]
}
View File
+6
View File
@@ -0,0 +1,6 @@
import { harTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
+23
View File
@@ -0,0 +1,23 @@
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
-enable-property-obfuscation
-enable-toplevel-obfuscation
-enable-filename-obfuscation
-enable-export-obfuscation
+25
View File
@@ -0,0 +1,25 @@
{
"meta": {
"stableOrder": true
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@itcast/basic@../../commons/basic": "@itcast/basic@../../commons/basic",
"refreshlib@../../RefreshLib": "refreshlib@../../RefreshLib"
},
"packages": {
"@itcast/basic@../../commons/basic": {
"name": "@itcast/basic",
"version": "1.0.0",
"resolved": "../../commons/basic",
"registryType": "local"
},
"refreshlib@../../RefreshLib": {
"name": "refreshlib",
"version": "1.0.0",
"resolved": "../../RefreshLib",
"registryType": "local"
}
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"name": "patient",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "Index.ets",
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@itcast/basic": "file:../../commons/basic",
"refreshlib": "file:../../RefreshLib"
}
}
@@ -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)
}
+11
View File
@@ -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"
}
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

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
}
}
+5
View File
@@ -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);
});
});
}