|
@@ -21,12 +21,30 @@ func (s *ProtocolServer) GetPatientType(ctx context.Context, in *pb.PatientTypeR
|
|
|
res := pb.PatientTypeReply{}
|
|
|
err := models.DB.Model(&models.PatientType{}).Scopes(
|
|
|
models.String("product = ?", product.ToString()),
|
|
|
+ models.Bool("is_enabled = ?", in.IsEnabled),
|
|
|
).Order("sort").Find(&res.PatientTypeList).Error
|
|
|
if err != nil {
|
|
|
return nil, status.Errorf(codes.Internal, "patient_type find err %v", err)
|
|
|
}
|
|
|
+ for _, pt := range res.GetPatientTypeList() {
|
|
|
+ pt.PatientTypeLocal = pt.PatientTypeName
|
|
|
+ }
|
|
|
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")
|
|
|
+ product, _, _ := common.GetHeader(ctx)
|
|
|
+ res := pb.BodyPartReply{}
|
|
|
+ err := models.DB.Model(&models.BodyPart{}).Scopes(
|
|
|
+ models.String("patient_type = ?", in.GetPatientType()),
|
|
|
+ models.String("category = ?", in.GetCategory()),
|
|
|
+ models.String("product = ?", product.ToString()),
|
|
|
+ models.Bool("is_enabled = ?", in.IsEnabled),
|
|
|
+ ).Order("sort").Find(&res.BodyPartList).Error
|
|
|
+ if err != nil {
|
|
|
+ return nil, status.Errorf(codes.Internal, "body_part find err %v", err)
|
|
|
+ }
|
|
|
+ for _, pt := range res.GetBodyPartList() {
|
|
|
+ pt.BodyPartLocal = pt.BodyPartName
|
|
|
+ }
|
|
|
+ return &res, nil
|
|
|
}
|