new_self_drug_api_controller.go 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package new_mobile_api_controllers
  2. import (
  3. "Xcx_New/controllers/mobile_api_controllers"
  4. "Xcx_New/enums"
  5. "Xcx_New/service"
  6. "fmt"
  7. )
  8. type NewDrugApiController struct {
  9. mobile_api_controllers.MobileBaseAPIAuthController
  10. }
  11. func (this *NewDrugApiController) GetSelfMedicalList() {
  12. patient_id, _ := this.GetInt64("patient_id")
  13. fmt.Println("222222222", patient_id)
  14. adminUserInfo := this.GetMobileAdminUserInfo()
  15. orgId := adminUserInfo.Org.Id
  16. medical, _ := service.GetSetSelfMedical(orgId)
  17. //开启
  18. if medical.DrugStart == 1 {
  19. list, err := service.GetSelfMedicalList(patient_id)
  20. if err != nil {
  21. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取自备药失败")
  22. return
  23. }
  24. this.ServeSuccessJSON(map[string]interface{}{
  25. "medicalList": list,
  26. })
  27. }
  28. }
  29. func (this *NewDrugApiController) GetDrugDescByDrugName() {
  30. drug_name := this.GetString("drug_name")
  31. fmt.Println("drug_name", drug_name)
  32. patient_id, _ := this.GetInt64("patient_id")
  33. fmt.Println("patient_id", patient_id)
  34. adminUserInfo := this.GetMobileAdminUserInfo()
  35. orgId := adminUserInfo.Org.Id
  36. drugspec, err := service.GetDrugDescByDrugName(drug_name, patient_id, orgId)
  37. if err != nil {
  38. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
  39. return
  40. }
  41. this.ServeSuccessJSON(map[string]interface{}{
  42. "drugspec": drugspec,
  43. })
  44. }