|
@@ -13,6 +13,7 @@ import (
|
|
|
|
|
|
import (
|
|
|
"auth-server/common"
|
|
|
+ "auth-server/logger"
|
|
|
pb "auth-server/rpc_idl/dr_protocol_pb"
|
|
|
)
|
|
|
|
|
@@ -29,7 +30,10 @@ type Protocol struct {
|
|
|
}
|
|
|
|
|
|
func (s *Protocol) Setup() {
|
|
|
- conn, err := grpc.NewClient(common.ServerConfig.Protocol, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
|
|
+ conn, err := grpc.NewClient(common.ServerConfig.Protocol,
|
|
|
+ grpc.WithTransportCredentials(insecure.NewCredentials()),
|
|
|
+ grpc.WithUnaryInterceptor(logger.GRPCLoggerClientInterceptor(logger.WithGroup("grpc_c[protocol]"))),
|
|
|
+ )
|
|
|
if err != nil {
|
|
|
slog.Error("NewClient failed", "err", err)
|
|
|
panic(err)
|
|
@@ -42,12 +46,10 @@ func (s *Protocol) Setup() {
|
|
|
}
|
|
|
|
|
|
func (s *Protocol) GetSoftwareInfo() *pb.SoftwareInfoReply {
|
|
|
- slog.Info("[rpc]SoftwareInfo...")
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond)
|
|
|
defer cancel()
|
|
|
r, err := s.basicClient.SoftwareInfo(ctx, &emptypb.Empty{})
|
|
|
if err != nil {
|
|
|
- slog.Error("[rpc]SoftwareInfo failed", "err", err)
|
|
|
return &pb.SoftwareInfoReply{
|
|
|
Module: "",
|
|
|
Desc: "",
|
|
@@ -59,77 +61,52 @@ func (s *Protocol) GetSoftwareInfo() *pb.SoftwareInfoReply {
|
|
|
}
|
|
|
|
|
|
func (s *Protocol) GetPatientTypeList(ctx context.Context, isEnabled *bool) (*pb.PatientTypeReply, error) {
|
|
|
- slog.Info("[rpc]GetPatientTypeList...")
|
|
|
r, err := s.protocolClient.GetPatientTypeList(ctx, &pb.PatientTypeRequest{
|
|
|
IsEnabled: isEnabled,
|
|
|
})
|
|
|
- if err != nil {
|
|
|
- slog.Error("[rpc]GetPatientType failed", "err", err)
|
|
|
- }
|
|
|
- slog.Info("[rpc]GetPatientTypeList result", "rows", len(r.PatientTypeList))
|
|
|
return r, err
|
|
|
}
|
|
|
|
|
|
func (s *Protocol) GetBodyPartList(ctx context.Context, patientType *string, modality *string, isEnabled *bool) (*pb.BodyPartReply, error) {
|
|
|
- slog.Info("[rpc]GetBodyPartList...")
|
|
|
r, err := s.protocolClient.GetBodyPartList(ctx, &pb.BodyPartRequest{
|
|
|
PatientType: patientType,
|
|
|
Modality: modality,
|
|
|
IsEnabled: isEnabled,
|
|
|
})
|
|
|
- if err != nil {
|
|
|
- slog.Error("[rpc]GetBodyPartList failed", "err", err)
|
|
|
- }
|
|
|
return r, err
|
|
|
}
|
|
|
|
|
|
func (s *Protocol) GetProcedureList(ctx context.Context, patientType *string, bodyPart *string, isEnabled *bool) (*pb.ProcedureReply, error) {
|
|
|
- slog.Info("[rpc]GetProcedureList...")
|
|
|
r, err := s.protocolClient.GetProcedureList(ctx, &pb.ProcedureRequest{
|
|
|
PatientType: patientType,
|
|
|
BodyPartId: bodyPart,
|
|
|
IsEnabled: isEnabled,
|
|
|
})
|
|
|
- if err != nil {
|
|
|
- slog.Error("[rpc]GetProcedureList failed", "err", err)
|
|
|
- }
|
|
|
return r, err
|
|
|
}
|
|
|
|
|
|
func (s *Protocol) GetViewList(ctx context.Context, patientType *string, bodyPart *string, procedureID *string, isEnabled *bool) (*pb.ViewReply, error) {
|
|
|
- slog.Info("[rpc]GetViewList...")
|
|
|
r, err := s.protocolClient.GetViewList(ctx, &pb.ViewRequest{
|
|
|
PatientType: patientType,
|
|
|
BodyPartId: bodyPart,
|
|
|
ProcedureId: procedureID,
|
|
|
IsEnabled: isEnabled,
|
|
|
})
|
|
|
- if err != nil {
|
|
|
- slog.Error("[rpc]GetViewList failed", "err", err)
|
|
|
- }
|
|
|
return r, err
|
|
|
}
|
|
|
|
|
|
func (s *Protocol) GetView(ctx context.Context, id *string) (*pb.View, error) {
|
|
|
- slog.Info("[rpc]GetView...")
|
|
|
r, err := s.protocolClient.GetView(ctx, &pb.IDRequest{
|
|
|
InstanceId: id,
|
|
|
})
|
|
|
- if err != nil {
|
|
|
- slog.Error("[rpc]GetViewList failed", "err", err)
|
|
|
- }
|
|
|
return r, err
|
|
|
}
|
|
|
|
|
|
func (s *Protocol) GetApr(ctx context.Context, viewID *string, aprID *string, isEnabled *bool) (*pb.AprReply, error) {
|
|
|
- slog.Info("[rpc]GetApr...")
|
|
|
r, err := s.aprClient.GetApr(ctx, &pb.AprRequest{
|
|
|
ViewId: viewID,
|
|
|
AprId: aprID,
|
|
|
IsEnabled: isEnabled,
|
|
|
})
|
|
|
- if err != nil {
|
|
|
- slog.Error("[rpc]GetApr failed", "err", err)
|
|
|
- }
|
|
|
return r, err
|
|
|
}
|