first commit
This commit is contained in:
29
services/terminology/terminology.store.go
Normal file
29
services/terminology/terminology.store.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package terminology
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"sismedika.com/sas/westone/types"
|
||||
)
|
||||
|
||||
type Store struct {
|
||||
db *sqlx.DB
|
||||
}
|
||||
|
||||
func NewStore(db *sqlx.DB) *Store {
|
||||
return &Store{db: db}
|
||||
}
|
||||
|
||||
func (s *Store) GetTerminologyDisplay(code string, system string) (*types.CodeableTerminology, error) {
|
||||
term := new(types.CodeableTerminology)
|
||||
|
||||
qry := `
|
||||
SELECT code, display, code_system
|
||||
FROM terminology
|
||||
WHERE code = ? AND code_system = ?
|
||||
`
|
||||
if err := s.db.Get(term, qry, code, system); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return term, nil
|
||||
}
|
||||
Reference in New Issue
Block a user