shao 3 днів тому
батько
коміт
ea82f95888
4 змінених файлів з 30 додано та 1 видалено
  1. 13 0
      api/v1/protocol.go
  2. 2 0
      router/router.go
  3. 1 1
      rpc_idl
  4. 14 0
      service/pb_protocol.go

+ 13 - 0
api/v1/protocol.go

@@ -42,3 +42,16 @@ func GetProcedure(c *gin.Context) {
 	}
 	common.HttpSuccess(c, res)
 }
+
+func GetView(c *gin.Context) {
+	res, err := service.ProtocolService.GetView(common.GC2GM(c),
+		common.GetQueryString(c, "patient_type"),
+		common.GetQueryString(c, "body_part"),
+		common.GetQueryString(c, "procedure_id"),
+		common.IsEnabled(c))
+	if err != nil {
+		common.HttpErr(c, err)
+		return
+	}
+	common.HttpSuccess(c, res)
+}

+ 2 - 0
router/router.go

@@ -20,6 +20,7 @@ func InitRouter() *gin.Engine {
 	{
 		pubV1.GET("/ping", apiv1.Ping)
 		pubV1.GET("software_info", apiv1.SoftwareInfo)
+		pubV1.Static("Image", "../Image")
 		pubV1.POST("login", apiv1.Login)
 	}
 	authV1 := v1.Group("/auth")
@@ -35,6 +36,7 @@ func InitRouter() *gin.Engine {
 			protocolV1.GET("patient_type", apiv1.GetPatientType)
 			protocolV1.GET("body_part", apiv1.GetBodyPart)
 			protocolV1.GET("procedure", apiv1.GetProcedure)
+			protocolV1.GET("view", apiv1.GetView)
 		}
 		dicomV1 := authV1.Group("/dicom")
 		{

+ 1 - 1
rpc_idl

@@ -1 +1 @@
-Subproject commit 5efb772b596de87144c15dda4375c4eca7fe6232
+Subproject commit c7adaf6cbec4584dc9793b9ef81b8982ca12f8ce

+ 14 - 0
service/pb_protocol.go

@@ -89,3 +89,17 @@ func (s *Protocol) GetProcedure(ctx context.Context, patientType *string, bodyPa
 	}
 	return r, err
 }
+
+func (s *Protocol) GetView(ctx context.Context, patientType *string, bodyPart *string, procedureID *string, isEnabled *bool) (*pb.ViewReply, error) {
+	slog.Info("[rpc]GetView...")
+	r, err := s.protocolClient.GetView(ctx, &pb.ViewRequest{
+		PatientType: patientType,
+		BodyPartId:  bodyPart,
+		ProcedureId: procedureID,
+		IsEnabled:   isEnabled,
+	})
+	if err != nil {
+		slog.Error("[rpc]GetView failed:", err)
+	}
+	return r, err
+}