PageSourceSearch

https://online.themedicalcity.com/app/assets/Records.12d2b7d5.js

js themedicalcity.com collected 2026-09-24 09:40:16 UTC 61,178 bytes, 543 lines download raw bytes

1import{T as Ue}from"./Select.af63d20f.js";import{bZ as $e,R as e,fJ as Y,r as i,dE as je,dy as Ke,dF as Xe,c1 as Ge,b as A,c as ne,e4 as Qe,e as _e,f as ee,gN as Ze,bo as Je,aU as Ee,aK as te,a1 as ke,D as ce,B as U,bq as Ie,P as et,gO as tt,O as at,i as ye,c4 as he,gP as oe,f_ as Se,$ as X,o as Me,u as nt,c9 as Ye,gQ as rt,dS as st,c5 as Ce,x as Pe,n as qe,I as be,p as De,L as ve,gR as ot,d as it,aL as We,ch as lt,Z as Te,J as He,gS as ct,aW as we,cQ as mt,aM as dt,aN as pt,gT as ut,gU as Ve,gV as gt,gW as ft,T as re,gX as ht,gY as _t,a3 as Et,fN as yt,fK as bt,gK as vt,gZ as xt,bS as wt,b8 as Nt,g_ as St,aF as Le,cS as Ct,bt as Pt,g$ as kt,g6 as It}from"./index.35979090.js";import{a as Mt}from"./MoreMenu.b575d23c.js";import{C as Dt}from"./Container.2193c760.js";import{d as le,u as Tt,S as Ft,g as Rt,a as Bt,x as qt,b as Ht,c as Lt,e as zt,f as Ot,h as $t,P as Yt,i as Wt,j as Vt,k as At,l as Ut}from"./generateMedicines.75721725.js";import{b as jt,r as Kt}from"./patient.8df7220d.js";import{a as ze,C as Xt,u as Gt,P as Qt}from"./PatientBasicInfo.1ea9ad17.js";import{T as Zt,a as ge,b as Jt}from"./Table.e83223c6.js";import{u as Fe,a as ea}from"./pagination.00e2a576.js";import{o as ta,q as aa}from"./index.0c03ab29.js";import{R as na}from"./Row.b1d77e5e.js";import{a as fe}from"./bcmap.ff7f30cc.js";import{g as ra}from"./bcmap.service.430c197e.js";import{a as sa}from"./cf4.99efd8c8.js";import{M as oa}from"./ManageDiagram.04f2a6bc.js";import{u as ia,P as Oe}from"./printing.da0af672.js";import{u as la,a as ca}from"./DoctorSignature.8e05d1c4.js";import"./session.e3c6841b.js";import"./auth.5088665c.js";import"./TermsAndCondition.b68e0ae5.js";import"./pdf.320bc634.js";import"./HistoryTrail.4ed40888.js";import"./VaccinationsFromProfile.e79902c7.js";import"./canAddToWatchlistPolicy.800aeb44.js";import"./tmc_logo_blue.e7fbd421.js";import"./lodash.ee935b1d.js";import"./PatientList.b6ad5fee.js";import"./Grid.449da3e1.js";import"./BillingInfo.098e38fa.js";import"./logs.service.a0f6d2c3.js";import"./chunk.333c2f0d.js";import"./ToggleOnWatchlist.9837900d.js";import"./useQuery.0159c1c5.js";import"./Lazy.0b3c5a3a.js";import"./index.63a76d13.js";(function(){try{var a=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},t=new Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="e625e9cb-4bcc-40dd-8123-3b83fbef997f",a._sentryDebugIdIdentifier="sentry-dbid-e625e9cb-4bcc-40dd-8123-3b83fbef997f")}catch{}})();var ma=$e(e.createElement("path",{d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"})),da=$e(e.createElement("path",{d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}));function pa(a){const t=[Y.Standard,Y.Cardiology,Y.Endocrinology,Y.Diabetology,Y.Oncology,Y.BCI,Y.Rheumatology,Y.Pulmonology,Y.Pediatrics,Y.ActNow,Y.ENT,Y.Ophthalmology,Y.Ob,Y.Gyne,Y.FPE,Y.Yakap],n=["patientId"];let s={};return t.indexOf(a.encounterType)<0&&(s.encounterType="Invalid Encounter Type"),Mt(a.encounterDate)||(s.encounterDate="Invalid date format (MM/DD/YYYY)"),Object.keys(a).forEach(o=>{!a[o]&&n.indexOf(o)<0&&(s[o]="Required.")}),s}const ua=a=>{const{name:t,label:n,className:s,value:o,options:m,onChange:y}=a,p=e.useRef(null),[c,u]=e.useState(0);return i.exports.useEffect(()=>{p.current&&u(p.current.offsetWidth)},[]),e.createElement(je,{variant:"outlined",className:`c-select ${s}`.trim()},n&&e.createElement(Ke,{ref:p,htmlFor:`outlined-${t}-simple`},n),e.createElement(Xe,{value:o,onChange:y,labelWidth:c,inputProps:{name:t,id:`outlined-${t}-simple`}},m.map(g=>e.createElement(Ge,{value:g.id,key:g.id},e.createElement("em",null,g.value)))))};function ga(a){const{initialValues:t,validator:n,onSuccess:s}=a,[o,m]=i.exports.useState(t),[y,p]=i.exports.useState({}),[c,u]=i.exports.useState({}),[g,b]=i.exports.useState(!1);i.exports.useEffect(()=>{g&&(Object.keys(c).length===0&&s&&s(),b(!1))},[c,g,s]);const D=l=>!!c[l]&&!!y[l]?c[l]:"",M=l=>q=>{if(n){const _=n(o);p({...y,[l]:!0}),u(_)}},L=(l,q=!1,_="update")=>P=>{if(q){let d=o[l];const w=P;switch(_){case"add":d=d.filter(N=>N.id===w.id&&!!N.id).length===0?[...d,w]:d;break;case"remove":d=d.filter(N=>N.id!==w.id);break;case"update":d=d.map(N=>N.id!==w.id?N:w);break}m({...o,[l]:d})}else{let d,w;typeof P=="string"?d=P:(d=P.target.value,w=P.target.type);const N=w==="checkbox"?d==="true":d;typeof P=="string"?x(l,N):m({...o,[l]:N})}};function W(l){if(l.preventDefault(),n){const q=n(o);u(q),p(Object.keys(o).reduce((_,P)=>({..._,[P]:!0}),{}))}b(!0)}function S(){m(t),p({}),u({}),b(!1)}function x(l,q){const _={...o,[l]:q};if(m(_),n){const P=n(_);u(P)}}return{handleChange:L,handleBlur:M,handleSubmit:W,values:o,errors:c,touched:y,getError:D,setValue:x,setValues:m,resetForm:S}}const fa=[{label:"FILE NAME"},{label:"TYPE"},{label:"SECTION"},{label:"DATE ADDED"}],ha=({patientId:a})=>{const[t]=ne(),{fetchHistoricalRecord:n,historicalPHR:s}=Qe(),o={type:"",fromDate:null,toDate:null},[m,y]=i.exports.useState({page:1,perPage:10}),[p,c]=i.exports.useState(o),{getFieldProps:u,handleSubmit:g}=_e({defaultValues:o,enableReinitialize:!0,reValidateMode:"onSubmit",validationSchema:ta}),[{loading:b,value:D},M]=ee(async(...x)=>{const[l,q]=x;try{const{data:_,headers:P}=await Ze(l,q);return y(Je(P)),_&&_.length>0?(_||[]).map(d=>({fileName:d.file_name,fileUrl:d.file_url,id:d.id,fileType:d.file_type,phrId:d.patient_health_record_id,createdAt:d.created_at?new Date(d.created_at):null})):[]}catch(_){console.log(_)}}),L=Fe({pagination:m,onChange:x=>{!b&&M({patientId:a,fromDate:p.fromDate,toDate:p.toDate,global:p.type==="general"?!0:p.type==="encounter"?!1:void 0},x)}}),W=x=>{const l={patientId:a,fromDate:x.fromDate,toDate:x.toDate,global:x.type==="general"?!0:x.type==="encounter"?!1:void 0};c(x),M(l,{page:1,perPage:10})};Ee(()=>{n(a)});const S=i.exports.useMemo(()=>(D||[]).map((x,l)=>{const _=(s==null?void 0:s.id)===x.phrId?"General":"Encounter",P=x.fileName.lastIndexOf("."),d=P>0?x.fileName.substr(P+1):"";return e.createElement(Zt,{key:l},e.createElement(ge,{align:"center"},e.createElement("span",{className:"item-file-name",onClick:()=>window.open(x.fileUrl,"__blank")},x.fileName)),e.createElement(ge,{align:"center"},d),e.createElement(ge,{align:"center"},_),e.createElement(ge,{align:"center"},x.createdAt?te(x.createdAt,"MM-dd-yyyy"):""))}),[D,s]);return e.createElement(_a,null,e.createElement("form",{className:"filter-group",onSubmit:g(W)},e.createElement(ke,{...u("type"),label:"Section",items:[{id:"",value:"[BLANK]"},{id:"encounter",value:"Encounter"},{id:"general",value:"General"}]}),e.createElement(ce,{placeholder:`${t("from")} MM/DD/YYY`,...u("fromDate")}),e.createElement(ce,{placeholder:`${t("to")} MM/DD/YYY`,...u("toDate")}),e.createElement(U,{label:"FILTER",color:"primary",type:"submit"})),e.createElement(Jt,{className:"attachments-table",headers:fa,rows:S,loading:b}),e.createElement(Ie,{pagination:L,loading:b}))},_a=A.div`
2  width: 100%;
3  .filter-group {
4    display: grid;
5    grid-template-columns: 35% 1fr 1fr 1fr;
6    grid-column-gap: 8px;
7    .c-button {
8      margin-top: 16px;
9    }
10  }
11  .loading-indicator {
12    margin-top: 100px;
13  }
14  .item-file-name {
15    color: ${a=>a.theme.color.primary};
16    user-select: none;
17    cursor: pointer;
18  }
19  .attachments-table {
20    margin-top: 16px;
21  }
22`,Ea=()=>{const[{loading:a,value:t},n]=ee(async(...s)=>{const[o]=s;return await ra(o)});return i.exports.useMemo(()=>({fetchingBCMAP:a,bcmap:t,fetchBCMAP:n}),[a,t,n])},{FORMS:ya}=at.SURVEY;async function ba(a){try{const t=ya.parse("get",{patient_id:a}),{data:n}=await et.get(t.name,t.url);return!n||n.length===0?null:(n||[]).map(s=>tt(s))}catch(t){return console.log(t),null}}const va=()=>{const[{loading:a,value:t},n]=ee(async(...s)=>{const[o]=s;return await ba(o)});return i.exports.useMemo(()=>({fetchingSurvey:a,surveys:t,fetchSurvey:n}),[a,t,n])},xa=({values:a})=>{const{diagramType:t,diagramData:n,itemIndex:s}=a,o=ye(),m=i.exports.useMemo(()=>le[t],[t]);return e.createElement(oa,{width:m.sizes[s].width,height:m.sizes[s].height,imageURL:m.source[s],diagramData:n,onCancel:()=>o(he()),onSubmit:y=>{},disabled:!0})},wa=a=>{const[t]=ne(),{item:n,idx:s,onView:o,formType:m}=a,{diagramType:y,itemIndex:p}=n,c=i.exports.useCallback(()=>m==="Diagrams"?e.createElement(u,null):m==="Staging"?e.createElement("p",{className:"content-text"},oe(n.type,Se)):e.createElement("p",{className:"content-text"},oe(n.type,fe)),[n.type,m]),u=i.exports.useCallback(()=>{let b=`${oe(n.formType,Y)} Form`;return n.formType==="Encounter's Diagnosis"&&(b=n.formType),n.formType==="Staging Form"&&(b=`${n.formType} - ${oe(n.diagramType,Se)}`),e.createElement("p",{className:"content-text"},b)},[n.formType,n.diagramType]),g=i.exports.useMemo(()=>{var b;return y?(b=le[y])==null?void 0:b.labels[p]:""},[y,p]);return e.createElement(Na,{key:s,onClick:()=>o&&o(n)},e.createElement("div",{className:"container-side"},e.createElement("p",{className:"content-year"},te(n.createdAt,"yyyy")||""),e.createElement("p",{className:"content-date"},te(n.createdAt,"dd")||""),e.createElement("p",{className:"content-month"},te(n.createdAt,"MMM")||""),e.createElement("span",{className:"content-spacer"}),e.createElement("p",{className:"content-time"},te(n.createdAt,"hh:mm aa")||"")),e.createElement("div",{className:"content-list"},e.createElement("p",{className:"header-text"},"TYPE OF FORM"),e.createElement(c,null),g?e.createElement(e.Fragment,null,e.createElement("p",{className:"header-text"},"DIAGRAM TYPE"),e.createElement("p",{className:"content-text"},g)):null,n.diagnosisName!==void 0||n.diagnosis_name!==void 0?e.createElement(e.Fragment,null,e.createElement("p",{className:"header-text"},t("current_diagnosis",{count:1,ns:"patient_record"})),e.createElement("p",{className:"content-text"},n.diagnosisName||n.diagnosis_name)):null,n.diagnosisName!==void 0||n.diagnosis_name!==void 0?e.createElement(e.Fragment,null,e.createElement("p",{className:"header-text"},t("current_diagnosis",{count:1,ns:"patient_record"})),e.createElement("p",{className:"content-text"},n.diagnosisName||n.diagnosis_name)):null))};var Ne=i.exports.memo(wa);const Na=A.div`
23  width: 100%;
24  border: 1px solid #484848;
25  border-radius: 3px;
26
27  display: flex;
28  min-height: 220px;
29  position: relative;
30  border-radius: 3px;
31  border: solid 1px #eaeaea;
32  overflow: hidden;
33  margin-top: 8px;
34  &:hover {
35    cursor: pointer;
36    border-color: ${a=>a.theme.color.primary};
37  }
38
39  .content-list {
40    flex: 1 1;
41    margin-left: 48px;
42    padding: 16px;
43  }
44  .header-text {
45    font-size: 14px;
46    color: #989898;
47    margin-bottom: 0px;
48  }
49  .content-text {
50    font-size: 14px;
51  }
52  .container-side {
53    width: 48px;
54    height: 100%;
55    padding: 6px 12px;
56    background: #484848;
57    display: flex;
58    flex-direction: column;
59    align-items: center;
60    position: absolute;
61    top: 0;
62    left: 0;
63  }
64  .content-year {
65    font-size: 10px;
66    margin: 0;
67    color: #fff;
68  }
69  .content-date {
70    font-size: 24px;
71    margin: 0;
72    line-height: 1.2;
73    color: #fff;
74  }
75  .content-month {
76    font-size: 12px;
77    margin: 0;
78    color: #fff;
79    text-transform: uppercase;
80  }
81  .content-spacer {
82    flex: 1 1;
83  }
84  .content-time {
85    font-size: 10px;
86    margin: 0;
87    color: #fff;
88    text-align: center;
89  }
90`;var se=(a=>(a.BreastHealth="SurveyForms::WomansBreastHealthSelfAssessment",a.BaselineKAP="SurveyForms::WomansBaselineKap",a))(se||{});const Sa="_item_wrapper_1or79_1",Ca="_question_1or79_5";var r={item_wrapper:Sa,question:Ca};const Pa=({surveyAnswers:a})=>{function t(n){var s;return(s=Ae[n])!=null?s:"-"}return e.createElement(e.Fragment,null,e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"1. Are you aware of your breasts\u2019 health?"),e.createElement("div",null,t(a.aware_of_breasts_health))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"2. Indicate which of the following can happen with the Breast"),e.createElement("div",null,t(a.indicate_what_happens_to_breast))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"3. Do you think that - if you find any of the lesion mentioned above, you should seek immediately a medical consult?"),e.createElement("div",null,t(a.presence_of_lesion_seek_medical))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"4. Do you think that - seeking immediately a medical consult would make the treatment of the any of the above lesions less complicated?"),e.createElement("div",null,t(a.seeking_immediately_equals_less_complication))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"5. Do you think that - Breast cancer is the most common cancer in women?"),e.createElement("div",null,t(a.breast_cancer_most_common_cancer_in_women))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"6. Do you I think that - Breast cancer occur more commonly in old people?"),e.createElement("div",null,t(a.breast_cancer_more_often_old_people))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"7. Do you I think that - Breast cancer can be inherited?"),e.createElement("div",null,t(a.breast_cancer_inherited))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"8. Do you I think that - Breast cancer is caused by evil spirits?"),e.createElement("div",null,t(a.breast_cancer_evil_spirits))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"9. Do you I think that - Breast cancer is caused by an untoward bump on the breast?"),e.createElement("div",null,t(a.breast_cancer_caused_untoward_bump))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"10. Do you I think that - a small breast mass that is not painful is not worrisome?"),e.createElement("div",null,t(a.breast_small_mass_not_worrisome))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"11. Do you think that - a breast mass that is painful might be cancer?"),e.createElement("div",null,t(a.painful_breast_mass_cancer))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"12. Do you think that - until the non-painful breast mass becomes big then this might be cancer?"),e.createElement("div",null,t(a.until_non_painful_breast_mass_big_cancer))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"13. Do you think that - any breast mass size, particularly if hard even if not painful must be examined by a doctor or health worker trained on breast exam as early on as possible?"),e.createElement("div",null,t(a.early_breast_exam))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"14. Do you think that - Early diagnosis improves outcome of treatment?"),e.createElement("div",null,t(a.early_diagnosis_improves_outcome))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"15. Do you think that - Breast self-examination is useful in early diagnosis?"),e.createElement("div",null,t(a.breast_self_exam_useful))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"16. Do you think that - Breast cancer is curable when detected early?"),e.createElement("div",null,t(a.curable_when_detected_early))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"17. Do you do breast self-examination (BSE)?"),e.createElement("div",null,t(a.bse))),a.bse==="yes"?e.createElement(e.Fragment,null,e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"17a. If yes, how frequent do you do BSE?"),e.createElement("div",null,t(a.bse__frequency))
90),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"17b. If yes, where did you get your knowledge of BSE?"),e.createElement("div",null,t(a.bse__knowledge)))):e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"17a. If no, what are your reasons for not practicing BSE?"),e.createElement("div",null,t(a.bse__reasons_not))),e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"18. Do you go to the medical clinic just to have your breasts examined (clinical breast exam or CBE)?"),e.createElement("div",null,t(a.cbe))),a.cbe==="yes"?e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"18a. If yes, how frequent do you do CBE?"),e.createElement("div",null,t(a.cbe__frequency))):e.createElement(B,{className:r.item_wrapper},e.createElement("div",{className:r.question},"18a. If no, what are your reasons for not practicing CBE?"),e.createElement("div",null,t(a.cbe__reasons_not))))},B=A.div`
91  background-color: #f5f5f5;
92  padding-top: 16px;
93  padding-bottom: 16px;
94  border-radius: 5px;
95`,Ae={clear:"Clear",yes:"Yes",no:"No",not_sure:"Not sure",not_sure_variant:"I don\u2019t know",yes_stopped:"Yes, stopped",yes_ongoing:"Yes, ongoing",yes_frequent:"Yes, my work entails frequent physical activity",yes_routine:"Yes, I do routine fitness exercise",no_births:"No births",none:"None",yes_one:"Yes, One",yes_more_than_one:"Yes, more than one",unknown:"Unknown",benign:"Benign",atypical_hyperplasia:"Atypical hyperplasia",cancer_in_situ:"Cancer in situ",cancer:"Cancer",yes_right:"Yes, right breast",yes_left:"Yes, left breast",yes_both:"Yes, both breast",yes_without_palpitation_without_period:"Yes, even without palpating the mass, not associated with menstrual periods",yes_without_palpitation_associated_period:"Yes, even without palpating the mass, associated with menstrual periods",yes_with_palpitation:"Yes, only on palpation",mongo_size_hard_to_not_hard:"Mongo-size, hard to not so hard (like my forehead or nose)",peanut_size_hard_to_not_hard:"Peanut-size, hard to not so hard (like my forehead or nose)",peso_size_hard_to_not_hard:"One-peso size, hard to not so hard (like my forehead or nose)",egg_size_hard_to_not_hard:"Egg-size or more, hard to not so hard (like my forehead or nose)",any_size_soft:"Any-size, soft mass like my cheeks",no_skin_abnormality:"No skin abnormality at all",skin_dimpling:"Skin dimpling",abnormal_nipple_inversion:"Abnormal nipple inversion",inflammation:"Inflammation",hardening:"Hardening/ Tightness",bleeding:"Bleeding",yes_right_armpit:"Yes, right armpit",yes_left_armpit:"Yes, left armpit",yes_both_armpit:"Yes, both armpit",what_year:"If yes, what year",which_cancer:"If yes, what specific cancer site",yes_fully:"Yes, fully",yes_not_confident:"Yes, but not confident",have_lesion_not_cancer:"Can have a lesion, which is not cancer",have_lesion_is_cancer:"Can have a lesion, which is cancer",have_lesion_is_infection:"Can have a lesion, which can be infection",have_lesion_abnormal_milk_accumulation:"Can have a lesion, which is abnormal milk accumulation",none_of_the_above:"None of the above",once_a_month:"Once a month",once_in_two_months:"Once in two months",three_to_five_per_year:"Three to five times a year",once_or_twice_per_year:"Once or twice a year ",doctor_health_worker:"From a doctor/ HW",publications:"Publications",television:"Television",religious_groups:"Churches/religious groups",womens_orgranization:"Women organizations/ Support groups",family_friends:"Family/ Friends",dont_know:"I do not know how to do BSE",no_breast_problem:"I don\u2019t have breast problem",should_not_practice:"I don\u2019t think I should",do_not_feel_like_doing:"I just don\u2019t feel like doing it",will_not_find_anything:"I don't think I will find anything",will_not_help:"I don\u2019t think it will help me much",let_doctors_do_it:"I leave it for doctors and nurses to do",not_pregnant:"I am not pregnant",far_clinic:"The clinic is far",busy:"I am busy, I cannot find time to go to clinic",insufficient_funds:"I do n
95ot have funds for CBE and the possible tests that follow if something is wrong",cause_for_anxiety:"If I do, it only creates anxiety for me",no_funds_for_treatment:"If I do, I do not have money to have it treated if I find something wrong",less_twenty:"<20",twenty_to_twenty_four:"20-24",twenty_five_to_twenty_nine:"25-29",thirty__or_older:"30 or older",seven_to_eleven:"7 to 11",twelve_to_thirteen:"12 to 13",fourteen_or_older:"14 or older"},ka=({surveyAnswers:a})=>{function t(n){var s;return(s=Ae[n])!=null?s:n}return e.createElement(e.Fragment,null,e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"1a. Is the video Breast Health 101: Clear"),e.createElement("div",null,t(a.breast_health_101__clear))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"1b. Is the video Breast Health 101: Able to give you new information"),e.createElement("div",null,t(a.breast_health_101__give_new_information))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"1c. Able to Change your knowledge on breast cancer"),e.createElement("div",null,t(a.breast_health_101__change_knowledge))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"1d. Is the video Breast Health 101: Good for you to recommend to an acquaintance to view"),e.createElement("div",null,t(a.breast_health_101__recommend))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"2a. Is the video Breast Self-Examination: Clear"),e.createElement("div",null,t(a.breast_self_examination__clear))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"2b. Is the video Breast Self-Examination: Easy to follow"),e.createElement("div",null,t(a.breast_self_examination__easy_to_follow))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"2c. Is the video Breast Self-Examination: Good for you to practice BSE regularly"),e.createElement("div",null,t(a.breast_self_examination__practice_bse))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"2d. Is the video Breast Self-Examination: Good for you to recommend to an acquaintance to view"),e.createElement("div",null,t(a.breast_self_examination__recommend))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"3. Do you smoke cigarettes/ tobacco?"),e.createElement("div",null,t(a.smoke))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"4. Do you drink alcohol?"),e.createElement("div",null,t(a.drink))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"5. Do you eat oily foods or red meat?"),e.createElement("div",null,t(a.eat_oily_food))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"6. Do you exercise daily?"),e.createElement("div",null,t(a.exercise_daily))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"7a. Have you ever been diagnosed or received treatment with the following: Hypertension"),e.createElement("div",null,t(a.diagnosed_received_treatment__hypertension))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"7b. Have you ever been diagnosed or received treatment with the following: Heart disease"),e.createElement("div",null,t(a.diagnosed_received_treatment__hearth_disease))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"7c. Have you ever been diagnosed or received treatment with the following: Diabetes"),e.createElement("div",null,t(a.diagnosed_received_treatment__diabetes))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"7d. Have you ever been diagnosed or received treatment with the following: Kidney disease"),e.createElement("div",null,t(a.diagnosed_received_treatment__kidney_disease))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"7e. Have you ever been diagnosed or received treatment with the following: Chronic Hepatitis"),e.createElement("div",null,t(a.diagnosed_received_treatment__chronic_hepatitis))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"7f. Have you ever been diagnosed or received treatment with the following: Cancer"),e.createElement("div",null,t(a.diagnosed_received_treatment__cancer))),a.diagnosed_received_treatment__cancer==="yes"&&e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"7g. If yes, what specific cancer site? "),e.createElement("div",null,a.diagnosed_received_treatment__cancer_specify)),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"8. What was your age (years) at the time of your first menstrual peri
95od?"),e.createElement("div",null,t(a.age_first_menstrual_period))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"9. What was your age(years) when you gave birth to your first child?"),e.createElement("div",null,t(a.age_first_child))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"10. Do you have first-degree relatives (mother, sisters, daughters) who have had breast cancer?"),e.createElement("div",null,t(a.relatives_with_cancer))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"11. Have you ever had a breast mass before?"),e.createElement("div",null,t(a.breast_mass))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"12. Did you ever have a breast biopsy or surgery?"),e.createElement("div",null,t(a.biopsy_surgey))),a.biopsy_surgey==="yes"&&e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"12a. If yes, what was the result of the biopsy/ surgery?"),e.createElement("div",null,t(a.biopsy_surgey_result))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"13. Have you ever received a previous radiation therapy to your chest?"),e.createElement("div",null,t(a.radiation_therapy))),a.radiation_therapy==="yes"&&e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"13a. If yes, what year?"),e.createElement("div",null,a.radiation_therapy_year)),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"14. Upon your BSE now, would you happen to palpate a nodularity in your breast?"),e.createElement("div",null,t(a.nodularity_in_breast))),a.nodularity_in_breast!=="no"&&e.createElement(e.Fragment,null,e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"14a. If yes, do you also feel pain?"),e.createElement("div",null,t(a.nodularity_in_breast__pain))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"14b. If yes, what is size and consistency?"),e.createElement("div",null,t(a.nodularity_in_breast__size_consistency))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"14c. If yes, check if there are associated skin lesions over the breast mass which were not there before?"),e.createElement("div",null,t(a.nodularity_in_breast__skin_lesions)))),e.createElement(I,{className:r.item_wrapper},e.createElement("div",{className:r.question},"15. Upon your BSE now, would you happen to palpate a mass in armpits?"),e.createElement("div",null,t(a.mass_in_armpits))))},I=A.div`
96  background-color: #f5f5f5;
97  padding-top: 16px;
98  padding-bottom: 16px;
99  border-radius: 5px;
100`,Ia=a=>{var D;const{item:t,patientInfo:n}=a,{type:s,questions:o,createdAt:m}=t,{data:y}=n,[p,c]=i.exports.useState(!1),u=M=>{switch(M){case se.BaselineKAP:return"Women\u2019s Baseline KAP";case se.BreastHealth:return"Women\u2019s Breast Health Self Assessment";default:return"Survey"}},g=M=>{switch(M){case se.BaselineKAP:return e.createElement(Pa,{surveyAnswers:o});case se.BreastHealth:return e.createElement(ka,{surveyAnswers:o});default:return""}},b=()=>s!==se.BreastHealth?e.createElement("span",{className:"grid grid-cols-2 gap-1"},e.createElement(ze,{className:"h-6 w-6 fill-[#78C0E9]"})," Low"," "):o.diagnosed_received_treatment__cancer==="yes"||o.age_first_menstrual_period==="seven_to_eleven"||o.age_first_child==="no_births"||o.age_first_child==="thirty__or_older"||o.relatives_with_cancer==="yes_one"||o.relatives_with_cancer==="yes_more_than_one"||o.breast_mass==="yes"||o.biopsy_surgey==="yes"&&o.biopsy_surgey_result!=="benign"||o.biopsy_surgey==="yes"&&o.biopsy_surgey_result!=="not_sure"||o.radiation_therapy==="yes"||o.nodularity_in_breast!=="no"&&o.nodularity_in_breast!==""||o.nodularity_in_breast__size_consistency!=="any_size_soft"&&o.nodularity_in_breast__size_consistency!==""||o.nodularity_in_breast__skin_lesions!=="no_skin_abnormality"&&o.nodularity_in_breast__skin_lesions!==""||o.mass_in_armpits!=="no"&&o.mass_in_armpits!==""?e.createElement("span",{className:"grid grid-cols-2 gap-1"}
100,e.createElement(Xt,{className:"h-6 w-6 fill-[#E76E70]"})," High"):e.createElement("span",{className:"grid grid-cols-2 gap-1"},e.createElement(ze,{className:"h-6 w-6 fill-[#78C0E9]"})," Low"," ");return e.createElement(Da,null,e.createElement(Ta,{className:"grid grid-cols-10 gap-4 "},e.createElement("div",{className:"col-span-5 font-medium"},u(s)),e.createElement("div",{className:"col-span-2"},X(new Date(m),"MMMM dd, yyyy")),e.createElement("div",{className:"col-span-1"},X(new Date(m),"hh:mm a")),e.createElement("div",{className:"col-span-1"},b()),e.createElement("div",{className:"col-span-1 ml-auto cursor-pointer",onClick:()=>c(!p)},p?e.createElement(ma,null):e.createElement(da,null)),p?e.createElement(Fa,{className:"col-span-10"},e.createElement(Ra,null,e.createElement("div",{className:"mb-1 text-sm font-medium text-[#444444]"},y==null?void 0:y.name),e.createElement("div",{className:"text-xs font-normal text-[#989898]"},y==null?void 0:y.email," | ",(D=y==null?void 0:y.summary)==null?void 0:D.contactNumber)),e.createElement(Ba,null,e.createElement("div",{className:"mb-4 grid grid-cols-2 gap-6 pl-6"},e.createElement("div",{className:"text-[#979797]"},"QUESTIONS"),e.createElement("div",{className:"text-[#979797]"},"ANSWERS"))),g(s)):null))};var Ma=i.exports.memo(Ia);const Da=A.div`
101  width: 100%;
102  background-color: #f5f5f5;
103  border-radius: 5px;
104`,Ta=A.div`
105  padding: 14px 24px;
106  margin-bottom: 8px;
107`,Fa=A.div`
108  width: 100%;
109  background-color: #ffffff;
110  padding: 16px;
111  border-radius: 10px;
112`,Ra=A.div`
113  width: 100%;
114  background: rgba(80, 177, 175, 0.05);
115  border-radius: 5px;
116  border: 1px solid #50b1af;
117  padding: 12px 24px;
118  margin-bottom: 24px;
119`,Ba=A.div``,qa=[{id:"Staging",value:"Staging Forms"},{id:"SubmissionForm",value:"Submission Form"},{id:"Diagrams",value:"Diagrams"},{id:"Forms",value:"Survey Forms"}],Ha=({patientId:a,patientInfo:t,...n})=>{const[s]=ne("encounter"),{fetchingStagingForms:o,stagingForms:m,fetchStagingForms:y}=Tt(),{bcmap:p,fetchBCMAP:c}=Ea(),{fetchingCF4:u,cf4Forms:g,fetchCF4:b}=sa(),{fetchingDiagrams:D,allDiagrams:M,fetchDiagrams:L}=Gt(),{fetchingSurvey:W,surveys:S,fetchSurvey:x}=va(),[l,q]=i.exports.useState(""),[_,P]=i.exports.useState(""),[d,w]=i.exports.useState(""),[N,G]=i.exports.useState(""),j=ye(),{data:Z}=n.consultationList,{getFieldProps:J,handleSubmit:f}=_e({defaultValues:{type:"",fromDate:null,toDate:null,form:""},enableReinitialize:!0,reValidateMode:"onSubmit",validationSchema:aa}),{push:C}=nt(),[E,F]=i.exports.useState(Ye),O=Fe({pagination:E}),{pagination:v}=O,k=i.exports.useCallback(h=>{let R=1;const z=h/v.perPage;if(z>1){const[$,T]=String(z).split(".");R=Number($)+(T?1:0)}F({...v,total:h,totalPage:R,nextPage:v.page+1,prevpage:v.page-1})},[v,F]);i.exports.useEffect(()=>{switch(l){case"Staging":m!==void 0&&m.length>0&&k(m.length);break;case"SubmissionForm":p!==void 0&&g!==void 0&&k(g.length||(p==null?void 0:p.length)||0);break;case"Diagrams":if(!M)return;k(M.length);break;case"Forms":if(!S)return;k(S.length);break}},[m,p,g,S,M,l,k]),Ee(()=>{y(a)});const H=async h=>{q(h.type);const R=h.fromDate?`${te(h.fromDate,"yyyy-MM-dd")} 00:00:00`:void 0,z=h.toDate?`${te(h.toDate,"yyyy-MM-dd")} 23:59:59`:void 0;P(R),w(z);let $=[];switch(h.type){case"Staging":return y(a,R,z);case"SubmissionForm":return $=Z==null?void 0:Z.map(T=>T.phrId),await c(a)&&await b($);case"Diagrams":return L(a,_,d);case"Forms":return await x(a)}},K=i.exports.useCallback(h=>{j(rt({title:"Staging Form",width:"900px",component:e.createElement(Ft,{stagingForm:h,p
119hrId:h.phrId,diagnosisId:h.diagnosisId,disabled:!0}),id:"staging-form-peek"},st.Replace))},[j]),ae=i.exports.useCallback(h=>{const R=le[h.diagramType].labels[h.itemIndex];j(Ce({title:R,width:"800px",component:e.createElement(xa,{values:h})},Pe.Replace))},[j]),Q=h=>e.createElement(ve,{loading:h},e.createElement("div",{className:"no-records-label"},e.createElement("p",null,e.createElement("strong",null,s("no_records_found"))))),me=i.exports.useCallback((h,R,z)=>{const $=oe(R,fe);$===fe.CF4?C(qe.PHR.CF4.parse(z||-1,h)):C(qe.PATIENTS.BCMAP.parse(h,$?fe[$]:void 0))},[C]),xe=i.exports.useCallback(h=>{if(l!=="Diagrams")return Q(D);if(!h)return;const R=[...h],z=(v.page-1)*5;return(R.splice(z,5)||[]).filter(T=>{var V,Re,Be;return((V=le[T.diagramType])==null?void 0:V.labels[T.itemIndex])&&((Be=(Re=le[T.diagramType])==null?void 0:Re.labels[T.itemIndex])==null?void 0:Be.toLowerCase().includes(N.toLowerCase()))}).map((T,V)=>e.createElement(Ne,{key:V,item:T,idx:V,onView:ae,formType:l}))},[l,D,ae,N,v.page]),de=i.exports.useCallback(h=>{if(!h)return Q(o);const R=[...h],z=(v.page-1)*5;return(R.splice(z,5)||[]).filter(T=>{const V=oe(T.type,Se);return V!==null?V.toLowerCase().includes(N.toLowerCase()):null}).map((T,V)=>e.createElement(Ne,{key:V,item:T,idx:V,onView:()=>K(T),formType:l}))},[o,l,K,N,v.page]),pe=i.exports.useCallback(h=>{if(!h)return Q(W);const R=[...h],z=(v.page-1)*5;return R.splice(z,5).map(($,T)=>e.createElement(Ma,{key:T,item:$,idx:T,patientInfo:t}))},[W,l,v.page,N]),ie=i.exports.useCallback((h,R)=>{if(!h||!R)return Q(u);const z=[...R||[],...h||[]],$=(v.page-1)*5;return z.splice($,5).map((T,V)=>e.createElement(Ne,{key:V,item:T,idx:V,formType:l,onView:()=>me(a,T.type,T.phrId)}))},[u,l,v.page,a,me]),ue=i.exports.useCallback((h,R,z,$)=>l==="Staging"?de(h):l==="SubmissionForm"?ie(R,z):l==="Forms"?pe($):Q(!1),[l,de,ie]);return e.createElement($a,null,e.createElement("form",{onSubmit:f(H)},e.createElement(na,{justify:"start",className:"filters"},e.createElement(be,{className:"search-forms",name:"forms-search",type:"search",label:s("search"),fullWidth:!0,onChange:h=>G(h.target.value)}),e.createElement(ke,{items:qa,label:s("form_type"),...J("type")}),e.createElement(ce,{label:s("from_mm_dd_yy"),...J("fromDate")}),e.createElement(ce,{label:s("to_mm_dd_yy"),...J("toDate")}),e.createElement(U,{className:"filter-button",label:"FILTER",color:"secondary",type:"submit"})),l==="Forms"&&e.createElement(e.Fragment,null,e.createElement("p",{className:"my-4 text-lg font-medium"},"Submitted Survey Forms"),e.createElement("div",{className:"mb-4 grid grid-cols-10 gap-4 px-6 text-xs"},e.createElement("div",{className:"col-span-5 text-[#979797]"},"SURVEY TITLE"),e.createElement("div",{className:"col-span-2 text-[#979797]"},"DATE"),e.createElement("div",{className:"col-span-1 text-[#979797]"},"TIME"),e.createElement("div",{className:"col-span-1 text-[#979797]"},"RISK"),e.createElement("div",{className:"col-span-1"}," "))),l!=="Diagrams"?ue(m,p,g,S):xe(M)," "),e.createElement(Ie,{pagination:O,loading:!1}))},La=a=>({patientInfo:a.patient.currentPatientInformation,consultationList:a.search.consultationList}),za=a=>De({},a);var Oa=Me(La,za)(Ha);const $a=A.div`
120  width: 100%;
121  .filters {
122    display: grid;
123    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
124    .c-select,
125    .c-datepicker {
126      margin-right: 8px;
127      max-width: 150px;
128      font-size: 15px;
129    }
130    .c-select {
131      min-width: 150px;
132    }
133    .search-forms {
134      margin-right: 8px;
135      max-width: 150px;
136      font-size: 15px;
137      margin-bottom: 0px;
138    }
139  }
140  .filter-button {
141    margin-top: 16px;
142    min-width: 100px;
143  }
144  .no-records-label {
145    display: flex;
146    flex-direction: column;
147    align-items: center;
148    justify-content: center;
149    margin-top: 24px;
150  }
151`,Ya=()=>{const[{loading:a,value:t},n]=ee(async(...s)=>{const[o]=s;return await Rt(o)});return i.exports.useMemo(()=>({fetchingMedCerts:a,medCerts:t,fetchMedCerts:n}),[a,t,n])},Wa=({onClose:a,medCertBody:t,controlNumber:n,visitDate:s})=>{const[o]=ne(),{project:m}=it();ye();const{phr:{currentEncounter:y,currentCertificate:p},patient:{currentPatient:c},clinic:u,user:{currentDoctor:g}}=We(v=>v),{printing:b}=ia(),[D,M]=i.exports.useState(),[L,W]=i.exports.useState(null),[S,x]=i.exports.useState({hideFooter:!1,hideHeader:!1,addWatermark:!1,fontSize:"11"}),[l,q]=i.exports.useState(!1),{setCanvasData:_,dataURL:P,canvas:d}=la(),{signatures:w,fetchSignature:N}=ca();Ee(()=>{N()});const[G,j]=i.exports.useState(""),Z=i.exports.useCallback(async v=>{const k=await lt(v);j(k)},[]);i.exports.useEffect(()=>{Array.isArray(w)&&w.length>0&&!!w[0].file_url&&Z(w[0].file_url)},[w,Z]),i.exports.useEffect(()=>{if(!w||w.length===0)return;const[v]=w;_(v.data_url)},[w,_]);const J=i.exports.useMemo(()=>{var v,k;return e.createElement(Bt,{onSuccess:a,email:((k=(v=c==null?void 0:c.data)==null?void 0:v.summary)==null?void 0:k.email)||"",form:L,pageSettings:S,templateName:Oe.MedicalCertificate,setPageSettings:x,enabledPrintButton:!0})},[c,L,S,D]),{open:f,isOpen:C,modalRef:E}=Te({customSize:"400px",component:()=>J,title:"Print Medical Certificate"}),F=async()=>{var pe,ie,ue,h,R,z,$,T,V;const v=He().clinicId;q(!0);const{data:k}=await ct("clinic_header",v);q(!1);const H=Object.keys(k.assets).length>0?k.assets[v][0]:"",K=u.activeClinicId||Number(He().clinicId),ae=we("prc",g.identifications,!0),Q=we("ptr",g.identifications,!0),me=we("s2",g.identifications,!0),xe={firstName:(pe=g.data)==null?void 0:pe.firstName,middleName:(ie=g.data)==null?void 0:ie.middleName,lastName:(ue=g.data)==null?void 0:ue.lastName,suffix:(h=g.data)==null?void 0:h.suffix,specializations:g==null?void 0:g.specializations,prc:ae,ptr:Q,s2:me},de={data:{patientId:((R=c==null?void 0:c.data)==null?void 0:R.id)||-1,patientName:(z=c==null?void 0:c.data)!=null&&z.name?mt(c==null?void 0:c.data):(($=c==null?void 0:c.data)==null?void 0:$.name)||"",addresses:((T=c==null?void 0:c.data)==null?void 0:T.addresses)||"",birthDate:((V=c==null?void 0:c.data)==null?void 0:V.birthDate)||"",clinic:u!=null&&u.indexById?u==null?void 0:u.indexById[K]:void 0,signatureURL:P||G,clinicHeader:H,doctor:xe,visitDate:s||"",template:D==null?void 0:D.template},templateName:Oe.MedicalCertificate,domain:m==="core"?"medcheck":m,pageSize:"A5",landscape:!1,margin:{left:0,top:S.hideHeader?20:H?140:110,right:20,bottom:S.hideFooter?20:120},hideFooter:S.hideFooter,hideHeader:S.hideHeader,addWatermark:S.addWatermark,controlNumber:n};W(de),f()},O=v=>{const{name:k,value:H}=v==null?void 0:v.target;M(K=>({...K,[k]:H}))};return i.exports.useEffect(()=>{M({template:t})},[t]),e.createElement(Va,{className:"print-med-cert"},C&&E,d,e.createElement("div",{className:"row header !mt-0"},e.createElement("div",{className:"grid"},e.createElement("span",{className:"text-lg font-medium"},"Create Medical Certificate ",e.createElement("span",{className:"span__preview"},"Preview Only")),e.createElement("span",{className:"text-[#989898]"},"Create using the box below."))),e.createElement(be,{name:"template",rows:16,multiline:!0,fullWidth:!0,value:t,onChange:O,disabled:!0}),e.createElement("div",{className:"btn__control grid grid-cols-4 gap-4"},e.createElement(U,{onClick:a,size:"medium",color:"default",label:o("cancel")}),e.createElement("div",null," "),e.createElement(U,{size:"medium",color:"primary",label:"Print",loading:b,disabled:l,onClick:F}),e.createElement(U,{size:"medium",color:"primary",label:"Email",disabled:l||b,onClick:F})),e.createElement(Aa,null))},Va=A.div`
152  .row {
153    margin-top: 0;
154
155    .span__preview {
156      background-color: rgba(28, 158, 214, 0.2);
157      padding: 4px 8px;
158      font-size: 12px;
159      border-radius: 5px;
160      color: #1c9ed6;
161    }
162  }
163  .btn__control {
164    .c-button {
165      &:first-child {
166        margin-left: 0;
167      }
168      &:last-child {
169        margin-right: 0;
170      }
171      flex: 1;
172    }
173  }
174  .btn_save_template {
175    margin-right: 0 !important;
176    button {
177      width: 184px;
178      color: #50b1af;
179    }
180  }
181  .btn_templates {
182    margin-right: 0 !important;
183    button {
184      padding-right: 16px;
185      padding-left: 16px;
186      background: white;
187      border: solid 1px #dadada;
188      .MuiButton-label {
189        color: #989898;
190      }
191    }
192    .total {
193      background: #50b1af;
194      font-size: 10px;
195      border-radius: 100%;
196      color: #fff;
197      margin-left: 5px;
198      width: 15px;
199      height: 15px;
200    }
201  }
202`,Aa=ot`
203  .btn-close {
204    button {
205      border-radius: 4px;
206      border: solid 1px #dadada;
207    }
208  }
209`,Ua=a=>{const{item:t}=a,{details:n,createdAt:s,controlNumber:o}=t,m=g=>{const b=g.replace("Phrs::Type","");return b==="PHR Dashboard"?b:`${b} Encounter Form`},{open:y,close:p,isOpen:c,modalRef:u}=Te({customSize:"864px",component:()=>e.createElement(Wa,{onClose:p,medCertBody:n==null?void 0:n.medCertBody,controlNumber:o,visitDate:s}),options:{disableHeader:!0}});return e.createElement(Ka,null,c&&u,e.createElement(Xa,{className:"grid grid-cols-12 items-center gap-4"},e.createElement("div",{className:"col-span-3 break-normal font-medium"},m(n==null?void 0:n.sentFrom)||"-"),e.createElement("div",{className:"col-span-1 capitalize"},n==null?void 0:n.sentTo),e.createElement("div",{className:"col-span-3 break-all"},n==null?void 0:n.sentToRecipientEmail),e.createElement("div",{className:"col-span-2"},X(new Date(s),"MMMM dd, yyyy")),e.createElement("div",{className:"col-span-2"},X(new Date(s),"hh:mm a")),e.createElement("div",{className:"col-span-1"},e.createElement(U,{label:"View",color:"secondary",fullWidth:!0,onClick:y}
209))))};var ja=i.exports.memo(Ua);const Ka=A.div`
210  width: 100%;
211  background-color: #f5f5f5;
212  border-radius: 5px;
213`,Xa=A.div`
214  padding: 14px 24px;
215  margin-bottom: 8px;
216`,Ga=({patientId:a})=>{ne();const{fetchingMedCerts:t,medCerts:n,fetchMedCerts:s}=Ya(),o={type:"",date:null,search:""},[m,y]=i.exports.useState("all"),[p,c]=i.exports.useState(null),[u,g]=i.exports.useState("");i.exports.useState(0);const{getFieldProps:b,handleSubmit:D}=_e({defaultValues:o,enableReinitialize:!0,reValidateMode:"onSubmit"}),[M,L]=i.exports.useState(Ye),W=Fe({pagination:M}),{pagination:S}=W;i.exports.useCallback(_=>{let P=1;const d=_/S.perPage;if(d>1){const[w,N]=String(d).split(".");P=Number(w)+(N?1:0)}L({...S,total:_,totalPage:P,nextPage:S.page+1,prevpage:S.page-1})},[S,L]);const x=async _=>{s(a)};Ee(()=>{s(a)});const l=i.exports.useCallback(_=>{if(!_)return q(t);const P=[..._],d=(S.page-1)*5;let w=P.filter(function(N){return N.controlNumber!==null});return u!==""&&(w=w.filter(function(N){return N.details.sentToRecipientEmail===u})),m!=="all"&&(w=w.filter(function(N){return N.details.sentTo===m})),p!==null&&(w=w.filter(function(N){return X(N.createdAt||new Date,"MM-dd-yyyy")===X(new Date(p),"MM-dd-yyyy")})),w.splice(d,5).map((N,G)=>e.createElement(ja,{key:G,item:N,idx:G}))},[t,S.page]),q=_=>e.createElement(ve,{loading:_},e.createElement("div",{className:"no-records-label"},e.createElement("p",null,e.createElement("strong",null,"No records found"))));return e.createElement(Qa,null,e.createElement("form",{className:"filter-group",onSubmit:D(x)},e.createElement(be,{className:"search-forms",type:"search",label:"Search",fullWidth:!0,unit:"Email",unitPosition:"start",name:"search",value:u,onChange:_=>g(_.target.value)}),e.createElement(ke,{name:"type",value:m,label:"Sent to",items:[{id:"all",value:"All"},{id:"print",value:"Print"},{id:"email",value:"Email"}],onChange:_=>y(_.target.value)}),e.createElement(ce,{value:p,name:"date",placeholder:"Date",onChange:_=>c(_)}),e.createElement(U,{label:"FILTER",color:"primary",type:"submit"})),e.createElement("p",{className:"my-4 text-lg font-medium"},"Sent Medical Certificates"),e.createElement("div",{className:"mb-4 grid grid-cols-12 gap-4 px-6 text-xs"},e.createElement("div",{className:"col-span-3 text-[#979797]"},"SENT FROM"),e.createElement("div",{className:"col-span-1 text-[#979797]"},"SENT TO"),e.createElement("div",{className:"col-span-3 text-[#979797]"},"EMAIL"),e.createElement("div",{className:"col-span-2 text-[#979797]"},"DATE"),e.createElement("div",{className:"col-span-2 text-[#979797]"},"TIME"),e.createElement("div",{className:"col-span-1 text-[#979797]"},"ACTION")),l(n),e.createElement(Ie,{pagination:W,loading:t}))},Qa=A.div`
217  width: 100%;
218  .filter-group {
219    display: grid;
220    grid-template-columns: 35% 1fr 1fr 1fr;
221    grid-column-gap: 8px;
222    .c-button {
223      margin-top: 16px;
224    }
225  }
226  .loading-indicator {
227    margin-top: 100px;
228  }
229  .item-file-name {
230    color: ${a=>a.theme.color.primary};
231    user-select: none;
232    cursor: pointer;
233  }
234  .attachments-table {
235    margin-top: 16px;
236  }
237`;function Za(a,t,n,s){var S,x;const o=s!=null&&s.pan?s==null?void 0:s.pan:"P03038669",m=s!=null&&s.pmcc?s==null?void 0:s.pmcc:"Z15283",y=X(new Date,"yyyyMM"),p=String((x=(S=n==null?void 0:n[0])==null?void 0:S.patient_health_record_id)!=null?x:"").slice(2),c=`R${o}${y}${p}`,u={pUsername:"",pPassword:"",pHciAccreNo:o,pPMCCNo:m,pEnlistTotalCnt:"1",pProfileTotalCnt:"1",pSoapTotalCnt:String(n.length),pCertificationId:"KON-DUMMYCERTS-Z15283",pHciTransmittalNumber:c},g=qt("PCB",u,!1),b=Ht(a,t,n[0],s),D=Lt(a,t,n[0],s),M=`  <SOAPS>
238${n.map(l=>zt(a,t,l,s,!0)).join(`
239`)}
240  </SOAPS>`,L=`  <DIAGNOSTICEXAMRESULTS>
241${n.map(l=>Ot(a,t,l,s,!0)).filter(Boolean).join(`
242`)}
243  </DIAGNOSTICEXAMRESULTS>`,W=`  <MEDICINES>
244${n.map(l=>$t(a,t,l,s,!0)).join(`
245`)}
246  </MEDICINES>`;return[g,b,D,M,L,W,"</PCB>"].join(`
247`)}const Ja=({patientId:a,clinic:t,encounters:n})=>{ne(["encounter"]);const{inProgress:s,data:o}=We(f=>f.patient.currentPatient,dt),m=pt(),[y,p]=e.useState(""),[c,u]=e.useState([]),[{loading:g,value:b},D]=ee(async(...f)=>{if(n.length!==0)try{const C=n.map(F=>F.id);return await Promise.all(C.map(F=>ut(F).then(O=>{var v,k;return(k=(v=O.data)==null?void 0:v.encounter)==null?void 0:k.yakapDetail})))}catch(C){return console.log(C),[]}}),[{loading:M,value:L},W]=ee(async(...f)=>{const[C]=f;if(!C)return[];try{const{data:E}=await Ve((C==null?void 0:C.id)||0),{data:F}=await gt("2026-01-01",X(new Date,"yyyy-MM-dd"),C==null?void 0:C.philhealth,(t==null?void 0:t.pan)||"",(t==null?void 0:t.pmcc)||"");return{fpe:E,erlData:F==null?void 0:F.data}}catch(E){return console.log(E),[]}});e.useEffect(()=>{o&&(W(o),D())},[o]);const S=i.exports.useMemo(()=>{let f=yt;return o&&L&&b&&t&&n.length>0&&(f={...f,reportTagging:"2",reportXML:Za(o,L,b,t)}),p(f.reportXML),f},[o,L,b,t,n]),{getFieldProps:x,handleSubmit:l,setValue:q}=_e({defaultValues:S,enableReinitialize:!0,reValidateMode:"onSubmit"}),_=async(f,C,E)=>{var F;!E||await bt({id:E.id,clinicId:E.clinic_id,patientId:E.patient_id,philHealthSubmissionDate:new Date,philHealthSubmissionStatus:f,philHealthTransmittalNumber:C},(F=m.currentUser.data)==null?void 0:F.id,!0)},[{loading:P,value:d},w]=ee(async(...f)=>{var E,F;const[C]=f;if(!C)return[];try{const O="2",v=`R${(t==null?void 0:t.pan)||""}${X(new Date,"yyyyMM")}${String((F=(E=n==null?void 0:n[0])==null?void 0:E.id)!=null?F:"").slice(2)}`,{data:k}=await ft(C,O,(t==null?void 0:t.pan)||"",(t==null?void 0:t.pmcc)||"");if(k&&!k.success)return re.error("Validation failed: "+k.message),u(k.errors||[]),k;re.success("Konsulta report validation successful. Proceeding to upload."),q("reportXML",(k==null?void 0:k.validated_xml)||"");const{data:H}=await ht(v,k==null?void 0:k.validated_xml,O,(t==null?void 0:t.pan)||"",(t==null?void 0:t.pmcc)||"");if(H&&!H.success)return u(H.errors||[]),re.error("Upload failed: "+H.message),H;for(const K of n)await _("submitted",H==null?void 0:H.transaction_number,K);return re.success(`Konsulta report successfully uploaded to PhilHealth with Transmittal ID: ${H==null?void 0:H.transaction_number}.`),he(),H}catch(O){return re.error((O==null?void 0:O.message)||"Failed to validate XML"),u((O==null?void 0:O.errors)||[]),console.log(O),[]}}),N=(f,C)=>{var ae,Q;const E="2",F=`R${t==null?void 0:t.pan}${X(new Date,"yyyyMM")}${String((Q=(ae=n==null?void 0:n[0])==null?void 0:ae.id)!=null?Q:"").slice(2)}`,O=X(new Date,"yyyyMMdd"),v=`${E}${t==null?void 0:t.pan}_${O}_${F}.xml${C?".enc":""}`,k=new Blob([f],{type:"application/xml"}),H=URL.createObjectURL(k),K=document.createElement("a");K.href=H,K.download=v,K.click(),URL.revokeObjectURL(H)},G=async f=>{const C=await w(f.reportXML);console.log("Final result after validation and upload:",C)},[{loading:j,value:Z},J]=ee(async(...f)=>{const[C]=f;try{const{data:E}=await _t(C);return E}catch(E){return re.error((E==null?void 0:E.full_message)||(E==null?void 0:E.message)||"Failed to encrypt XML"),console.log(E),[]}});return e.createElement(tn,null,e.createElement("form",{onSubmit:l(G)},Et(["id","patientId","templateId"],S,x),e.createElement(ve,{className:"fetching-indicator",loading:s||j||M||P||g},e.createElement("div",{className:"ekas-template"},o&&!M&&e.createElement(be,{...x("reportXML"),label:"PhilHealth Report",multiline:!0,fullWidth:!0,rows:40,className:"notes-and-findings",onChange:f=>p(f.target.value)}),c.length>0&&e.createElement("div",null,c.map((f,C)=>e.createElement(en,{key:C},typeof f=="string"?f:Object.entries(f).map(([E,F])=>e.createElement("div",{key:E},e.createElement("strong",null,E,":")," ",String(F)))))))),e.createElement("div",{className:"row footer",hidden:s},e.createElement(U,{onClick:()=>N(y,!1),size:"medium",color:"default",label:"Download XML",className:"mr-4",disabled:j||M||P}),e.createElement(U,{onClick:async()=>{const{data:f}=await J(y);N(f,!0)},size:"medium",color:"default",label:"Download Encrypted XML",disabled:j||M||P}),e.createElement(U,{type:"submit",size:"medium",color:"primary",label:"Validate and Submit",loading:P,disabled:j||M||P}))))},en=A.div`
248  background: #fff3f3;
249  border: 1px solid #ffcdd2;
250  border-radius: 6px;
251  padding: 8px 12px;
252  margin-bottom: 6px;
253  font-size: 13px;
254  color: #c62828;
255`,tn=A.div`
256  width: 100%;
257  position: relative;
258
259  .row {
260    width: 100%;
261    display: flex;
262    flex-direction: row;
263    align-items: center;
264    &.header {
265      justify-content: space-between;
266    }
267    &.footer {
268      margin-top: 24px;
269      justify-content: center;
270      .c-button:first-of-type {
271        margin-right: 16px;
272      }
273      .c-button:last-of-type {
274        margin-left: 16px;
275      }
276    }
277  }
278
279  .fetching-indicator {
280    margin-top: 16px;
281  }
282
283  .ekas-template {
284    width: 100%;
285    padding: 24px;
286    border: 1px solid #c4c4c4;
287    border-radius: 4px;
288    margin-top: 24px;
289    font-size: 12px;
290
291    .ekas-header {
292      display: flex;
293      flex-direction: row;
294      align-items: center;
295      margin-bottom: 12px;
296      gap: 16px;
297      justify-content: center;
298      .ph-logo {
299        height: 48px;
300        width: auto;
301      }
302
303      .ekas-title {
304        font-size: 16px;
305        font-weight: bold;
306        text-transform: uppercase;
307        color: #000;
308      }
309    }
310
311    .section-label {
312      font-weight: bold;
313      font-size: 12px;
314      background-color: #f5f5f5;
315      padding: 6px 8px;
316      border: 1px solid #000;
317      border-bottom: none;
318    }
319
320    .ekas-table {
321      width: 100%;
322      border-collapse: collapse;
323      margin-bottom: 0;
324
325      td,
326      th {
327        border: 1px solid #000;
328        padding: 6px 8px;
329        vertical-align: top;
330        font-size: 12px;
331      }
332
333      th {
334        font-weight: bold;
335        text-align: center;
336        background-color: #f0f0f0;
337      }
338
339      .col-wide {
340        width: 35%;
341      }
342
343      .field-label {
344        display: block;
345        font-weight: bold;
346        font-size: 11px;
347        margin-bottom: 4px;
348        color: #333;
349      }
350
351      .membership-type {
352        display: flex;
353        flex-direction: row;
354        gap: 16px;
355        margin-top: 4px;
356      }
357
358      .c-input {
359        margin: 0;
360        width: 100%;
361        legend span {
362          display: none;
363        }
364      }
365
366      .c-checkbox {
367        margin: 0;
368        label {
369          margin: 0;
370        }
371      }
372
373      .c-datepicker {
374        margin: 0;
375        legend span {
376          display: none;
377        }
378      }
379    }
380
381    .services-table {
382      margin-top: 0;
383
384      .col-service {
385        width: 52%;
386        text-align: left;
387      }
388
389      .col-performed {
390        width: 10%;
391        text-align: center;
392        .performed-marks {
393          font-size: 13px;
394        }
395      }
396
397      .col-date {
398        width: 22%;
399      }
400
401      .col-by {
402        width: 16%;
403      }
404
405      .service-name-cell {
406        font-size: 12px;
407        font-weight: 500;
408      }
409
410      .performed-checkbox {
411        text-align: center;
412      }
413    }
414
415    .form-note {
416      font-size: 11px;
417      color: #333;
418      margin-top: 8px;
419      padding: 4px 0;
420    }
421
422    .scissors-line {
423      display: flex;
424      flex-direction: row;
425      align-items: center;
426      margin: 16px 0;
427
428      .scissors-icon {
429        font-size: 16px;
430        margin-right: 8px;
431        transform: rotate(180deg);
432        display: inline-block;
433      }
434
435      .dashed-divider {
436        flex: 1;
437        border-top: 2px dashed #000;
438      }
439    }
440
441    .patient-section {
442      padding: 8px 0;
443
444      .patient-question {
445        margin-bottom: 12px;
446
447        p {
448          margin: 0 0 6px 0;
449          font-size: 12px;
450        }
451
452        em {
453          font-size: 11px;
454          color: #555;
455        }
456      }
457
458      .patient-yes-no {
459        display: flex;
460        flex-direction: row;
461        gap: 24px;
462      }
463
464      .satisfaction-row {
465        display: flex;
466        flex-direction: row;
467        align-items: flex-start;
468        justify-content: space-between;
469        gap: 16px;
470
471        p {
472          flex: 1;
473        }
474      }
475
476      .satisfaction-options {
477        display: flex;
478        flex-direction: row;
479        gap: 24px;
480        align-items: center;
481        margin-top: 4px;
482      }
483
484      .satisfaction-item {
485        display: flex;
486        flex-direction: column;
487        align-items: center;
488        gap: 4px;
489        cursor: pointer;
490        .MuiFormControlLabel-root {
491          margin: 0;
492        }
493        .c-checkbox {
494          margin: 0;
495          label {
496            margin: 0;
497          }
498        }
499
500        .face-icon {
501          font-size: 22px;
502        }
503
504        span:last-child {
505          font-size: 11px;
506          font-weight: bold;
507        }
508      }
509
510      .comment-field {
511        width: 100%;
512        legend span {
513          display: none;
514        }
515      }
516    }
517
518    .patient-note {
519      display: flex;
520      flex-direction: row;
521      justify-content: space-between;
522      align-items: flex-end;
523      border-top: 1px solid #ccc;
524      padding-top: 8px;
525      margin-top: 8px;
526
527      .ph-id-field {
528        font-size: 11px;
529        white-space: nowrap;
530      }
531    }
532  }
533`,an=a=>{const t=a.clinic.activeClinicId||0;return{activeClinic:a.clinic.list.find(s=>s.id===t)}},nn=a=>De({},a),rn=({activeClinic:a,patientId:t})=>{const{data:n,paginationHook:s,refetch:o,isFetching:m}=ea(["pending-submission",{}],g=>vt("pending",t,Y.Yakap,g.queryKey[2]),{enabled:!0},100);i.exports.useEffect(()=>{t&&o()},[t]);const{open:y,close:p,isOpen:c,modalRef:u}=Te({size:"lg",title:"PhilHealth Batch Processing",component:()=>e.createElement(Ja,{clinic:a,patientId:t,encounters:n||[]})});return e.createElement(on,{hidden:(n==null?void 0:n.length)===0},c&&u,e.createElement(U,{className:"ml-auto",label:"Submit Pending YAKAP Consultations",color:"primary",loading:m,onClick:()=>{y()}}))};var sn=Me(an,nn)(rn);const on=A.div`
534  display: flex;
535`,ln=a=>({currentPatient:a.patient.currentPatient,activeClinicId:a.clinic.activeClinicId,phrTransactions:a.phr.transaction}),cn=a=>De({getPatientProfile:jt,resetPatientProfile:Kt,createNewEncounter:Ut},a),mn=a=>{const[t]=ne(),n=ye(),{id:s}=a.match.params,{inProgress:o}=a.phrTransactions.newEncounter,{data:m,inProgress:y}=a.currentPatient,{getPatientProfile:p,resetPatientProfile:c,activeClinicId:u,createNewEncounter:g}=a,{isCMS:b}=It(),D=wt(),[M,L]=e.useState(!1),W=[{label:"Patient Records",href:"/patients/list"},{label:`Patient Record ${s}`,href:`/patients/${s}/records`}],{handleChange:S,handleBlur:x,handleSubmit:l,values:q,getError:_}=ga({initialValues:{patientId:0,encounterType:Y.Standard,encounterDate:te(new Date,"MM/dd/yyyy")},validator:pa,onSuccess:()=>P(q)}),P=f=>{if(f.encounterType==="Phrs::TypeFpe"&&M){n(Ce({hideHeader:!0,component:e.createElement("div",{style:{padding:"8px 4px"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"12px"}},e.createElement("p",{style:{margin:0,fontSize:"16px",fontWeight:600,color:"#1a202c"}},"Existing Form Detected")),e.createElement("p",{style:{margin:"0 0 20px",fontSize:"14px",color:"#4a5568",lineHeight:"1.5"}},"A completed Health Screening / First Patient Encounter Form (FPE) has been detected for this patient. Please edit the existing form to ensure the most up-to-date information is captured, or proceed with the YAKAP Consultation."),e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"}},e.createElement(U,{variant:"outlined",label:"Close",onClick:()=>n(he())})))},Pe.Push));return}if(f.encounterType==="Phrs::TypeYakap"&&!M){n(Ce({hideHeader:!0,component:e.createElement("div",{style:{padding:"8px 4px"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"12px"}},e.createElement("p",{style:{margin:0,fontSize:"16px",fontWeight:600,color:"#1a202c"}},"Required FPE form missing")),e.createElement("p",{style:{margin:"0 0 20px",fontSize:"14px",color:"#4a5568",lineHeight:"1.5"}},"Completion and submission of the Health Screening / First Patient Encounter Form (FPE) is a mandatory prerequisite for participation in the YAKAP Consultation."),e.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},e.createElement(U,{variant:"outlined",label:"Go Back",onClick:()=>n(he())})))},Pe.Push));return}g({...f,patientId:parseInt(s),clinicId:u},a.history)},d=parseInt(s),[{loading:w,value:N},G]=ee(async(...f)=>{const[C]=f;if(!C)return[];try{const{data:E}=await Ve(C||0);(E==null?void 0:E.philhealth_submission_date)&&(E==null?void 0:E.philhealth_submission_date.length)>0&&L(!0)}catch(E){return L(!1),console.log(E),[]}});i.exports.useEffect(()=>{!d||(p(d),G(d))},[p,d,D==null?void 0:D.key]),i.exports.useEffect(()=>()=>{c()},[c,D==null?void 0:D.key]);const{accessCrudEncounter:j}=Nt(),Z=!j,J=i.exports.useMemo(()=>[{visible:!0,pageTitle:t("consultation",{ns:"appointment"}).toUpperCase(),pageComponent:e.createElement(Yt,{patientId:d}),className:"phr-consultation"},{visible:!0,pageTitle:t("lab_and_imaging_results",{ns:"encounter"}),pageComponent:e.createElement(Wt,{patientId:d,withEncounter:!1})},{visible:!0,pageTitle:t("treatment_plans",{ns:"encounter"}),pageComponent:e.createElement(Vt,{patientId:d})},{visible:!0,pageTitle:t("forms",{ns:"encounter"}),pageComponent:e.createElement(Oa,{patientId:d})}
535,{visible:!0,pageTitle:"ATTACHMENTS",pageComponent:e.createElement(ha,{patientId:d})},{visible:b,pageTitle:"MEDICAL CERTIFICATE",pageComponent:e.createElement(Ga,{patientId:d})}].filter(f=>f.visible),[b]);return e.createElement(Dt,{page:"patient-records"},e.createElement(Qt,{patient:m,loading:y},f=>e.createElement(At,{patient:f})),e.createElement(dn,null,e.createElement(St,{links:W}),e.createElement(Le,{className:"patient-records-wrapper"},e.createElement(ve,{loading:!1},e.createElement("div",{className:"controls"},e.createElement("p",{className:"page-title"},"Patient Record"),e.createElement("span",{className:"spacer"}),e.createElement("form",{className:"form",onSubmit:l},e.createElement(ua,{label:t("encounter_type",{ns:"encounter"}),className:"encounterType",name:"encounterType",options:Ct,value:q.encounterType,onChange:S("encounterType")}),e.createElement(Ue,{mat:!0,className:"encounterDate",type:"text",label:t("encounter_date",{ns:"encounter"}),name:"encounterDate",onChange:S("encounterDate"),onBlur:x("encounterDate"),error:!!_("encounterDate"),value:q.encounterDate,required:!0}),e.createElement(U,{type:"submit",label:t("create_encounter",{ns:"encounter"}),color:"primary",className:"btn-create-encounter",disabled:Z||o,loading:o||w}))),e.createElement(Pt,{variant:b?"scrollable":"fullWidth",pages:J}))),e.createElement(Le,{className:"mt-[15px]"},e.createElement(sn,{patientId:d}))))},dn=kt.div`
536  .patient-records-wrapper {
537    width: 100% !important;
538  }
539  @media (min-width: 1024px) {
540    width: calc(100% - 346px);
541  }
542`;var jn=xt(Me(ln,cn)(mn));export{jn as default};
543//# sourceMappingURL=Records.12d2b7d5.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.