patient.dart 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import 'dart:core';
  2. import 'package:fis_jsonrpc/client_base.dart';
  3. import 'package:fis_common/json_convert.dart';
  4. import 'patient.m.dart';
  5. import 'liveConsultation.m.dart';
  6. class PatientService extends JsonRpcClientBase {
  7. PatientService(
  8. String host, {
  9. String serviceName = "IPatientService",
  10. Map<String, String>? headers,
  11. int? timeout,
  12. }) : super(
  13. host,
  14. serviceName,
  15. headers: headers,
  16. timeout: timeout,
  17. ) {
  18. /// 注册响应实体反序列化处理器
  19. FJsonConvert.setDecoder((map) => PageResult<ClientPatientInfoBaseDTO>.fromJson(map));
  20. FJsonConvert.setDecoder((map) => ClientPatientInfoBaseDTO.fromJson(map));
  21. FJsonConvert.setDecoder((map) => ClientPatientInfoDTO.fromJson(map));
  22. }
  23. Future<String> createPatientAsync(CreatePatientRequest request) async {
  24. var rpcRst = await call("CreatePatientAsync", request);
  25. return rpcRst;
  26. }
  27. Future<bool> createPatientByUnregisteredAsync(CreatePatientByUnregisteredRequest request) async {
  28. var rpcRst = await call("CreatePatientByUnregisteredAsync", request);
  29. return rpcRst;
  30. }
  31. Future<String> createUnregisteredPatientAsync(CreatePatientByUnregisteredRequest request) async {
  32. var rpcRst = await call("CreateUnregisteredPatientAsync", request);
  33. return rpcRst;
  34. }
  35. Future<bool> updatePatientAsync(UpdatePatientRequest request) async {
  36. var rpcRst = await call("UpdatePatientAsync", request);
  37. return rpcRst;
  38. }
  39. Future<bool> createPatientsAsync(CreatePatientsRequest request) async {
  40. var rpcRst = await call("CreatePatientsAsync", request);
  41. return rpcRst;
  42. }
  43. Future<PageResult<ClientPatientInfoBaseDTO>> findPatientsAsync(FindPatientsPageRequest request) async {
  44. var rpcRst = await call("FindPatientsAsync", request);
  45. var result = PageResult<ClientPatientInfoBaseDTO>.fromJson(rpcRst as Map<String, dynamic>);
  46. return result;
  47. }
  48. Future<ClientPatientInfoDTO> findPatientByCodeAsync(FindPatientByCodeRequest request) async {
  49. var rpcRst = await call("FindPatientByCodeAsync", request);
  50. var result = ClientPatientInfoDTO.fromJson(rpcRst as Map<String, dynamic>);
  51. return result;
  52. }
  53. Future<List<ClientPatientInfoBaseDTO>> findValidPatientsByNameAsync(FindValidPatientsByNameRequest request) async {
  54. var rpcRst = await call("FindValidPatientsByNameAsync", request);
  55. var result = (rpcRst as List).map((e)=>ClientPatientInfoBaseDTO.fromJson(e as Map<String, dynamic>)).toList();
  56. return result;
  57. }
  58. Future<bool> setValidPatientAsync(SetValidPatientRequest request) async {
  59. var rpcRst = await call("SetValidPatientAsync", request);
  60. return rpcRst;
  61. }
  62. Future<bool> removePatientsAsync(RemovePatientsRequest request) async {
  63. var rpcRst = await call("RemovePatientsAsync", request);
  64. return rpcRst;
  65. }
  66. }