diff --git a/backend/pkg/models/request_healthsystem.go b/backend/pkg/models/request_healthsystem.go new file mode 100644 index 00000000..309fefa0 --- /dev/null +++ b/backend/pkg/models/request_healthsystem.go @@ -0,0 +1,8 @@ +package models + +type RequestHealthSystem struct { + Email string `json:"email"` + Name string `json:"name"` + Website string `json:"website"` + StreetAddress string `json:"street_address"` +} diff --git a/backend/pkg/web/handler/healthsystem.go b/backend/pkg/web/handler/healthsystem.go new file mode 100644 index 00000000..7c0c1819 --- /dev/null +++ b/backend/pkg/web/handler/healthsystem.go @@ -0,0 +1,53 @@ +package handler + +import ( + "fmt" + "github.com/fastenhealth/fasten-onprem/backend/pkg/models" + "github.com/gin-gonic/gin" + "io/ioutil" + "net/http" + "net/url" +) + +func HealthSystemRequest(c *gin.Context) { + + var healthSystemRequest models.RequestHealthSystem + if err := c.ShouldBindJSON(&healthSystemRequest); err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()}) + return + } + + //submit support request to Google Form + //https://medium.com/front-end-augustus-study-notes/custom-google-form-en-f7be4c27a98b + + //source: https://docs.google.com/forms/d/e/1FAIpQLScH77CFpd3XAuwlUASFDJkOR54pZmt4AHqHa4xtZMGLXb1JIA/viewform?usp=sf_link + formUrl := "https://docs.google.com/forms/u/0/d/e/1FAIpQLScH77CFpd3XAuwlUASFDJkOR54pZmt4AHqHa4xtZMGLXb1JIA/formResponse" + + supportRequestResponse, err := http.PostForm(formUrl, url.Values{ + "entry.583209151": {healthSystemRequest.Email}, + "entry.1753315374": {healthSystemRequest.Name}, + "entry.1863832106": {healthSystemRequest.Website}, + "entry.751017705": {healthSystemRequest.StreetAddress}, + }) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()}) + return + } + + defer supportRequestResponse.Body.Close() + body, err := ioutil.ReadAll(supportRequestResponse.Body) + + if err != nil { + //handle read response error + c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()}) + return + } else if supportRequestResponse.StatusCode != 200 { + //handle non 200 response + c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": fmt.Sprintf("status code error: %d %s", supportRequestResponse.StatusCode, supportRequestResponse.Status)}) + return + } + + fmt.Printf("%s\n", string(body)) + + c.JSON(http.StatusOK, gin.H{"success": true}) +} diff --git a/backend/pkg/web/server.go b/backend/pkg/web/server.go index 1d6eac81..e74a1866 100644 --- a/backend/pkg/web/server.go +++ b/backend/pkg/web/server.go @@ -94,6 +94,7 @@ func (ae *AppEngine) Setup() (*gin.RouterGroup, *gin.Engine) { api.GET("/glossary/code", handler.GlossarySearchByCode) api.POST("/support/request", handler.SupportRequest) + api.POST("/healthsystem/request", handler.HealthSystemRequest) secure := api.Group("/secure").Use(middleware.RequireAuth()) { diff --git a/frontend/src/app/components/form-request-health-system/form-request-health-system.component.html b/frontend/src/app/components/form-request-health-system/form-request-health-system.component.html new file mode 100644 index 00000000..e35327ff --- /dev/null +++ b/frontend/src/app/components/form-request-health-system/form-request-health-system.component.html @@ -0,0 +1,96 @@ +
+ + +Your request has been recorded.
Thanks!
+ No results Try another search term or request this health system. +
+However we can convert it automatically using software generously donated by the team at Health Samurai
This converter is hosted by Fasten Health, Inc. and is subject to our Privacy Policy.
diff --git a/frontend/src/app/pages/medical-sources/medical-sources.component.ts b/frontend/src/app/pages/medical-sources/medical-sources.component.ts
index a0c29a15..657438f5 100644
--- a/frontend/src/app/pages/medical-sources/medical-sources.component.ts
+++ b/frontend/src/app/pages/medical-sources/medical-sources.component.ts
@@ -18,6 +18,7 @@ import {FormControl, FormGroup} from '@angular/forms';
import * as _ from 'lodash';
import {PatientAccessBrand} from '../../models/patient-access-brands';
import {PlatformService} from '../../services/platform.service';
+import {FormRequestHealthSystemComponent} from '../../components/form-request-health-system/form-request-health-system.component';
export const sourceConnectWindowTimeout = 24*5000 //wait 2 minutes (5 * 24 = 120)
@@ -354,6 +355,17 @@ export class MedicalSourcesComponent implements OnInit {
})
}
+ showRequestHealthSystemModal(): Promise