コード例 #1
0
 public int InsertPatientCardSerialNumber(psmartCard psmartCard)
 {
     try
     {
         using (UnitOfWork unitOfWork = new UnitOfWork(new PsmartContext()))
         {
             var mstPatient = unitOfWork.MstPatientReposiroty.FindBy(x => x.Ptn_pk == psmartCard.PATIENTID).Select(x => new MstPatient()
             {
                 CardSerialNumber = psmartCard.CARD_SERIAL_NO
             })
                              .FirstOrDefault();
             if (mstPatient != null)
             {
                 mstPatient.CardSerialNumber = psmartCard.CARD_SERIAL_NO;
             }
             unitOfWork.MstPatientReposiroty.Update(mstPatient);
             _result = unitOfWork.Complete();
             unitOfWork.Dispose();
             return(_result);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
コード例 #2
0
 public int UpdateCardSerial(psmartCard psmartCard)
 {
     using (UnitOfWork unitOfWork = new UnitOfWork(new PsmartContext()))
     {
         return(unitOfWork.MstPatientReposiroty.UpdateSerialNUmber(psmartCard));
     }
 }
コード例 #3
0
        //public void InsertNewClient(string firstName, string middleName, string lastName, DateTime registrationDate, string dob, string dobPrecision, string phone, string gender, string landmark, string maritalStatus, string htsId, int moduleId, string cardSerial, string village, string ward, string subcounty, string heiId, string Address,string card_issuing_facility)
        //{
        //    MstPatient patient = new MstPatient()
        //    {
        //        //LocationID = shr.PA ,
        //        //GODS_NUMBER = ,
        //        //CardSerialNumber = ,
        //        //HTSID = ,
        //        //FirstName = ,
        //        //MIddleName = ,
        //        //LastName = ,
        //        //DOB=,
        //        //DobPrecision = ,
        //    };
        //     _mstPatientManager.InsertNewClient( firstName,  middleName,  lastName,  registrationDate,  dob,  dobPrecision,  phone,  gender,  landmark,  maritalStatus, htsId,moduleId,cardSerial,village,ward,subcounty,heiId,Address,card_issuing_facility);
        //}

        public int InsertPatientCardSerialNumber(psmartCard psmartCard)
        {
            result = _mstPatientManager.InsertPatientCardSerialNumber(psmartCard);
            return(result);
            //if (result > 0)
            //{
            //    return "Card serial for " + psmartCard.PATIENTID + "updated successfully";
            //}else { return "Card serial for " + psmartCard.PATIENTID + "NOT updated"; }
        }
コード例 #4
0
 public IHttpActionResult Post([FromBody] psmartCard psmartCard)
 {
     try
     {
         var clientShr = _incomingMessageService.FetchClientShr(psmartCard);
         return(Ok(clientShr));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #5
0
        public DtoShr FetchClientShr(psmartCard psmartCard)
        {
            PsmartShrManager psmartShrManager = new PsmartShrManager();

            if (psmartCard.PATIENTID is int i)
            {
                var shr = psmartShrManager.GenerateShrForEmr(psmartCard.PATIENTID);

                return(shr);
            }
            else
            {
                PsmartShrCardSerialManager psmartShrCardSerialManager = new PsmartShrCardSerialManager();
                var shr = psmartShrCardSerialManager.GenerateShrForEmr(psmartCard.CARD_SERIAL_NO);
                return(shr);
            }
        }
コード例 #6
0
        public IHttpActionResult ProcessCardSerialNumber([FromBody] dynamic _psmartCard)
        {
            var    serializer = new JavaScriptSerializer();
            var    jsonObject = serializer.DeserializeObject(_psmartCard.ToString());
            string CARD_SERIAL_NO = ""; int PATIENTID = 0;

            foreach (var item in jsonObject)
            {
                if (item.Key == "CARD_SERIAL_NO")
                {
                    CARD_SERIAL_NO = item.Value;
                }
                if (item.Key == "PATIENTID")
                {
                    PATIENTID = Convert.ToInt32(item.Value);
                }
            }
            psmartCard _card = new psmartCard()
            {
                CARD_SERIAL_NO = CARD_SERIAL_NO,
                PATIENTID      = PATIENTID
            };

            //psmartCard.PATIENTID = 30730;
            // psmartCard.CARD_SERIAL_NO = "12345-abcedw-098765";

            if (string.IsNullOrEmpty(_card.CARD_SERIAL_NO))
            {
                return(BadRequest());
            }
            else
            {
                //TODO saving to Greencard Tables
                // string processCardStatus= _incomingMessageService.ProcessCardSerialNumberIdentifier(_card);
                var result = _incomingMessageService.ProcessCardSerialNumberIdentifierBluecard(_card);

                return(Ok(result));
                //TODO return SHR after saving the serial.
            }
        }
コード例 #7
0
        public DtoShr ProcessCardSerialNumberIdentifierBluecard(psmartCard psmartCard)
        {
            MstPatientManager          patientManager             = new MstPatientManager();
            PsmartShrCardSerialManager psmartShrCardSerialManager = new PsmartShrCardSerialManager();
            DtoShr NewSHR = new DtoShr();

            try
            {
                //  int result = patientManager.UpdatePatientCardSerial(psmartCard);
                string processCardStatus = this.ProcessCardSerialNumberIdentifier(psmartCard);

                if (!string.IsNullOrEmpty(processCardStatus))
                {
                    NewSHR = psmartShrCardSerialManager.GenerateShrForEmr(psmartCard.CARD_SERIAL_NO);
                }
                return(NewSHR);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
コード例 #8
0
 public int UpdatePatientCardSerial(psmartCard psmartCard)
 {
     return(_mstPatientManager.UpdateCardSerial(psmartCard));
 }
コード例 #9
0
 DtoShr IIncomingMessageService.FetchClientShr(psmartCard psmartCard)
 {
     throw new NotImplementedException();
 }
コード例 #10
0
 public DtoShr ProcessCardSerialNumberIdentifierBluecard(psmartCard psmartCard)
 {
     throw new NotImplementedException();
 }
コード例 #11
0
 public string ProcessCardSerialNumberIdentifier(psmartCard psmartCard)
 {
     throw new NotImplementedException();
 }
コード例 #12
0
        public int UpdateSerialNUmber(psmartCard psmartCard)
        {
            int result = _context.Database.ExecuteSqlCommand($"UPDATE mst_Patient SET CardSerialNumber='{psmartCard.CARD_SERIAL_NO}' WHERE Ptn_Pk= {psmartCard.PATIENTID}");

            return(result);
        }
コード例 #13
0
        public string ProcessCardSerialNumberIdentifier(psmartCard psmartCard)
        {
            // PatientEnrollmentManager patientEnrollmentManager = new PatientEnrollmentManager();
            IdentifierManager           identifierManager           = new IdentifierManager();
            PersonIdentifierManager     personIdentifierManager     = new PersonIdentifierManager();
            PatientManager              patientManager              = new PatientManager();
            PatientLookupManager        lookupManager               = new PatientLookupManager();
            PersonExtendedLookupManager personExtendedLookupManager = new PersonExtendedLookupManager();
            // PatientIdentifierManager patientIdentifierManager = new PatientIdentifierManager();


            // var patientEnrollment = patientEnrollmentManager.GetPatientEnrollmentByPatientId(psmartCard.PATIENTID);
            // int patientEnrollmentId = patientEnrollment[0].Id;
            int results = 0;
            // Identifier identifier = identifierManager.GetIdentifierByCode("GODS_NUMBER");
            Identifier identifier = identifierManager.GetIdentifierByCode("CARD_SERIAL_NUMBER");

            personId = patientManager.GetPersonId(psmartCard.PATIENTID);
            try
            {
                //var patientEntityIdentifier = new PatientEntityIdentifier()
                //{
                //    IdentifierTypeId = identifier.Id,
                //    IdentifierValue = psmartCard.CARD_SERIAL_NO,
                //    PatientEnrollmentId = patientEnrollmentId,
                //    PatientId = psmartCard.PATIENTID
                //};

                // PatientLookup patient = lookupManager.GetPatientByPersonId(personId);

                var patient = personExtendedLookupManager.GetPatientDetailsByPersonId(personId);

                var personEntityIdentifier = new PersonIdentifier()
                {
                    IdentifierId      = identifier.Id,
                    IdentifierValue   = psmartCard.CARD_SERIAL_NO,
                    PersonId          = personId,
                    AssigningFacility = patient.FacilityId.ToString(),
                    Active            = true,
                    DeleteFlag        = false
                };

                string serialNumber = null;
                //var identifierLists = patientIdentifierManager.CheckIfIdentifierNumberIsUsed(psmartCard.CARD_SERIAL_NO, patientEntityIdentifier.IdentifierTypeId);
                var identifierLists = personIdentifierManager.CheckIfPersonIdentifierExists(psmartCard.CARD_SERIAL_NO, personEntityIdentifier.IdentifierId);

                foreach (var identifierList in identifierLists)
                {
                    serialNumber = identifierList.IdentifierValue;
                }
                if (string.IsNullOrEmpty(serialNumber))
                {
                    //results = _personIdentifierManager.AddPersonIdentifier(patientEntityIdentifier.PatientId,
                    //    patientEntityIdentifier.PatientEnrollmentId, patientEntityIdentifier.IdentifierTypeId,
                    //    patientEntityIdentifier.IdentifierValue, 0, false);
                    results = personIdentifierManager.AddPersonIdentifier(personId, personEntityIdentifier.IdentifierId, psmartCard.CARD_SERIAL_NO, 1, personEntityIdentifier.AssigningFacility);
                    return((results) > 0 ? "Card serial Number Linked to a patient as identifier" : "Failed linking card Serial Number to patient");
                }
                else
                {
                    return("Card Serial Number : " + psmartCard.CARD_SERIAL_NO + " is already assigned to a Patient.");
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }