Esempio n. 1
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <PatientNote> TableToList(DataTable table)
        {
            List <PatientNote> retVal = new List <PatientNote>();
            PatientNote        patientNote;

            foreach (DataRow row in table.Rows)
            {
                patientNote                            = new PatientNote();
                patientNote.PatNum                     = PIn.Long(row["PatNum"].ToString());
                patientNote.FamFinancial               = PIn.String(row["FamFinancial"].ToString());
                patientNote.ApptPhone                  = PIn.String(row["ApptPhone"].ToString());
                patientNote.Medical                    = PIn.String(row["Medical"].ToString());
                patientNote.Service                    = PIn.String(row["Service"].ToString());
                patientNote.MedicalComp                = PIn.String(row["MedicalComp"].ToString());
                patientNote.Treatment                  = PIn.String(row["Treatment"].ToString());
                patientNote.ICEName                    = PIn.String(row["ICEName"].ToString());
                patientNote.ICEPhone                   = PIn.String(row["ICEPhone"].ToString());
                patientNote.OrthoMonthsTreatOverride   = PIn.Int(row["OrthoMonthsTreatOverride"].ToString());
                patientNote.DateOrthoPlacementOverride = PIn.Date(row["DateOrthoPlacementOverride"].ToString());
                patientNote.SecDateTEntry              = PIn.DateT(row["SecDateTEntry"].ToString());
                patientNote.SecDateTEdit               = PIn.DateT(row["SecDateTEdit"].ToString());
                patientNote.Consent                    = (OpenDentBusiness.PatConsentFlags)PIn.Int(row["Consent"].ToString());
                retVal.Add(patientNote);
            }
            return(retVal);
        }
Esempio n. 2
0
 //Chart Module
 private void PatientDashboardDataEventArgsFactory(ChartModules.LoadData data)
 {
     TableProgNotes         = data.TableProgNotes;
     Pat                    = data.Pat;
     Fam                    = data.Fam;
     ListPlannedAppts       = ExtractPlannedAppts(Pat, data.TablePlannedAppts);
     ListInsSubs            = data.ListInsSubs;
     ListInsPlans           = data.ListInsPlans;
     ListPatPlans           = data.ListPatPlans;
     ListBenefits           = data.ListBenefits;
     HistList               = data.ListClaimProcHists;
     PatNote                = data.PatNote;
     ListDocuments          = data.ArrDocuments.ToList();
     ListAppts              = data.ArrAppts.ToList();
     ListToothInitials      = data.ListToothInitials;
     ListPatFields          = data.ArrPatFields.ToList();
     TableChartViews        = data.TableChartViews;
     ListProcGroupItems     = data.ListProcGroupItems;
     ListRefAttaches        = data.ListRefAttaches;
     PayorType              = data.PayorType;
     ListDiseases           = data.ListDiseases;
     TableMeds              = data.TableMeds;
     ListMedPats            = data.ListMedPats;
     ListAllergies          = data.ListAllergies;
     HasPatientPortalAccess = data.HasPatientPortalAccess;
     ListFieldDefLinksChart = data.ListFieldDefLinks;
     ListTobaccoStatuses    = data.ListTobaccoStatuses;
     ListPatRestricts       = data.ListPatRestricts;
     ListProcButtonQuicks   = data.ListProcButtonQuicks;
     SuperFamHead           = data.SuperFamHead;
     ImageToothChart        = data.ToothChartBM;
 }
Esempio n. 3
0
        public void InsertPatientNote_Test()
        {
            PatientNote note = new PatientNote {
                ContactedOn       = DateTime.UtcNow,
                CreatedById       = "5325c821072ef705080d3488",
                CreatedOn         = DateTime.UtcNow,
                Duration          = 15,
                MethodId          = "540f1da7d4332319883f3e8c",
                OutcomeId         = "540f1f10d4332319883f3e92",
                PatientId         = "5325db71d6a4850adcbba94a",
                SourceId          = "540f208ed4332319883f3e9b",
                Text              = "HEllo Hello",
                TypeId            = "54909992d43323251c0a1dfd",
                ValidatedIdentity = true,
                WhoId             = "540f1fc7d4332319883f3e99"
            };

            PostPatientNoteRequest request = new PostPatientNoteRequest();

            request.ContractNumber = "InHealth001";
            request.UserId         = "5325c821072ef705080d3488";
            request.Version        = 1;
            request.PatientId      = "5325db71d6a4850adcbba94a";
            request.Token          = "5307bcf5d6a4850cd4abe0dd";
            request.Note           = note;

            NotesManager            nManager = new NotesManager();
            PostPatientNoteResponse response = nManager.InsertPatientNote(request);

            Assert.IsNotNull(response);
        }
Esempio n. 4
0
 ///<summary></summary>
 public FormMedical(PatientNote patientNoteCur, Patient patCur)
 {
     InitializeComponent();            // Required for Windows Form Designer support
     PatCur         = patCur;
     PatientNoteCur = patientNoteCur;
     Lan.F(this);
 }
Esempio n. 5
0
 //Family Module
 private void PatientDashboardDataEventArgsFactory(FamilyModules.LoadData data)
 {
     Fam                   = data.Fam;
     Pat                   = data.Pat;
     PatNote               = data.PatNote;
     ListInsSubs           = data.ListInsSubs;
     ListInsPlans          = data.ListInsPlans;
     ListPatPlans          = data.ListPatPlans;
     ListBenefits          = data.ListBenefits;
     ListRecalls           = data.ListRecalls;
     ListPatFields         = data.ArrPatFields.ToList();
     SuperFamilyMembers    = data.SuperFamilyMembers;
     SuperFamilyGuarantors = data.SuperFamilyGuarantors;
     DictCloneSpecialities = data.DictCloneSpecialities;
     PatPict               = data.PatPict;
     HasPatPict            = data.HasPatPict;
     PayorTypeDesc         = data.PayorTypeDesc;
     ListRefAttaches       = data.ListRefAttaches;
     ListGuardians         = data.ListGuardians;
     ListCustRefEntries    = data.ListCustRefEntries;
     ListPatRestricts      = data.ListPatRestricts;
     ListPatFieldDefLinks  = data.ListPatFieldDefLinks;
     DiscountPlan          = data.DiscountPlan;
     ResponsibleParty      = data.ResponsibleParty;
     ListMergeLinks        = data.ListMergeLinks;
 }
Esempio n. 6
0
        /// <summary>
        /// Adds a new PatientRecordEntry
        /// </summary>
        /// <param name="newPatientRecordEntry"></param>
        /// <returns></returns>
        public async Task <PatientNoteDto> AddPatientRecordEntryAsync(PatientNoteDto newPatientRecordEntry)
        {
            if (newPatientRecordEntry == null)
            {
                throw new ArgumentNullException(nameof(newPatientRecordEntry));
            }

            var newPatientRecordEntryString = JsonSerializer.Serialize(newPatientRecordEntry);
            var encryptedContent            = _cryptoSvc.Encrypt(newPatientRecordEntryString);

            var newPatientNote = new PatientNote()
            {
                PatientId             = newPatientRecordEntry.PatientId,
                MedicalPractitionerId = newPatientRecordEntry.MedicalPractitionerId,
                Timestamp             = newPatientRecordEntry.Timestamp,
                Content = encryptedContent
            };

            var result = await _noteDal.AddAsync(newPatientNote);

            if (result == null)
            {
                return(null);
            }

            newPatientRecordEntry.Id = result.Id;
            return(newPatientRecordEntry);
        }
Esempio n. 7
0
 ///<summary>Inserts one PatientNote into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(PatientNote patientNote,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         patientNote.PatNum=ReplicationServers.GetKey("patientnote","PatNum");
     }
     string command="INSERT INTO patientnote (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="PatNum,";
     }
     command+="FamFinancial,ApptPhone,Medical,Service,MedicalComp,Treatment) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(patientNote.PatNum)+",";
     }
     command+=
          "'"+POut.String(patientNote.FamFinancial)+"',"
         +"'"+POut.String(patientNote.ApptPhone)+"',"
         +"'"+POut.String(patientNote.Medical)+"',"
         +"'"+POut.String(patientNote.Service)+"',"
         +DbHelper.ParamChar+"paramMedicalComp,"
         +"'"+POut.String(patientNote.Treatment)+"')";
     if(patientNote.MedicalComp==null) {
         patientNote.MedicalComp="";
     }
     OdSqlParameter paramMedicalComp=new OdSqlParameter("paramMedicalComp",OdDbType.Text,patientNote.MedicalComp);
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command,paramMedicalComp);
     }
     else {
         patientNote.PatNum=Db.NonQ(command,true,paramMedicalComp);
     }
     return patientNote.PatNum;
 }
Esempio n. 8
0
 ///<summary>Inserts one PatientNote into the database.  Returns the new priKey.</summary>
 internal static long Insert(PatientNote patientNote)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         patientNote.PatNum=DbHelper.GetNextOracleKey("patientnote","PatNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(patientNote,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     patientNote.PatNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(patientNote,false);
     }
 }
Esempio n. 9
0
 ///<summary>Inserts one PatientNote into the database.  Returns the new priKey.</summary>
 public static long Insert(PatientNote patientNote)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         patientNote.PatNum = DbHelper.GetNextOracleKey("patientnote", "PatNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(patientNote, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     patientNote.PatNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(patientNote, false));
     }
 }
Esempio n. 10
0
        ///<summary>Updates one PatientNote in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
        public static void Update(PatientNote patientNote, PatientNote oldPatientNote)
        {
            string command = "";

            //FamFinancial excluded from update
            if (patientNote.ApptPhone != oldPatientNote.ApptPhone)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ApptPhone = '" + POut.String(patientNote.ApptPhone) + "'";
            }
            if (patientNote.Medical != oldPatientNote.Medical)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Medical = '" + POut.String(patientNote.Medical) + "'";
            }
            if (patientNote.Service != oldPatientNote.Service)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Service = '" + POut.String(patientNote.Service) + "'";
            }
            if (patientNote.MedicalComp != oldPatientNote.MedicalComp)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MedicalComp = " + DbHelper.ParamChar + "paramMedicalComp";
            }
            if (patientNote.Treatment != oldPatientNote.Treatment)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Treatment = '" + POut.String(patientNote.Treatment) + "'";
            }
            if (command == "")
            {
                return;
            }
            if (patientNote.MedicalComp == null)
            {
                patientNote.MedicalComp = "";
            }
            OdSqlParameter paramMedicalComp = new OdSqlParameter("paramMedicalComp", OdDbType.Text, patientNote.MedicalComp);

            command = "UPDATE patientnote SET " + command
                      + " WHERE PatNum = " + POut.Long(patientNote.PatNum);
            Db.NonQ(command, paramMedicalComp);
        }
Esempio n. 11
0
        public PatientNote CreateNote(PatientNoteDetail detail, Staff author, IPersistenceContext context)
        {
            PatientNoteCategory category = context.Load <PatientNoteCategory>(detail.Category.NoteCategoryRef, EntityLoadFlags.Proxy);
            PatientNote         note     = new PatientNote(author, category, detail.Comment);

            note.ValidRange.Until = detail.ValidRangeUntil;

            return(note);
        }
Esempio n. 12
0
 public void UpdateNote(PatientNote note, PatientNoteDetail detail)
 {
     // the only properties of the note that can be updated is the ValidRange
     // and only if it is not already expired
     if (!note.IsExpired)
     {
         note.ValidRange.Until = detail.ValidRangeUntil;
     }
 }
Esempio n. 13
0
 ///<summary>Opens this patient's ortho chart with a specific chart tab opened.  tabIndex correlates to the index of OrthoChartTabs.Listt.</summary>
 public FormOrthoChart(Patient patCur, int tabIndex)
 {
     _patCur     = patCur;
     _patNoteCur = PatientNotes.Refresh(_patCur.PatNum, _patCur.Guarantor);
     _prevRow    = -1;
     InitializeComponent();
     _indexInitialTab = tabIndex;
     Lan.F(this);
 }
Esempio n. 14
0
        ///<summary>Updates one PatientNote in the database.</summary>
        public static void Update(PatientNote patientNote)
        {
            string command = "UPDATE patientnote SET "
                             //FamFinancial excluded from update
                             + "ApptPhone                 =  " + DbHelper.ParamChar + "paramApptPhone, "
                             + "Medical                   =  " + DbHelper.ParamChar + "paramMedical, "
                             + "Service                   =  " + DbHelper.ParamChar + "paramService, "
                             + "MedicalComp               =  " + DbHelper.ParamChar + "paramMedicalComp, "
                             + "Treatment                 =  " + DbHelper.ParamChar + "paramTreatment, "
                             + "ICEName                   = '" + POut.String(patientNote.ICEName) + "', "
                             + "ICEPhone                  = '" + POut.String(patientNote.ICEPhone) + "', "
                             + "OrthoMonthsTreatOverride  =  " + POut.Int(patientNote.OrthoMonthsTreatOverride) + ", "
                             + "DateOrthoPlacementOverride=  " + POut.Date(patientNote.DateOrthoPlacementOverride) + ", "
                             //SecDateTEntry not allowed to change
                             //SecDateTEdit can only be set by MySQL
                             + "Consent                   =  " + POut.Int((int)patientNote.Consent) + " "
                             + "WHERE PatNum = " + POut.Long(patientNote.PatNum);

            if (patientNote.FamFinancial == null)
            {
                patientNote.FamFinancial = "";
            }
            OdSqlParameter paramFamFinancial = new OdSqlParameter("paramFamFinancial", OdDbType.Text, POut.StringNote(patientNote.FamFinancial));

            if (patientNote.ApptPhone == null)
            {
                patientNote.ApptPhone = "";
            }
            OdSqlParameter paramApptPhone = new OdSqlParameter("paramApptPhone", OdDbType.Text, POut.StringParam(patientNote.ApptPhone));

            if (patientNote.Medical == null)
            {
                patientNote.Medical = "";
            }
            OdSqlParameter paramMedical = new OdSqlParameter("paramMedical", OdDbType.Text, POut.StringNote(patientNote.Medical));

            if (patientNote.Service == null)
            {
                patientNote.Service = "";
            }
            OdSqlParameter paramService = new OdSqlParameter("paramService", OdDbType.Text, POut.StringNote(patientNote.Service));

            if (patientNote.MedicalComp == null)
            {
                patientNote.MedicalComp = "";
            }
            OdSqlParameter paramMedicalComp = new OdSqlParameter("paramMedicalComp", OdDbType.Text, POut.StringNote(patientNote.MedicalComp));

            if (patientNote.Treatment == null)
            {
                patientNote.Treatment = "";
            }
            OdSqlParameter paramTreatment = new OdSqlParameter("paramTreatment", OdDbType.Text, POut.StringNote(patientNote.Treatment));

            Db.NonQ(command, paramFamFinancial, paramApptPhone, paramMedical, paramService, paramMedicalComp, paramTreatment);
        }
 private PatientNoteModel MapPatientNoteToPatientNoteModel(PatientNote patientNote)
 {
     return(new PatientNoteModel
     {
         Id = patientNote.Id.ToString(),
         Note = patientNote.Note,
         PatientId = patientNote.PatientId,
         Created = patientNote.Created,
         Edited = patientNote.Edited
     });
 }
        public PatientNoteData MapPatientNote(string patientMongoId, PatientNote n)
        {
            var pnote = new PatientNoteData
            {
                ExternalRecordId = n.NoteId.ToString(),
                Text             = n.Note,
                PatientId        = n.PatientId.ToString(), // look into this.
                DataSource       = _dataSource,
                CreatedOn        = n.CreatedDate.GetValueOrDefault(),
                CreatedById      = Constants.SystemContactId,
                TypeId           = GetNoteType(Convert.ToInt32(n.ActionID), n.CategoryId)// get note type
            };

            if (!pnote.TypeId.Equals("54909997d43323251c0a1dfe"))
            {
                return(pnote);
            }

            if (pnote.TypeId.Equals("54909997d43323251c0a1dfe"))
            {
                pnote.SourceId = "540f2091d4332319883f3e9c";//outbound
                //pnote.DurationId = "540f216cd4332319883f3e9e"; //not applicable
                pnote.ContactedOn = n.CreatedDate.GetValueOrDefault();
            }

            switch (n.ActionID)
            {
            case 1:
                pnote.MethodId  = "540f1da4d4332319883f3e8b";     //mail
                pnote.OutcomeId = "540f1f10d4332319883f3e92";     // successful
                pnote.WhoId     = "540f1fbcd4332319883f3e95";
                break;

            case 2:
                pnote.MethodId  = "540f1d9dd4332319883f3e89";     //phone
                pnote.OutcomeId = "540f1f14d4332319883f3e93";     // unsuccessful
                pnote.WhoId     = "540f1fbcd4332319883f3e95";
                break;

            case 3:
                pnote.MethodId  = "540f1d9dd4332319883f3e89";     //phone
                pnote.OutcomeId = "540f1f10d4332319883f3e92";     // successful
                pnote.WhoId     = "540f1fbcd4332319883f3e95";
                break;

            case 4:
                pnote.MethodId  = "540f1d9dd4332319883f3e89"; //phone
                pnote.OutcomeId = "540f1f10d4332319883f3e92"; // successful
                pnote.WhoId     = "540f1fc0d4332319883f3e96"; //caremanager
                break;
            }
            return(pnote);
        }
Esempio n. 17
0
        public async Task <IActionResult> Notes(string patientid, [FromBody] PatientNote notes)
        {
            // timestamp must be now, ignore/override any values posted in
            notes.Timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();

            IMutateInBuilder <dynamic> builder = _bucket.MutateIn <dynamic>(patientid)
                                                 .ArrayAppend("notes", notes, false);
            var result = await builder.ExecuteAsync();

            if (result.Success)
            {
                return(Ok(notes));
            }
            return(CouchbaseError(result));
        }
Esempio n. 18
0
 ///<summary>Inserts one PatientNote into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(PatientNote patientNote)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(patientNote, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             patientNote.PatNum = DbHelper.GetNextOracleKey("patientnote", "PatNum");                  //Cacheless method
         }
         return(InsertNoCache(patientNote, true));
     }
 }
Esempio n. 19
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<PatientNote> TableToList(DataTable table){
			List<PatientNote> retVal=new List<PatientNote>();
			PatientNote patientNote;
			for(int i=0;i<table.Rows.Count;i++) {
				patientNote=new PatientNote();
				patientNote.PatNum      = PIn.Long  (table.Rows[i]["PatNum"].ToString());
				patientNote.FamFinancial= PIn.String(table.Rows[i]["FamFinancial"].ToString());
				patientNote.ApptPhone   = PIn.String(table.Rows[i]["ApptPhone"].ToString());
				patientNote.Medical     = PIn.String(table.Rows[i]["Medical"].ToString());
				patientNote.Service     = PIn.String(table.Rows[i]["Service"].ToString());
				patientNote.MedicalComp = PIn.String(table.Rows[i]["MedicalComp"].ToString());
				patientNote.Treatment   = PIn.String(table.Rows[i]["Treatment"].ToString());
				retVal.Add(patientNote);
			}
			return retVal;
		}
Esempio n. 20
0
        public void GetPaitentNote_Test()
        {
            GetPatientNoteRequest request = new GetPatientNoteRequest();

            request.ContractNumber = "InHealth001";
            request.UserId         = "AD_TestHarness";
            request.Version        = 1;
            request.Id             = "5307b27fd433232ed88e5020";
            request.PatientId      = "52f55877072ef709f84e69b0";
            request.UserId         = "Snehal";

            NotesManager gManager = new NotesManager();
            PatientNote  response = gManager.GetPatientNote(request);

            Assert.IsNotNull(response);
        }
Esempio n. 21
0
 ///<summary>Returns true if Update(PatientNote,PatientNote) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(PatientNote patientNote, PatientNote oldPatientNote)
 {
     //FamFinancial excluded from update
     if (patientNote.ApptPhone != oldPatientNote.ApptPhone)
     {
         return(true);
     }
     if (patientNote.Medical != oldPatientNote.Medical)
     {
         return(true);
     }
     if (patientNote.Service != oldPatientNote.Service)
     {
         return(true);
     }
     if (patientNote.MedicalComp != oldPatientNote.MedicalComp)
     {
         return(true);
     }
     if (patientNote.Treatment != oldPatientNote.Treatment)
     {
         return(true);
     }
     if (patientNote.ICEName != oldPatientNote.ICEName)
     {
         return(true);
     }
     if (patientNote.ICEPhone != oldPatientNote.ICEPhone)
     {
         return(true);
     }
     if (patientNote.OrthoMonthsTreatOverride != oldPatientNote.OrthoMonthsTreatOverride)
     {
         return(true);
     }
     if (patientNote.DateOrthoPlacementOverride.Date != oldPatientNote.DateOrthoPlacementOverride.Date)
     {
         return(true);
     }
     //SecDateTEntry not allowed to change
     //SecDateTEdit can only be set by MySQL
     if (patientNote.Consent != oldPatientNote.Consent)
     {
         return(true);
     }
     return(false);
 }
        private PatientNote MapPatientNoteModelToPatientNote(PatientNoteModel patientNoteModel)
        {
            var patientNote = new PatientNote
            {
                Note      = patientNoteModel.Note,
                PatientId = patientNoteModel.PatientId,
                Created   = patientNoteModel.Created,
                Edited    = patientNoteModel.Edited
            };

            if (!string.IsNullOrEmpty(patientNoteModel.Id))
            {
                patientNote.Id = new MongoDB.Bson.ObjectId(patientNoteModel.Id ?? string.Empty);
            }

            return(patientNote);
        }
Esempio n. 23
0
        public PatientNote GetPatientNote(GetPatientNoteRequest request)
        {
            try
            {
                PatientNote result = null;
                //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Note/{Id}", "GET")]
                IRestClient client = new JsonServiceClient();
                string      url    = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Note/{5}",
                                                                          DDPatientNoteUrl,
                                                                          "NG",
                                                                          request.Version,
                                                                          request.ContractNumber,
                                                                          request.PatientId,
                                                                          request.Id), request.UserId);

                GetPatientNoteDataResponse ddResponse = client.Get <GetPatientNoteDataResponse>(url);

                if (ddResponse != null && ddResponse.PatientNote != null)
                {
                    PatientNoteData n = ddResponse.PatientNote;
                    result = new PatientNote
                    {
                        Id                = n.Id,
                        PatientId         = n.PatientId,
                        Text              = n.Text,
                        ProgramIds        = n.ProgramIds,
                        CreatedOn         = n.CreatedOn,
                        CreatedById       = n.CreatedById,
                        TypeId            = n.TypeId,
                        MethodId          = n.MethodId,
                        OutcomeId         = n.OutcomeId,
                        WhoId             = n.WhoId,
                        SourceId          = n.SourceId,
                        Duration          = n.Duration,
                        ValidatedIdentity = n.ValidatedIdentity,
                        ContactedOn       = n.ContactedOn,
                        UpdatedById       = n.UpdatedById,
                        UpdatedOn         = n.UpdatedOn,
                        DataSource        = n.DataSource
                    };
                }
                return(result);
            }
            catch (WebServiceException ex) { throw ex; }
        }
Esempio n. 24
0
        ///<summary></summary>
        public static void Update(PatientNote Cur, int guarantor)
        {
            string command = "UPDATE patientnote SET "
                             //+ "apptphone = '"   +POut.PString(Cur.ApptPhone)+"'"
                             + "Medical = '" + POut.PString(Cur.Medical) + "'"
                             + ",Service = '" + POut.PString(Cur.Service) + "'"
                             + ",MedicalComp = '" + POut.PString(Cur.MedicalComp) + "'"
                             + ",Treatment = '" + POut.PString(Cur.Treatment) + "'"
                             + " WHERE patnum = '" + POut.PInt(Cur.PatNum) + "'";

            //MessageBox.Show(command);
            General.NonQ(command);
            command = "UPDATE patientnote SET "
                      + "famfinancial = '" + POut.PString(Cur.FamFinancial) + "'"
                      + " WHERE patnum = '" + POut.PInt(guarantor) + "'";
            //MessageBox.Show(command);
            General.NonQ(command);
        }
Esempio n. 25
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <PatientNote> TableToList(DataTable table)
        {
            List <PatientNote> retVal = new List <PatientNote>();
            PatientNote        patientNote;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                patientNote              = new PatientNote();
                patientNote.PatNum       = PIn.Long(table.Rows[i]["PatNum"].ToString());
                patientNote.FamFinancial = PIn.String(table.Rows[i]["FamFinancial"].ToString());
                patientNote.ApptPhone    = PIn.String(table.Rows[i]["ApptPhone"].ToString());
                patientNote.Medical      = PIn.String(table.Rows[i]["Medical"].ToString());
                patientNote.Service      = PIn.String(table.Rows[i]["Service"].ToString());
                patientNote.MedicalComp  = PIn.String(table.Rows[i]["MedicalComp"].ToString());
                patientNote.Treatment    = PIn.String(table.Rows[i]["Treatment"].ToString());
                retVal.Add(patientNote);
            }
            return(retVal);
        }
Esempio n. 26
0
        ///<summary>Updates one PatientNote in the database.</summary>
        public static void Update(PatientNote patientNote)
        {
            string command = "UPDATE patientnote SET "
                             //FamFinancial excluded from update
                             + "ApptPhone   = '" + POut.String(patientNote.ApptPhone) + "', "
                             + "Medical     = '" + POut.String(patientNote.Medical) + "', "
                             + "Service     = '" + POut.String(patientNote.Service) + "', "
                             + "MedicalComp =  " + DbHelper.ParamChar + "paramMedicalComp, "
                             + "Treatment   = '" + POut.String(patientNote.Treatment) + "' "
                             + "WHERE PatNum = " + POut.Long(patientNote.PatNum);

            if (patientNote.MedicalComp == null)
            {
                patientNote.MedicalComp = "";
            }
            OdSqlParameter paramMedicalComp = new OdSqlParameter("paramMedicalComp", OdDbType.Text, patientNote.MedicalComp);

            Db.NonQ(command, paramMedicalComp);
        }
Esempio n. 27
0
        public async Task <ActionResult <PatientNote> > Add(PatientNote patientNote)
        {
            try
            {
                if (patientNote == null)
                {
                    return(BadRequest());
                }

                var result = await patientNoteRepository.Add(patientNote);

                return(result);
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError,
                                  "Error creating the new patient note record"));
            }
        }
Esempio n. 28
0
        public void Synchronize(Patient patient, ICollection <PatientNoteDetail> sourceList, Staff newNoteAuthor, IPersistenceContext context)
        {
            foreach (PatientNoteDetail noteDetail in sourceList)
            {
                if (noteDetail.PatientNoteRef == null)
                {
                    patient.AddNote(CreateNote(noteDetail, newNoteAuthor, context));
                }
                else
                {
                    PatientNote note = CollectionUtils.SelectFirst(patient.Notes,
                                                                   delegate(PatientNote n) { return(n.GetRef().Equals(noteDetail.PatientNoteRef, true)); });

                    if (note != null)
                    {
                        UpdateNote(note, noteDetail);
                    }
                }
            }
        }
Esempio n. 29
0
        public PatientNoteDetail CreateNoteDetail(PatientNote note, IPersistenceContext context)
        {
            if (note == null)
            {
                return(null);
            }

            PatientNoteCategoryAssembler categoryAssembler = new PatientNoteCategoryAssembler();
            StaffAssembler staffAssembler = new StaffAssembler();

            return(new PatientNoteDetail(
                       note.GetRef(),
                       note.Comment,
                       categoryAssembler.CreateNoteCategorySummary(note.Category, context),
                       staffAssembler.CreateStaffSummary(note.Author, context),
                       note.CreationTime,
                       note.ValidRange.From,
                       note.ValidRange.Until,
                       note.IsExpired));
        }
Esempio n. 30
0
        // Save button Click
        private void btnSave_Click(object sender, RoutedEventArgs args)
        {
            var inkCanvasHelper  = new InkCanvasHelper();
            var inkCanvasStrokes = inkCanvasHelper.StrokesToBase64(this.inkCanv.Strokes);

            try
            {
                var patientNote = new PatientNote
                {
                    PatientId        = EHealthCareDesktopApp.Properties.Settings.Default.PatientID,
                    Subject          = txtSubject.Text.Trim(),
                    Date             = dtPicker.SelectedDate.Value,
                    UniqueIdentifier = EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier,
                    Notes            = inkCanvasStrokes
                };

                var patientRepository = new PatientNotesRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier);

                if (IsUpdated)
                {
                    patientRepository.UpdatePatientNotes(PatientNotesId, patientNote);
                    this.Close();
                }
                else
                {
                    patientRepository.SavePatientNotes(patientNote);
                }

                if (InkPadAddedEvent != null)
                {
                    InkPadAddedEvent("Success");
                }
            }
            catch (Exception ex)
            {
                if (InkPadAddedEvent != null)
                {
                    InkPadAddedEvent(ex.Message);
                }
            }
        }
Esempio n. 31
0
 ///<summary>Returns true if Update(PatientNote,PatientNote) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(PatientNote patientNote, PatientNote oldPatientNote)
 {
     //FamFinancial excluded from update
     if (patientNote.ApptPhone != oldPatientNote.ApptPhone)
     {
         return(true);
     }
     if (patientNote.Medical != oldPatientNote.Medical)
     {
         return(true);
     }
     if (patientNote.Service != oldPatientNote.Service)
     {
         return(true);
     }
     if (patientNote.MedicalComp != oldPatientNote.MedicalComp)
     {
         return(true);
     }
     if (patientNote.Treatment != oldPatientNote.Treatment)
     {
         return(true);
     }
     if (patientNote.ICEName != oldPatientNote.ICEName)
     {
         return(true);
     }
     if (patientNote.ICEPhone != oldPatientNote.ICEPhone)
     {
         return(true);
     }
     if (patientNote.OrthoMonthsTreatOverride != oldPatientNote.OrthoMonthsTreatOverride)
     {
         return(true);
     }
     if (patientNote.DateOrthoPlacementOverride.Date != oldPatientNote.DateOrthoPlacementOverride.Date)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 32
0
        ///<summary>Inserts one PatientNote into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(PatientNote patientNote, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                patientNote.PatNum = ReplicationServers.GetKey("patientnote", "PatNum");
            }
            string command = "INSERT INTO patientnote (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "PatNum,";
            }
            command += "FamFinancial,ApptPhone,Medical,Service,MedicalComp,Treatment) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(patientNote.PatNum) + ",";
            }
            command +=
                "'" + POut.String(patientNote.FamFinancial) + "',"
                + "'" + POut.String(patientNote.ApptPhone) + "',"
                + "'" + POut.String(patientNote.Medical) + "',"
                + "'" + POut.String(patientNote.Service) + "',"
                + DbHelper.ParamChar + "paramMedicalComp,"
                + "'" + POut.String(patientNote.Treatment) + "')";
            if (patientNote.MedicalComp == null)
            {
                patientNote.MedicalComp = "";
            }
            OdSqlParameter paramMedicalComp = new OdSqlParameter("paramMedicalComp", OdDbType.Text, patientNote.MedicalComp);

            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command, paramMedicalComp);
            }
            else
            {
                patientNote.PatNum = Db.NonQ(command, true, paramMedicalComp);
            }
            return(patientNote.PatNum);
        }
Esempio n. 33
0
        public void UpdatePatientNote_Test()
        {
            List <string> prog = new List <string>();

            prog.Add("558c756184ac0707d02f72c8");

            PatientNote data = new PatientNote
            {
                Id                = "558c757284ac05114837dc38",
                PatientId         = "5429d29984ac050c788bd34f",
                Text              = "JJJJ",
                ProgramIds        = prog,
                TypeId            = "54909997d43323251c0a1dfe",
                MethodId          = "540f1da7d4332319883f3e8c",
                WhoId             = "540f1fc3d4332319883f3e97",
                OutcomeId         = "540f1f14d4332319883f3e93",
                SourceId          = "540f2091d4332319883f3e9c",
                Duration          = 123,
                ValidatedIdentity = true,
                ContactedOn       = DateTime.Now.AddDays(4)
            };

            UpdatePatientNoteRequest request = new UpdatePatientNoteRequest
            {
                ContractNumber = "InHealth001",
                UserId         = "54909997d43323251c0a1dfe",
                Version        = 1.0,
                PatientNote    = data,
                Id             = data.Id,
                PatientId      = data.PatientId
            };

            string requestURL = string.Format("{0}/{1}/{2}/Patient/{3}/Note/{4}?UserId={5}", "http://localhost:888/Nightingale", request.Version, request.ContractNumber, data.PatientId, data.Id, request.UserId);
            //[Route("/{Version}/{ContractNumber}/Patient/{PatientId}/Note/{Id}", "PUT")]
            IRestClient client = new JsonServiceClient();
            UpdatePatientNoteResponse response = client.Put <UpdatePatientNoteResponse>(requestURL, request);

            Assert.IsNotNull(response);
        }
Esempio n. 34
0
		///<summary>Updates one PatientNote in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
		public static bool Update(PatientNote patientNote,PatientNote oldPatientNote){
			string command="";
			//FamFinancial excluded from update
			if(patientNote.ApptPhone != oldPatientNote.ApptPhone) {
				if(command!=""){ command+=",";}
				command+="ApptPhone = '"+POut.String(patientNote.ApptPhone)+"'";
			}
			if(patientNote.Medical != oldPatientNote.Medical) {
				if(command!=""){ command+=",";}
				command+="Medical = '"+POut.String(patientNote.Medical)+"'";
			}
			if(patientNote.Service != oldPatientNote.Service) {
				if(command!=""){ command+=",";}
				command+="Service = '"+POut.String(patientNote.Service)+"'";
			}
			if(patientNote.MedicalComp != oldPatientNote.MedicalComp) {
				if(command!=""){ command+=",";}
				command+="MedicalComp = "+DbHelper.ParamChar+"paramMedicalComp";
			}
			if(patientNote.Treatment != oldPatientNote.Treatment) {
				if(command!=""){ command+=",";}
				command+="Treatment = '"+POut.String(patientNote.Treatment)+"'";
			}
			if(command==""){
				return false;
			}
			if(patientNote.MedicalComp==null) {
				patientNote.MedicalComp="";
			}
			OdSqlParameter paramMedicalComp=new OdSqlParameter("paramMedicalComp",OdDbType.Text,patientNote.MedicalComp);
			command="UPDATE patientnote SET "+command
				+" WHERE PatNum = "+POut.Long(patientNote.PatNum);
			Db.NonQ(command,paramMedicalComp);
			return true;
		}
Esempio n. 35
0
		///<summary>Updates one PatientNote in the database.</summary>
		public static void Update(PatientNote patientNote){
			string command="UPDATE patientnote SET "
				//FamFinancial excluded from update
				+"ApptPhone   = '"+POut.String(patientNote.ApptPhone)+"', "
				+"Medical     = '"+POut.String(patientNote.Medical)+"', "
				+"Service     = '"+POut.String(patientNote.Service)+"', "
				+"MedicalComp =  "+DbHelper.ParamChar+"paramMedicalComp, "
				+"Treatment   = '"+POut.String(patientNote.Treatment)+"' "
				+"WHERE PatNum = "+POut.Long(patientNote.PatNum);
			if(patientNote.MedicalComp==null) {
				patientNote.MedicalComp="";
			}
			OdSqlParameter paramMedicalComp=new OdSqlParameter("paramMedicalComp",OdDbType.Text,patientNote.MedicalComp);
			Db.NonQ(command,paramMedicalComp);
		}