123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- import 'package:fis_common/logger/logger.dart';
- import 'package:fis_jsonrpc/rpc.dart';
- import 'package:vitalapp/managers/interfaces/appointment.dart';
- import 'package:vitalapp/rpc.dart';
- import 'package:vitalapp/store/store.dart';
- class AppointmentManager implements IAppointmentManager {
- /// 分页获取健康检查预约数据
- @override
- Future<PageResult<HealthExamBookingDTO>?> getHealthExamBookingPageAsync({
- int? pageSize = 10,
- int? pageIndex = 1,
- String? keyword,
- }) async {
- try {
- GetHealthExamBookingPageRequest healthExamBookingPageRequest =
- GetHealthExamBookingPageRequest();
- healthExamBookingPageRequest.token = Store.user.token;
- healthExamBookingPageRequest.pageIndex = pageIndex!;
- healthExamBookingPageRequest.pageSize = pageSize!;
- healthExamBookingPageRequest.keyword = keyword;
- final healthExamBooking =
- await rpc.vitalHealthExamBooking.getHealthExamBookingPageAsync(
- healthExamBookingPageRequest,
- );
- return healthExamBooking;
- } catch (e) {
- logger.e(
- "AppointmentManager sync getHealthExamBookingPageAsync error.", e);
- return null;
- }
- }
- /// 删除体检信息
- @override
- Future<bool?> deleteHealthExamBookingAsync(
- DeleteHealthExamBookingRequest deleteHealthExamBookingRequest) async {
- try {
- final healthExamBooking =
- await rpc.vitalHealthExamBooking.deleteHealthExamBookingAsync(
- deleteHealthExamBookingRequest,
- );
- return healthExamBooking;
- } catch (e) {
- logger.e(
- "AppointmentManager sync getHealthExamBookingPageAsync error.", e);
- return null;
- }
- }
- /// 查询体检详情
- @override
- Future<HealthExamBookingDTO?> getHealthExamBookingAsync({
- required String code,
- }) async {
- try {
- GetHealthExamBookingRequest healthExamBookingRequest =
- GetHealthExamBookingRequest();
- healthExamBookingRequest.token = Store.user.token;
- healthExamBookingRequest.code = code;
- final healthExamBooking =
- await rpc.vitalHealthExamBooking.getHealthExamBookingAsync(
- healthExamBookingRequest,
- );
- return healthExamBooking;
- } catch (e) {
- logger.e(
- "AppointmentManager sync getHealthExamBookingPageAsync error.", e);
- return null;
- }
- }
- /// 新增/修改体检信息
- @override
- Future<String?> saveHealthExamBookingAsync(
- SaveHealthExamBookingRequest saveHealthExamBookingRequest) async {
- try {
- saveHealthExamBookingRequest.token = Store.user.token;
- final healthExamBooking =
- await rpc.vitalHealthExamBooking.saveHealthExamBookingAsync(
- saveHealthExamBookingRequest,
- );
- return healthExamBooking;
- } catch (e) {
- logger.e(
- "AppointmentManager sync getHealthExamBookingPageAsync error.", e);
- return null;
- }
- }
- /// 根据身份证获取预约信息
- @override
- Future<HealthExamPersonDTO?> getExamBookingByIDCardAsync({
- String? idCardNo,
- }) async {
- try {
- GetExamBookingByIDCardRequest examBookingByIDCard =
- GetExamBookingByIDCardRequest();
- examBookingByIDCard.token = Store.user.token;
- examBookingByIDCard.iDCardNo = idCardNo;
- final getExamBookingByIDCard =
- await rpc.vitalHealthExamBooking.getExamBookingByIDCardAsync(
- examBookingByIDCard,
- );
- return getExamBookingByIDCard;
- } catch (e) {
- logger.e("AppointmentManager sync getExamBookingByIDCardAsync error.", e);
- return null;
- }
- }
- }
|