123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- import 'dart:convert';
- import 'package:fis_common/logger/logger.dart';
- import 'package:fis_jsonrpc/rpc.dart';
- import 'package:vitalapp/managers/interfaces/registration.dart';
- import 'package:vitalapp/rpc.dart';
- import 'package:vitalapp/store/store.dart';
- class RegistrationManager implements IRegistrationManager {
- /// 新增登记
- @override
- Future<String?> addRegiterInfoAsync(
- {required AddRegiterInfoRequest request}) async {
- try {
- request.token = Store.user.token;
- print(jsonEncode(request));
- final getExamBookingByIDCard =
- await rpc.vitalHealthExamBooking.addRegiterInfoAsync(
- request,
- );
- return getExamBookingByIDCard;
- } catch (e) {
- logger.e("RegistrationManager sync addRegiterInfoAsync error.", e);
- return null;
- }
- }
- /// 登记列表
- @override
- Future<PageResult<RegisterInfoDTO>?> getRegisterInfoPageAsync({
- int? pageSize = 10,
- int? pageIndex = 1,
- String? keyword,
- DateTime? startTime,
- DateTime? endTime,
- }) async {
- try {
- GetRegiterInfoPageRequest request = GetRegiterInfoPageRequest(
- pageSize: pageSize!,
- pageIndex: pageIndex!,
- keyword: keyword,
- startTime: startTime?.toUtc(),
- endTime: endTime?.toUtc(),
- );
- request.token = Store.user.token;
- final getExamBookingByIDCard =
- await rpc.vitalHealthExamBooking.getRegisterInfoPageAsync(
- request,
- );
- return getExamBookingByIDCard;
- } catch (e) {
- logger.e("RegistrationManager sync getRegisterInfoPageAsync error.", e);
- return null;
- }
- }
- /// 更新登记
- @override
- Future<bool?> updateRegiterInfoAsync({
- required UpdateRegiterInfoRequest request,
- }) async {
- try {
- // request.token = Store.user.token;
- final getExamBookingByIDCard =
- await rpc.vitalHealthExamBooking.updateRegiterInfoAsync(
- request,
- );
- return getExamBookingByIDCard;
- } catch (e) {
- logger.e("RegistrationManager sync addRegiterInfoAsync error.", e);
- return null;
- }
- }
- ///
- @override
- Future<List<ExamDTO>?> getExamListByPhysicalExamNumberAsync({
- required String physicalExamNumber,
- }) async {
- try {
- var request = GetExamListByPhysicalExamNumberRequest();
- // request.token = Store.user.token;
- request.physicalExamNumber = physicalExamNumber;
- final examList = await rpc.vitalExam.getExamListByPhysicalExamNumberAsync(
- request,
- );
- return examList;
- } catch (e) {
- logger.e(
- "RegistrationManager sync getExamListByPhysicalExamNumberAsync error.",
- e);
- return null;
- }
- }
- @override
- Future<List<ReportDTO2>?> getVitalReportInfoAsync(
- {required String physicalExamNumber}) async {
- try {
- var request = GetVitalReportInfoByPhysicalExamNumberRequest();
- // request.token = Store.user.token;
- request.physicalExamNumber = physicalExamNumber;
- final examList = await rpc.report.getVitalReportInfoAsync(
- request,
- );
- return examList;
- } catch (e) {
- logger.e("RegistrationManager sync getVitalReportInfoAsync error.", e);
- return null;
- }
- }
- @override
- Future<bool> updateResultsAndSuggestionsAsync(
- String code, String resultsAndSuggestions) async {
- var request = UpdateResultsAndSuggestionsRequest(
- token: Store.user.token,
- code: code,
- resultsAndSuggestions: resultsAndSuggestions,
- );
- print(jsonEncode(request));
- var result = await rpc.vitalHealthExamBooking
- .updateResultsAndSuggestionsAsync(request);
- return result;
- }
- Future<ElectrocardiogramRecord?> getElectrocardiogramRecordAsync({
- required String physicalExamNumber,
- }) async {
- try {
- var request = GetElectrocardiogramRecordRequest();
- request.token = Store.user.token;
- // request.physicalExamNumber = physicalExamNumber;
- final electrocardiogramRecord =
- await rpc.vitalElectrocardiogram.getElectrocardiogramRecordAsync(
- request,
- );
- return electrocardiogramRecord;
- } catch (e) {
- logger.e(
- "RegistrationManager sync getElectrocardiogramRecordAsync error.", e);
- return null;
- }
- }
- @override
- Future<ElectrocardiogramRecord?>
- getElectrocardiogramRecordByPhysicalExamNumberAsync({
- required String physicalExamNumber,
- }) async {
- try {
- var request = GetElectrocardiogramRecordByPhysicalExamNumberRequest();
- request.physicalExamNumber = physicalExamNumber;
- final examList = await rpc.vitalElectrocardiogram
- .getElectrocardiogramRecordByPhysicalExamNumberAsync(
- request,
- );
- return examList;
- } catch (e) {
- logger.e(
- "RegistrationManager sync getElectrocardiogramRecordByPhysicalExamNumberAsync error.",
- e);
- return null;
- }
- }
- @override
- Future<PageCollection<ElectrocardiogramRecord>?>
- getElectrocardiogramRecordPageAsync({
- int? pageSize = 10,
- int? pageIndex = 1,
- String? keyword,
- }) async {
- try {
- var request = ElectrocardiogramRecordPageRequest(
- pageSize: pageSize!,
- pageIndex: pageIndex!,
- keyWord: keyword,
- );
- request.token = Store.user.token;
- final electrocardiogramRecordList =
- await rpc.vitalElectrocardiogram.getElectrocardiogramRecordPageAsync(
- request,
- );
- return electrocardiogramRecordList;
- } catch (e) {
- logger.e(
- "RegistrationManager sync getElectrocardiogramRecordPageAsync error.",
- e);
- return null;
- }
- }
- }
|