Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Merge branch 'dev' into get-doctor-order
Browse files Browse the repository at this point in the history
  • Loading branch information
smalho01 authored Mar 27, 2023
2 parents 8feb5b1 + 869f764 commit c63fd2b
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 31 deletions.
10 changes: 8 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class App extends Component {
response: null,
priorAuthClaim: null,
specialtyRxBundle: null,
remsAdminResponse: null,
cqlPrepopulationResults: null,
orderResource: null,
bundle: null,
Expand Down Expand Up @@ -392,6 +393,10 @@ export default class App extends Component {
this.setState({ specialtyRxBundle: specialtyRxBundleParam });
}

setRemsAdminResponse(remsAdminResponse) {
this.setState({remsAdminResponse})
}

getQuestionByName(question) {
//question should be the HTML node
const temp = question.getElementsByClassName("lf-item-code ng-hide")[0].innerText.trim();
Expand Down Expand Up @@ -637,8 +642,8 @@ export default class App extends Component {
>

</div>
{this.state.specialtyRxBundle ? (
<RemsInterface specialtyRxBundle={this.state.specialtyRxBundle} />
{this.state.specialtyRxBundle && this.state.remsAdminResponse ? (
<RemsInterface specialtyRxBundle={this.state.specialtyRxBundle} remsAdminResponse={this.state.remsAdminResponse}/>
) : (
<QuestionnaireForm
qform={this.state.questionnaire}
Expand All @@ -653,6 +658,7 @@ export default class App extends Component {
priorAuthReq={this.props.priorAuthReq === "true" ? true : false}
setPriorAuthClaim={this.setPriorAuthClaim.bind(this)}
setSpecialtyRxBundle={this.setSpecialtyRxBundle.bind(this)}
setRemsAdminResponse={this.setRemsAdminResponse.bind(this)}
fhirVersion={this.fhirVersion.toUpperCase()}
smart={this.smart}
renderButtons={this.renderButtons}
Expand Down
38 changes: 38 additions & 0 deletions src/components/QuestionnaireForm/AlertDialog.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as React from 'react';
import { Dialog, DialogContent, DialogContentText, DialogTitle, DialogActions, Button } from '@material-ui/core';

export default function AlertDialog(props) {
const { title, rxAlert, setRxAlert } = props;

const handleClose = () => {
setRxAlert({ open: false });
};
return (
<div>
<Dialog
open={rxAlert.open}
onClose={handleClose}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle id="alert-dialog-title">
{title}
</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">
{rxAlert.description}
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>Close</Button>
{rxAlert.callback ?
<Button onClick={rxAlert.callback} autoFocus>
Yes
</Button>
:
null}
</DialogActions>
</Dialog>
</div>
);
}
26 changes: 24 additions & 2 deletions src/components/QuestionnaireForm/QuestionnaireForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import ConfigData from "../../config.json";
import ReactDOM from 'react-dom'

import retrieveQuestions, { buildNextQuestionRequest } from "../../util/retrieveQuestions";
import axios from "axios";
import AlertDialog from "./AlertDialog";

// NOTE: need to append the right FHIR version to have valid profile URL
var DTRQuestionnaireResponseURL = "http://hl7.org/fhir/us/davinci-dtr/StructureDefinition/dtr-questionnaireresponse-";
Expand All @@ -32,7 +34,8 @@ export default class QuestionnaireForm extends Component {
popupOptions: [],
popupFinalOption: "Cancel",
formFilled: true,
formValidationErrors: []
formValidationErrors: [],
showRxAlert: {open: false}
};

this.outputResponse = this.outputResponse.bind(this);
Expand Down Expand Up @@ -1362,7 +1365,25 @@ export default class QuestionnaireForm extends Component {


this.props.setPriorAuthClaim(priorAuthBundle);
this.props.setSpecialtyRxBundle(specialtyRxBundle);
const options = {
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
}
axios.post("http://localhost:8090/etasu/met", specialtyRxBundle, options).then((response) => {
const proceedToRems = () => {
this.props.setSpecialtyRxBundle(specialtyRxBundle);
this.props.setRemsAdminResponse(response)
}
if(response.status == 201) {
proceedToRems()
} else if(response.status == 200) {
this.setState({showRxAlert: {response: response, rxBundle: specialtyRxBundle, description: "Form was already submitted previously. View current case?", open: true, callback: proceedToRems}})
}
}).catch((e)=>{
this.setState({showRxAlert: {description: "Encountered an error", open:true}})
})
} else {
alert("Prior Auth Bundle is not available or does not contain enough resources for Prior Auth. Can't submit to prior auth.")
}
Expand Down Expand Up @@ -1564,6 +1585,7 @@ export default class QuestionnaireForm extends Component {
/>
) : null
}
<AlertDialog title="Alert" rxAlert={this.state.showRxAlert} setRxAlert={(e)=>{this.setState({showRxAlert: e})}}></AlertDialog>
{
isAdaptiveForm ? (
<div className="form-message-panel">
Expand Down
44 changes: 17 additions & 27 deletions src/components/RemsInterface/RemsInterface.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class RemsInterface extends Component {
<div>
<div className={"resource-entry etasu-container"}>
<div className={"resource-entry-text"} >{metReq.requirementName}</div>
<div className={"resource-entry-icon"}>{metReq.completed ? "✅" : "❌"}</div>
<div className={"resource-entry-icon"}>{metReq.completed ? "✅" : "❌"}</div>
<div className={"resource-entry-hover"}>{metReq.requirementDescription}</div>
</div>
</div>
Expand All @@ -80,14 +80,13 @@ export default class RemsInterface extends Component {
}
return null;
}

async sendRemsMessage() {
const remsAdminResponse = await axios.post("http://localhost:8090/etasu/met", this.props.specialtyRxBundle, this.getAxiosOptions());
console.log(remsAdminResponse)
const remsAdminResponse = this.props.remsAdminResponse
this.setState({ remsAdminResponse });

// Will not send post request to PIS if only for patient enrollment
if(this.state.remsAdminResponse?.data?.case_number){
if (this.state.remsAdminResponse?.data?.case_number) {

// extract params and questionnaire response identifier
let params = this.getResource(this.props.specialtyRxBundle, this.props.specialtyRxBundle.entry[0].resource.focus.parameters.reference);
Expand Down Expand Up @@ -160,7 +159,7 @@ export default class RemsInterface extends Component {

refreshPisBundle() {
this.setState({ spinPis: true });

let params = this.getResource(this.props.specialtyRxBundle, this.props.specialtyRxBundle.entry[0].resource.focus.parameters.reference);

// stakeholder and medication references
Expand Down Expand Up @@ -218,14 +217,11 @@ export default class RemsInterface extends Component {
}

// Checking if REMS Request (pt enrollment) || Met Requirments (prescriber Form)
let hasRemsResponse = this.state.remsAdminResponse?.data ? true : false
let hasRemsCase = this.state.remsAdminResponse?.data?.case_number ? true : false;

return (
<div>
{
hasRemsResponse ?
<div>
<div>
{hasRemsCase ?
<div>
<div className="container left-form">
Expand All @@ -241,7 +237,7 @@ export default class RemsInterface extends Component {
<div className="bundle-entry">
<Button variant="contained" onClick={this.toggleBundle}>View Bundle</Button>
<Button variant="contained" onClick={this.toggleResponse}>View ETASU</Button>

{this.state.remsAdminResponse?.data?.case_number ?
<AutorenewIcon
className={this.state.spin === true ? "refresh" : "renew-icon"}
Expand All @@ -250,9 +246,9 @@ export default class RemsInterface extends Component {
/>
: ""
}

</div>

</Paper>
{this.state.viewResponse ?
<div className="bundle-view">
Expand All @@ -267,9 +263,9 @@ export default class RemsInterface extends Component {
<h3>Bundle</h3>
{this.renderBundle(this.props.specialtyRxBundle)}
</div> : ""}

</div>

<div className="right-form">
<h1>Pharmacy Status</h1>
<Paper style={{ paddingBottom: "5px" }}>
Expand All @@ -291,7 +287,7 @@ export default class RemsInterface extends Component {
: ""
}
</div>

</Paper>
{this.state.viewPisBundle ? <div className="bundle-view">
<br></br>
Expand All @@ -311,7 +307,7 @@ export default class RemsInterface extends Component {
</div>
<div className="bundle-entry">
<Button variant="contained" onClick={this.toggleBundle}>View Bundle</Button>

{this.state.remsAdminResponse?.data?.case_number ?
<AutorenewIcon
className={this.state.spin === true ? "refresh" : "renew-icon"}
Expand All @@ -321,24 +317,18 @@ export default class RemsInterface extends Component {
: ""
}
</div>

</Paper>
{this.state.viewBundle ? <div className="bundle-view">
<br></br>
<h3>Bundle</h3>
{this.renderBundle(this.props.specialtyRxBundle)}
</div> : ""}

</div>
</div>
}
</div>
:
<div>
No response - form has already been submitted previously....
</div>
}

</div>
</div>
)
}
Expand Down

0 comments on commit c63fd2b

Please sign in to comment.