package service import ( "context" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "protocol-server/common" "protocol-server/models" ) import ( pb "protocol-server/rpc_idl/dr_protocol_pb" ) type ProtocolServer struct { pb.UnimplementedProtocolServer } func (s *ProtocolServer) GetPatientType(ctx context.Context, in *pb.PatientTypeRequest) (*pb.PatientTypeReply, error) { product, _, _ := common.GetHeader(ctx) res := pb.PatientTypeReply{} err := models.DB.Model(&models.PatientType{}).Scopes( models.String("product = ?", product.ToString()), ).Order("sort").Find(&res.PatientTypeList).Error if err != nil { return nil, status.Errorf(codes.Internal, "patient_type find err %v", err) } return &res, nil } func (s *ProtocolServer) GetBodyPart(ctx context.Context, in *pb.BodyPartRequest) (*pb.BodyPartReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBodyPart not implemented") }