ordonnance.go 808 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package third
  2. import (
  3. "ordonnance/common/util"
  4. "ordonnance/server/dao"
  5. "ordonnance/server/model"
  6. "ordonnance/server/response"
  7. "github.com/gin-gonic/gin"
  8. )
  9. // 显示二维码
  10. func GetordonnanceQrcode(c *gin.Context) {
  11. id := c.Param("ordonnanceId")
  12. ordonnance, err := dao.GetOrdonnance(id)
  13. if err != nil {
  14. response.FailWithMessage("要放不存在", c)
  15. return
  16. }
  17. filename := util.MakeImg(ordonnance)
  18. c.File(filename)
  19. }
  20. // 获取数据
  21. func GetordonnanceDetail(c *gin.Context) {
  22. id := c.Param("ordonnanceId")
  23. ordonnance, err := dao.GetOrdonnance(id)
  24. if err != nil {
  25. response.FailWithMessage(id+"药方不存在", c)
  26. return
  27. }
  28. list, err := dao.GetOrdonnanceItemList(id)
  29. data := model.VordonnanceDetail{
  30. Ordonnance: ordonnance,
  31. Detail: list,
  32. }
  33. response.OkWithData(data, c)
  34. }