コード例 #1
0
        internal static Dosage GetDosage(GeneralMeasurement dose, GeneralMeasurement frequency, CodableValue route)
        {
            var dosage = new Dosage();

            if (route != null)
            {
                dosage.Route = route.ToFhir();
            }

            if (frequency != null)
            {
                dosage.Text = frequency.Display;

                dosage.Timing = GetTiming(frequency);
            }

            if (dose != null)
            {
                dosage.Text = string.Join(Environment.NewLine, dose.Display, dosage.Text);

                dosage.Dose = GetSimpleQuantity(dose);
            }

            return(dosage);
        }
コード例 #2
0
 public static void LoadData(string start, string end)
 {
     _roles       = new List <Roles>(Roles.ListRoles());
     _patients    = new List <Patient>(Patient.ListPatients());
     _users       = new List <Users>(Users.ListUsers());
     _events      = new List <Events>(Events.ListEvents());
     _clinics     = new List <Clinics>(Clinics.ListClinic());
     _branch      = new List <Branch>(Branch.ListBranch());
     _queues      = new List <Queue>(Queue.ListQueue());
     _admit       = new List <Admission>(Admission.ListAdmission());
     _wards       = new List <Wards>(Wards.ListWards());
     _departments = new List <Departments>(Departments.ListDepartment());
     _procedures  = new List <Procedures>(Procedures.ListProcedures());
     _operations  = new List <Operations>(Operations.ListOperations());
     _specimens   = new List <Specimens>(Specimens.ListSpecimens());
     _tests       = new List <Tests>(Tests.ListTests());
     _disciplines = new List <Discipline>(Discipline.ListDiscipline());
     _beds        = new List <Beds>(Beds.ListBeds());
     _categories  = new List <Category>(Category.ListCategory());
     _cds         = new List <Cd10>(Cd10.ListCd10());
     _items       = new List <Item>(Item.ListItem());
     _stocks      = new List <Stock>(Stock.ListStock());
     _dosages     = new List <Dosage>(Dosage.ListDosage());
     _transactors = new List <Transactor>(Transactor.ListTransactors());
     //  _services = new List<Services>(Services.ListServices());
     // _diagnosis = new List<Diagnosis>(Diagnosis.ListDiagnosis());
     _rooms = new List <Room>(Room.ListRoom());
     // _vitals = new List<Vitals>(Vitals.ListVitals());
     _org = new List <Organisation>(Organisation.ListOrganisation());
 }
        public void WhenMedicationRequestTransformedToHealthVault_ThenDosageInstructionIsCopiedToInstructions()
        {
            MedicationRequest medicationRequest = GetSampleRequest();
            var dosage = new Dosage();

            medicationRequest.DosageInstruction = new System.Collections.Generic.List <Dosage>
            {
                dosage
            };

            var hvMedication = medicationRequest.ToHealthVault() as HVMedication;

            Assert.IsNull(hvMedication.Prescription?.Instructions);

            var dosageInstructions = new CodeableConcept
            {
                Text = "3 tablets/day, have it after dinner."
            };

            dosage.AdditionalInstruction = new System.Collections.Generic.List <CodeableConcept>
            {
                dosageInstructions
            };

            hvMedication = medicationRequest.ToHealthVault() as HVMedication;

            Assert.IsNotNull(hvMedication.Prescription?.Instructions);
        }
コード例 #4
0
        /// <summary>
        /// Deserialize JSON into a FHIR Dosage
        /// </summary>
        public static void DeserializeJson(this Dosage current, ref Utf8JsonReader reader, JsonSerializerOptions options)
        {
            string propertyName;

            while (reader.Read())
            {
                if (reader.TokenType == JsonTokenType.EndObject)
                {
                    return;
                }

                if (reader.TokenType == JsonTokenType.PropertyName)
                {
                    propertyName = reader.GetString();
                    if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug)
                    {
                        Console.WriteLine($"Dosage >>> Dosage.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    reader.Read();
                    current.DeserializeJsonProperty(ref reader, options, propertyName);
                }
            }

            throw new JsonException($"Dosage: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
        }
コード例 #5
0
        public ActionResult EditMedicationRequest([Bind] EditMedicationRequest request, string patientID)
        {
            bool   status  = false;
            string Message = "";

            //SPRAWDZENIE DANYCH
            if (ModelState.IsValid)
            {
                //PODŁĄCZENIE KLIENTA
                var client = new FhirClient("http://localhost:8080/baseR4");
                client.PreferredFormat = ResourceFormat.Json;

                //PRZEKAZANIE DANYCH
                MedicationRequest original = client.Read <MedicationRequest>("MedicationRequest/" + request.ID);
                (original.Medication as CodeableConcept).Text = request.Reason;
                Dosage dosage = new Dosage();
                dosage.Text = request.Instruction;
                original.DosageInstruction.Add(dosage);

                //UPDATE
                client.Update(original);
                Message = "Your item successfully UPDATE";
                status  = true;
            }
            else
            {
                Message = "You haven't got right model";
            }

            ViewBag.ID      = patientID;
            ViewBag.Status  = status;
            ViewBag.Message = Message;
            return(View(request));
        }
コード例 #6
0
ファイル: DosageImpl.cs プロジェクト: frijol252/EducaOracle
        public Dosage Get()
        {
            Dosage           a     = new Dosage();
            OracleCommand    cmd   = null;
            string           query = @"SELECT IDDOSAGE,NROAUTHORIZATION,DOSAGEKEY,COALESCE(FINALNUMBER,0) FROM DOSAGE WHERE STATUS>0";
            OracleDataReader dr    = null;

            try
            {
                cmd = DBImplementation.CreateBasicCommand(query);
                dr  = DBImplementation.ExecuteDataReaderCommand(cmd);
                while (dr.Read())
                {
                    a.IdDosage         = int.Parse(dr[0].ToString());
                    a.NroAuthorization = long.Parse(dr[1].ToString());
                    a.DosageKey        = dr[2].ToString();
                    a.FinalNumber      = int.Parse(dr[2].ToString());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
                dr.Close();
            }
            return(a);
        }
コード例 #7
0
        public async Task <Dosage> UpdateAsync(Dosage updateModel)
        {
            var dosage = _context.Dosages.Update(updateModel).Entity;
            await _context.SaveChangesAsync();

            return(dosage);
        }
コード例 #8
0
        public async Task <Dosage> CreateAsync(Dosage createModel)
        {
            var dosage = (await _context.Dosages.AddAsync(createModel)).Entity;
            await _context.SaveChangesAsync();

            return(dosage);
        }
コード例 #9
0
ファイル: ManageInventory.cs プロジェクト: tanjirantu/Tulsi
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                Generic      g            = new Generic();
                Formulation  f            = new Formulation();
                Dosage       d            = new Dosage();
                Manufacturer m            = new Manufacturer();
                int          quantity     = Convert.ToInt32(txtQuantity.Text);
                double       unitPrice    = Convert.ToDouble(txtUnitPrice.Text);
                double       sellingPrice = Convert.ToDouble(txtSellingPrice.Text);
                DateTime     expireDate   = Convert.ToDateTime(cboExpireDate.Text);

                expireDate.ToString("yyy-MM-dd");

                g = generic.Get(cboGenericName.Text);
                f = formulation.Get(cboFormulationType.Text);
                d = dosage.Get(cboDosageAmount.Text);
                m = manufacturer.Get(cboManufacturer.Text);

                if (!String.IsNullOrWhiteSpace(txtBrandName.Text) && !String.IsNullOrWhiteSpace(cboGenericName.Text) &&
                    !String.IsNullOrWhiteSpace(cboFormulationType.Text) && !String.IsNullOrWhiteSpace(cboDosageAmount.Text) &&
                    !String.IsNullOrWhiteSpace(cboExpireDate.Text) && !String.IsNullOrWhiteSpace(txtQuantity.Text) &&
                    !String.IsNullOrWhiteSpace(txtUnitPrice.Text) && !String.IsNullOrWhiteSpace(txtSellingPrice.Text))
                {
                    Medicine med = new Medicine();
                    med.BrandName      = txtBrandName.Text;
                    med.GenericId      = g.Id;
                    med.FormulationId  = f.Id;
                    med.DosageId       = d.Id;
                    med.ManufacturerId = m.Id;
                    med.UnitPrice      = unitPrice;
                    med.SellingPrice   = sellingPrice;
                    med.Qty            = quantity;
                    med.ExpireDate     = expireDate;
                    int row = medicine.Insert(med);

                    if (row > 0)
                    {
                        lblMessage.Visible = true;
                    }

                    Console.WriteLine(g.Id);
                    Console.WriteLine(f.Id);
                    Console.WriteLine(d.Id);
                    Console.WriteLine(m.Id);
                    Console.WriteLine(quantity);
                    Console.WriteLine(unitPrice);
                    Console.WriteLine(sellingPrice);
                }
            } catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #10
0
        private void setHomePage()
        {
            Reading lastReading = user.readingHistory[user.readingHistory.Count - 1];

            HomeCurrentReading.Text            = lastReading.reading.ToString();
            HomeCurrentReadingTime.Text        = "Taken at " + lastReading.timestamp.ToShortTimeString();
            HomeCurrentReadingDescription.Text = lastReading.getReadingDescription();

            Dosage lastDosage = user.dosageHistory[user.dosageHistory.Count - 1];

            HomePreviousDosageAmount.Text      = lastDosage.amount.ToString();
            HomePreviousDosageDescription.Text = lastDosage.getDosageDescription();
            HomePreviousDosageTime.Text        = "Administered at " + lastDosage.timeStamp.ToShortTimeString();
        }
コード例 #11
0
 void LoadDosage()
 {
     try
     {
         dosageImpl = new DosageImpl();
         dosage     = dosageImpl.Get();
         lblAuthotization.Content = dosage.NroAuthorization.ToString();
         lbldosageKey.Content     = dosage.DosageKey;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #12
0
        public void TotalDosage()
        {
            // 1000m downwind, 0 crosswind, windspeed 2 kts, 1 kilogram fill, land, very unstable, rounded to 5 decimal places
            Assert.AreEqual(.28161, Math.Round(Dosage.TotalDosage(1000, 0, 2, 1, TargetSurfaceType.Land, PasquillStabilityCategory.VeryUnstable), 5));

            // 5000m downwind, 0 crosswind, windspeed 2 kts, 1 kilogram fill, land, very unstable, rounded to 5 decimal places
            Assert.AreEqual(.02066, Math.Round(Dosage.TotalDosage(5000, 0, 2, 1, TargetSurfaceType.Land, PasquillStabilityCategory.VeryUnstable), 5));

            // 10000m downwind, 0 crosswind, windspeed 2 kts, 1 kilogram fill, land, very unstable, rounded to 5 decimal places
            Assert.AreEqual(.00667, Math.Round(Dosage.TotalDosage(10000, 0, 2, 1, TargetSurfaceType.Land, PasquillStabilityCategory.VeryUnstable), 5));

            // 40000m downwind, 0 crosswind, windspeed 2 kts, 1 kilogram fill, land, very unstable, rounded to 5 decimal places
            Assert.AreEqual(.00069, Math.Round(Dosage.TotalDosage(40000, 0, 2, 1, TargetSurfaceType.Land, PasquillStabilityCategory.VeryUnstable), 5));
        }
コード例 #13
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            int minAge;

            try
            {
                minAge = Convert.ToInt32(MinAgeTextBox.Text);
            }
            catch (Exception)
            {
                MessageBoxService.ShowIncorrectInputWarning("Minimum age must be int type value.");
                return;
            }

            if (minAge < 0)
            {
                MessageBoxService.ShowIncorrectInputWarning("Minimum age must be greater or equal than '0'.");
                return;
            }

            double dose;

            try
            {
                dose = Convert.ToDouble(DoseTextBox.Text);
            }
            catch (Exception)
            {
                MessageBoxService.ShowIncorrectInputWarning("Dose must be double type value.");
                return;
            }

            if (dose <= 0)
            {
                MessageBoxService.ShowIncorrectInputWarning("Dose must be greater than '0'.");
                return;
            }

            DialogResultEntity = new Dosage
            {
                DiseaseMedicamentId = _diseaseMedicament.Id,
                MinAge = minAge,
                Dose   = dose
            };

            DialogResult = DialogResult.OK;
        }
コード例 #14
0
        internal static MedicationRequest ToFhirInternal(Prescription prescription, MedicationRequest medicationRequest)
        {
            medicationRequest.SetIntentAsInstanceOrder();
            medicationRequest.AuthoredOnElement = prescription.DatePrescribed?.ToFhir();
            if (prescription.AmountPrescribed != null ||
                prescription.Refills.HasValue ||
                prescription.DaysSupply.HasValue ||
                prescription.PrescriptionExpiration != null)
            {
                medicationRequest.DispenseRequest = new MedicationRequest.DispenseRequestComponent
                {
                    Quantity = HealthVaultCodesToFhir.GetSimpleQuantity(prescription.AmountPrescribed),
                    NumberOfRepeatsAllowed = prescription.Refills,
                    ExpectedSupplyDuration = new Duration()
                    {
                        Value = prescription.DaysSupply,
                        Code  = nameof(UnitsNet.Units.DurationUnit.Day)
                    },
                    ValidityPeriod = new Period
                    {
                        EndElement = prescription.PrescriptionExpiration?.ToFhir()
                    }
                };
            }

            if (prescription.Substitution != null)
            {
                bool?isAllowed = IsAllowed(prescription.Substitution);
                if (isAllowed.HasValue)
                {
                    medicationRequest.Substitution = new MedicationRequest.SubstitutionComponent
                    {
                        Allowed = isAllowed
                    };
                }
            }

            if (prescription.Instructions != null)
            {
                var dosage = new Dosage();
                dosage.AdditionalInstruction.Add(prescription.Instructions.ToFhir());
                medicationRequest.DosageInstruction.Add(dosage);
            }

            return(medicationRequest);
        }
コード例 #15
0
ファイル: InvoiceImpl.cs プロジェクト: frijol252/EducaOracle
        public void InsertTransaction(List <Payment> u, double total, Payer p)
        {
            string queryInvoice = @"INSERT INTO INVOICE(INVOICEDATE,TOTAL,NROINVOICE,CONTROLCODE,IDPAYER)
VALUES(CURRENT_TIMESTAMP,:TOTAL,:NROINVOICE,:CONTROLCODE,:IDPAYER)";


            string queryDetail = @"INSERT INTO DETAIL(DESCRIPTIONS,AMOUNT,IDPAYMENT,IDINVOICE)
VALUES(:DESCRIPTIONS,:AMOUNT,:IDPAYMENT,:IDINVOICE)";



            try
            {
                int details = 0;
                foreach (var d in u)
                {
                    details++;
                }
                System.Diagnostics.Debug.WriteLine(string.Format("{0} | Info: Start Add Class.", DateTime.Now));
                List <OracleCommand>     cmds       = DBImplementation.CreateNBasicCommands(1);
                List <OracleParameter[]> parameters = new List <OracleParameter[]>();
                DosageImpl dosageImpl    = new DosageImpl();
                Dosage     dosage        = dosageImpl.Get();
                int        numberinvoice = dosage.FinalNumber + 1;
                string     controlCode   = ControlCode.generateControlCode(dosage.NroAuthorization.ToString(), numberinvoice.ToString(), p.Nit,
                                                                           DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString(),
                                                                           total.ToString(), dosage.DosageKey);
                int id = DBImplementation.GetIdentityFromTable("INVOICE");
                DBImplementation.ResetIdentFromTable("INVOICE");
                cmds[0].CommandText = queryInvoice;
                cmds[0].Parameters.Add(new OracleParameter(":TOTAL", total));
                cmds[0].Parameters.Add(new OracleParameter(":NROINVOICE", numberinvoice));
                cmds[0].Parameters.Add(new OracleParameter(":CONTROLCODE", controlCode));
                cmds[0].Parameters.Add(new OracleParameter(":IDPAYER", p.IdPayer));
                cmds[0].Parameters.AddRange(parameters[0]);



                DBImplementation.ExecuteNBasicCommand(cmds);
                System.Diagnostics.Debug.WriteLine(string.Format("{0} | Info: Invoice Succesfully.", DateTime.Now));
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("{0} | Error:  Could not Add Class({1}).", DateTime.Now, ex.Message));
            }
        }
コード例 #16
0
        private void btnAddGrade_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                dosage = new Dosage();
                dosage.NroAuthorization = long.Parse(txtNroAuthorizacion.Text);
                dosage.DosageKey        = txtTest.Text;

                dosageImpl = new DosageImpl();
                dosageImpl.InsertTransaction(dosage);
                MessageBox.Show("Dosage Update");
                LoadDosage();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something was wrong");
            }
        }
コード例 #17
0
ファイル: DosageDAL.cs プロジェクト: tanjirantu/Tulsi
        public Dosage Get(string dosageAmount)
        {
            string sql = "SELECT * FROM Dosages WHERE DosageAmount=@dosageAmount";

            this.command = new SqlCommand(sql, this.db.Conn);
            this.command.Parameters.AddWithValue("@dosageAmount", dosageAmount);
            this.db.Conn.Open();
            SqlDataReader reader = this.command.ExecuteReader();

            Dosage d = new Dosage();

            if (reader.Read())
            {
                d.Id           = Convert.ToInt32(reader["Id"]);
                d.DosageAmount = reader["DosageAmount"].ToString();
            }

            this.db.Conn.Close();
            return(d);
        }
コード例 #18
0
ファイル: DosageDAL.cs プロジェクト: tanjirantu/Tulsi
        public List <Dosage> GetAll()
        {
            string sql = "SELECT * FROM Dosages";

            this.command = new SqlCommand(sql, this.db.Conn);
            this.db.Conn.Open();
            SqlDataReader reader = this.command.ExecuteReader();

            List <Dosage> dlist = new List <Dosage>();

            while (reader.Read())
            {
                Dosage d = new Dosage();
                d.Id           = Convert.ToInt32(reader["Id"]);
                d.DosageAmount = reader["DosageAmount"].ToString();
                dlist.Add(d);
            }

            this.db.Close();
            return(dlist);
        }
コード例 #19
0
ファイル: DosagesController.cs プロジェクト: jtlesslar/ABATON
        public async Task <ActionResult <Dosage> > PostDosage(Dosage dosage)
        {
            if (dosage.Deleted)
            {
                return(BadRequest("Cannot add a deleted dosage"));
            }

            if (!_relationshipService.CheckPatientExists(dosage.PatientId))
            {
                return(BadRequest("Patient does not exist or is deleted"));
            }

            if (!_relationshipService.CheckDrugExists(dosage.DrugId))
            {
                return(BadRequest("Drug does not exist or is deleted"));
            }

            _context.Dosages.Add(dosage);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetDosage), new { id = dosage.Id }, dosage));
        }
コード例 #20
0
        private static MedicationRequest MakeMedicationRequest(Patient p, System.Collections.Generic.List <string> rx,
                                                               System.Collections.Generic.List <string> item, ResourceReference nom, ParticipantMaker a)
        {
            MedicationRequest m = new MedicationRequest
            {
                Id = FhirHelper.MakeId()
            };

            m.Status  = MedicationRequest.medicationrequestStatus.Active;
            m.Intent  = MedicationRequest.medicationRequestIntent.Order;
            m.Subject = FhirHelper.MakeInternalReference(p);
            m.Identifier.Add(FhirHelper.MakeIdentifier("https://fhir.nhs.uk/Id/prescription-line-id", item[EMUData.LINEITEMID]));
            ResourceReference rq = FhirHelper.MakeInternalReference(a.Role);

            rq.Display        = a.Practitioner.Name[0].Text;
            m.Requester       = rq;
            m.AuthoredOn      = rx[EMUData.AUTHORPARTICIPATIONTIME];
            m.GroupIdentifier = MakeGroupIdentifier(rx);

            DoPrescriptionType(m, rx);
            DoResponsiblePractitioner(m, a);
            m.Medication          = DoMedication(item);
            m.CourseOfTherapyType = MakeCourseOfTherapyType(rx);
            if (item[EMUData.DOSAGEINTRUCTIONS].Trim().Length > 0)
            {
                Dosage di = new Dosage
                {
                    Text = item[EMUData.DOSAGEINTRUCTIONS]
                };
                m.DosageInstruction.Add(di);
                if (item[EMUData.ADDITIONALINSTRUCTIONS].Trim().Length > 0)
                {
                    di.PatientInstruction = item[EMUData.ADDITIONALINSTRUCTIONS];
                }
            }
            m.DispenseRequest = MakeDispenseRequest(nom, rx, item);
            return(m);
        }
コード例 #21
0
ファイル: DosagesController.cs プロジェクト: jtlesslar/ABATON
        public async Task <IActionResult> PutDosage(long id, Dosage dosage)
        {
            if (id != dosage.Id)
            {
                return(BadRequest());
            }

            var existingDosage = await _context.Dosages.FindAsync(id);

            if (existingDosage == null)
            {
                return(NotFound());
            }

            //trying to restore a patient
            if (existingDosage.Deleted && !dosage.Deleted)
            {
                return(BadRequest("Cannot restore a dosage"));
            }

            if (!_relationshipService.CheckPatientExists(dosage.PatientId))
            {
                return(BadRequest("Patient does not exist or is deleted"));
            }

            if (!_relationshipService.CheckDrugExists(dosage.DrugId))
            {
                return(BadRequest("Drug does not exist or is deleted"));
            }

            _context.Entry(existingDosage).State = EntityState.Detached;

            _context.Entry(dosage).State = EntityState.Modified;

            await _context.SaveChangesAsync();

            return(NoContent());
        }
コード例 #22
0
        private List <Dosage> GetDosageInstructions(List <MedicationEntity> medicineList)
        {
            if (medicineList == null)
            {
                return(null);
            }

            var dosageList = new List <Dosage>();
            int i          = 1;

            foreach (var item in medicineList)
            {
                var dosage = new Dosage();
                dosage.Sequence = i;
                i++;
                dosage.Text               = GetMedicineDosageInstructionText(item);
                dosage.Timing             = GetDosageTiming(item);
                dosage.Route              = GetRoute(item);
                dosage.MaxDosePerLifetime = GetDosageQuantity(item);

                dosageList.Add(dosage);
            }
            return(dosageList);
        }
コード例 #23
0
        private void UpdatePrice(SqlTransaction trans, Entity.Formula formula, ref DataTable dtDosage, ref DataTable dtFormula)
        {
            DataRow[] drIsMaterial =
                dtDosage.Select("cnvcProductCode='" + formula.cnvcProductCode +
                                "' and cnvcProductType in ('SEMIPRODUCT','FINALPRODUCT')");
            //有半成品

            foreach (DataRow drMaterial in drIsMaterial)
            {
                Dosage         dosage    = new Dosage(drMaterial);
                DataRow[]      drFormula = dtFormula.Select("cnvcProductCode='" + dosage.cnvcCode + "'");
                Entity.Formula formula2  = new AMSApp.zhenghua.Entity.Formula(drFormula[0]);
                UpdatePrice(trans, formula2, ref dtDosage, ref dtFormula);
            }

            //配料全为原材料
            DataRow[] drDosages = dtDosage.Select("cnvcProductCode='" + formula.cnvcProductCode + "'");
            if (drDosages.Length > 0)
            {
                decimal dMaterialCostSum = 0;
                decimal dPackingCostSum  = 0;
                foreach (DataRow drDosage in drDosages)
                {
                    Dosage dosage = new Dosage(drDosage);
                    if (dosage.cnvcProductType == "Pack")
                    {
                        dPackingCostSum += dosage.cnnSum;
                    }
                    else
                    {
                        dMaterialCostSum += dosage.cnnSum;
                    }
                    //dSum += dosage.cnnSum;
                }
                if (dMaterialCostSum != formula.cnnMaterialCostSum || dPackingCostSum != formula.cnnPackingCostSum)
                {
                    formula.cnnMaterialCostSum = dMaterialCostSum;
                    formula.cnnPackingCostSum  = dPackingCostSum;
                    formula.cnnCostSum         = formula.cnnMaterialCostSum + formula.cnnPackingCostSum;
                    SqlHelper.ExecuteNonQuery(trans, CommandType.Text,
                                              "update tbFormula set cnnMaterialCostSum=" + formula.cnnMaterialCostSum +
                                              ",cnnPackingCostSum=" + formula.cnnPackingCostSum + ",cnnCostSum=" +
                                              formula.cnnCostSum + " where cnvcProductCode='" +
                                              formula.cnvcProductCode + "'");
                    DataRow[] drFormula = dtFormula.Select("cnvcProductCode='" + formula.cnvcProductCode + "'");
                    drFormula[0]["cnnMaterialCostSum"] = formula.cnnMaterialCostSum;
                    drFormula[0]["cnnPackingCostSum"]  = formula.cnnPackingCostSum;
                    drFormula[0]["cnnCostSum"]         = formula.cnnCostSum;
                }
                DataRow[] drDosage_Semi = dtDosage.Select("cnvcCode='" + formula.cnvcProductCode + "'");
                foreach (DataRow dr in drDosage_Semi)
                {
                    Dosage  dosage = new Dosage(dr);
                    decimal dPrice = 0;
                    if (formula.cnnPortionCount == 0)
                    {
                        dPrice = formula.cnnCostSum;
                    }
                    else
                    {
                        dPrice = Math.Round(formula.cnnCostSum / formula.cnnPortionCount, 4);
                    }
                    if (dosage.cnnPrice != dPrice)
                    {
                        dosage.cnnPrice = dPrice;
                        dosage.cnnSum   = Math.Round(dosage.cnnPrice * dosage.cnnCount, 4);
                        EntityMapping.Update(dosage, trans);
                        dr["cnnPrice"] = dPrice;//dosage.cnnPrice;
                        dr["cnnSum"]   = dosage.cnnSum;
                    }
                }
            }
        }
コード例 #24
0
        public void UpdateCost(OperLog operLog)//,BusiLog busiLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    //tbMaterial
                    DataTable dtMaterial = SingleTableQuery.ExcuteQuery("tbMaterial", trans);
                    DataTable dtDosage   = SingleTableQuery.ExcuteQuery("tbDosage", trans);
                    DataTable dtFormula  = SqlHelper.ExecuteDataTable(trans, CommandType.Text, "select cnvcProductType,cnvcProductClass,cnvcProductCode,cnnMaterialCostSum,cnnPackingCostSum,cnnCostSum,cnnPortionCount from tbFormula");
                    //DataRow[] drDosage_Raw_Pack = dtDosage.Select("cnvcProductType<>'SEMIPRODUCT'");
                    //DataRow[] drDosage_Semi = dtDosage.Select("cnvcProductType='SEMIPRODUCT'");
                    //更新原料材料价格
                    foreach (DataRow drDosage in dtDosage.Rows)
                    {
                        Dosage    dosage     = new Dosage(drDosage);
                        DataRow[] drMaterial = dtMaterial.Select("cnvcMaterialCode='" + dosage.cnvcCode + "'");
                        if (drMaterial.Length > 0)
                        {
                            Material material = new Material(drMaterial[0]);
                            if (dosage.cnnPrice != material.cnnPrice)
                            {
                                dosage.cnnPrice = material.cnnPrice;
                                dosage.cnnSum   = Math.Round(dosage.cnnPrice * dosage.cnnCount, 4);
                                EntityMapping.Update(dosage, trans);
                                drDosage["cnnPrice"] = dosage.cnnPrice;
                                drDosage["cnnSum"]   = dosage.cnnSum;
                            }
                        }
                    }
                    foreach (DataRow drFormula in dtFormula.Rows)
                    {
                        Entity.Formula formula = new AMSApp.zhenghua.Entity.Formula(drFormula);
                        if (formula.cnvcProductClass == "")
                        {
                            continue;
                        }
                        UpdatePrice(trans, formula, ref dtDosage, ref dtFormula);
                    }

                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    operLog.cndOperDate = dtSysTime;
                    EntityMapping.Create(operLog, trans);
                    //EntityMapping.Create(busiLog, trans);
                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
コード例 #25
0
        public void UpdateFormula(Entity.Formula formula, DataTable dtDosage, DataTable dtPacking, DataTable dtOperStandard, OperLog operLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    Entity.Formula fold = EntityMapping.Get(formula, trans) as Entity.Formula;
                    if (fold == null)
                    {
                        throw new Exception("未找到配方");
                    }
                    fold.SynchronizeModifyValue(formula);
                    fold.IsUse = formula.IsUse;
                    EntityMapping.Update(fold, trans);

                    DataTable dtGoods =
                        SqlHelper.ExecuteDataTable(trans, CommandType.Text,
                                                   "select * from tbGoods where vcGoodsID='" + formula.cnvcProductCode + "'");
                    if (dtGoods.Rows.Count == 1 && formula.cnvcProductType == "FINALPRODUCT")
                    {
                        Goods goods = new Goods(dtGoods.Rows[0]);

                        //goods.vcGoodsID = formula.cnvcProductCode;
                        if (goods.vcGoodsName != formula.cnvcProductName)
                        {
                            goods.vcSpell = Helper.GetChineseSpell(formula.cnvcProductName);
                        }
                        goods.vcGoodsName = formula.cnvcProductName;
                        goods.vcComments  = formula.IsUse ? "1" : "0";
                        EntityMapping.Update(goods, trans);
                    }

                    DataTable dtHavedDosage       = SqlHelper.ExecuteDataTable(trans, CommandType.Text, "select * from tbDosage where cnvcProductCode='" + formula.cnvcProductCode + "'");
                    DataTable dtHavedOperStandard =
                        SqlHelper.ExecuteDataTable(trans, CommandType.Text,
                                                   "select * from tbOperStandard where cnvcProductCode='" + formula.cnvcProductCode + "'");
                    //有的更新,没的添加
                    foreach (DataRow drDosage in dtDosage.Rows)
                    {
                        Dosage    newdosage = new Dosage(drDosage);
                        DataRow[] dr        = dtHavedDosage.Select("cnvcCode='" + newdosage.cnvcCode + "'");
                        if (dr.Length > 0)
                        {
                            Dosage dosage = new Dosage(dr[0]);
                            dosage.cnnCount = newdosage.cnnCount;
                            dosage.cnnSum   = newdosage.cnnSum;
                            EntityMapping.Update(dosage, trans);
                        }
                        else
                        {
                            EntityMapping.Create(newdosage, trans);
                        }
                    }

                    foreach (DataRow drPacking in dtPacking.Rows)
                    {
                        Dosage    newdosage = new Dosage(drPacking);
                        DataRow[] dr        = dtHavedDosage.Select("cnvcCode='" + newdosage.cnvcCode + "'");
                        if (dr.Length > 0)
                        {
                            Dosage dosage = new Dosage(dr[0]);
                            dosage.cnnCount = newdosage.cnnCount;
                            dosage.cnnSum   = newdosage.cnnSum;
                            EntityMapping.Update(dosage, trans);
                        }
                        else
                        {
                            EntityMapping.Create(newdosage, trans);
                        }
                    }
                    foreach (DataRow drDosage in dtHavedDosage.Rows)
                    {
                        Dosage dosage = new Dosage(drDosage);
                        if (dosage.cnvcProductType == "Pack")
                        {
                            DataRow[] dr = dtPacking.Select("cnvcCode='" + dosage.cnvcCode + "'");
                            if (dr.Length == 0)
                            {
                                EntityMapping.Delete(dosage, trans);
                            }
                        }
                        else
                        {
                            DataRow[] dr = dtDosage.Select("cnvcCode='" + dosage.cnvcCode + "'");
                            if (dr.Length == 0)
                            {
                                EntityMapping.Delete(dosage, trans);
                            }
                        }
                    }
                    foreach (DataRow drOperStandard in dtOperStandard.Rows)
                    {
                        OperStandard newoperStandard = new OperStandard(drOperStandard);
                        DataRow[]    dr = dtHavedOperStandard.Select("cnnSort=" + newoperStandard.cnnSort.ToString());
                        if (dr.Length > 0)
                        {
                            OperStandard operStandard = new OperStandard(dr[0]);
                            operStandard.cnvcKey      = newoperStandard.cnvcKey;
                            operStandard.cnvcStandard = newoperStandard.cnvcStandard;
                            EntityMapping.Update(operStandard, trans);
                        }
                        else
                        {
                            EntityMapping.Create(newoperStandard, trans);
                        }
                    }
                    foreach (DataRow drOperStandard in dtHavedOperStandard.Rows)
                    {
                        OperStandard operStandard = new OperStandard(drOperStandard);
                        DataRow[]    dr           = dtOperStandard.Select("cnnSort=" + operStandard.cnnSort.ToString());
                        if (dr.Length == 0)
                        {
                            EntityMapping.Delete(operStandard, trans);
                        }
                    }
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "配方编码:" + formula.cnvcProductCode;
                    EntityMapping.Create(operLog, trans);

                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
コード例 #26
0
        public void AddFormula(Entity.Formula formula, DataTable dtDosage, DataTable dtPacking, DataTable dtOperStandard, OperLog operLog)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    formula.cnvcPortionUnit = "份";
                    EntityMapping.Create(formula, trans);
                    DataTable dtGoods =
                        SqlHelper.ExecuteDataTable(trans, CommandType.Text,
                                                   "select * from tbGoods where vcGoodsID='" + formula.cnvcProductCode + "'");
                    if (dtGoods.Rows.Count == 0 && formula.cnvcProductType == "FINALPRODUCT")
                    {
                        Goods goods = new Goods();
                        goods.vcGoodsID   = formula.cnvcProductCode;
                        goods.vcGoodsName = formula.cnvcProductName;
                        goods.vcSpell     = Helper.GetChineseSpell(formula.cnvcProductName);
                        goods.iIgValue    = -1;
                        goods.vcComments  = formula.IsUse ? "1" : "0";
                        EntityMapping.Create(goods, trans);
                    }
                    foreach (DataRow drDosage in dtDosage.Rows)
                    {
                        Dosage dosage = new Dosage(drDosage);
                        EntityMapping.Create(dosage, trans);
                    }
                    foreach (DataRow drPacking in dtPacking.Rows)
                    {
                        Dosage dosage = new Dosage(drPacking);
                        EntityMapping.Create(dosage, trans);
                    }
                    foreach (DataRow drOperStandard in dtOperStandard.Rows)
                    {
                        OperStandard operStandard = new OperStandard(drOperStandard);
                        EntityMapping.Create(operStandard, trans);
                    }

                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    operLog.cndOperDate  = dtSysTime;
                    operLog.cnvcComments = "配方编码:" + formula.cnvcProductCode;
                    EntityMapping.Create(operLog, trans);

                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
コード例 #27
0
        public bool Save(int medicationSpreadID, int medicationID)
        {
            SQLiteDatabase sqlDatabase = null;

            try
            {
                Globals dbHelp = new Globals();
                dbHelp.OpenDatabase();
                sqlDatabase = dbHelp.GetSQLiteDatabase();
                if (sqlDatabase != null)
                {
                    if (sqlDatabase.IsOpen)
                    {
                        if (medicationSpreadID == -1)
                        {
                            Log.Info(TAG, "Save (insert): Saving New Medication Spread");
                            ContentValues values = new ContentValues();
                            values.Put("MedicationID", medicationID);
                            values.Put("Dosage", Dosage.ToString());
                            values.Put("FoodRelevance", (int)FoodRelevance);
                            ID = (int)sqlDatabase.Insert("MedicationSpread", null, values);
                            Log.Info(TAG, "Save (insert): Saved Spread with ID - " + ID.ToString() + ", medicationID - " + medicationID.ToString() + ", Dosage - " + Dosage.ToString() + ", Food Relevance - " + StringHelper.MedicationFoodForConstant(FoodRelevance));
                            IsNew   = false;
                            IsDirty = false;
                            if (MedicationTakeTime != null)
                            {
                                MedicationTakeTime.Save(ID);
                            }
                            if (MedicationTakeReminder != null)
                            {
                                MedicationTakeReminder.Save(ID);
                            }
                        }
                        else
                        {
                            ContentValues values = new ContentValues();
                            values.Put("MedicationID", medicationID);
                            values.Put("Dosage", Dosage.ToString());
                            values.Put("FoodRelevance", (int)FoodRelevance);
                            string   whereClause = "ID = ? AND MedicationID = ?";
                            string[] wheres      = new string[]
                            {
                                ID.ToString(),
                                     MedicationID.ToString()
                            };
                            sqlDatabase.Update("MedicationSpread", values, whereClause, wheres);
                            if (MedicationTakeTime != null)
                            {
                                MedicationTakeTime.Save(ID);
                            }
                            if (MedicationTakeReminder != null)
                            {
                                MedicationTakeReminder.Save(ID);
                            }
                            IsDirty = false;
                        }
                        sqlDatabase.Close();
                        return(true);
                    }
                }
                return(false);
            }
            catch (Exception e)
            {
                Log.Error(TAG, "Save: Exception - " + e.Message);
                if (sqlDatabase != null && sqlDatabase.IsOpen)
                {
                    sqlDatabase.Close();
                }
                return(false);
            }
        }
コード例 #28
0
        /// <summary>
        /// Deserialize JSON into a FHIR Dosage
        /// </summary>
        public static void DeserializeJsonProperty(this Dosage current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "sequence":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.SequenceElement = new Integer();
                    reader.Skip();
                }
                else
                {
                    current.SequenceElement = new Integer(reader.GetInt32());
                }
                break;

            case "_sequence":
                if (current.SequenceElement == null)
                {
                    current.SequenceElement = new Integer();
                }
                ((Hl7.Fhir.Model.Element)current.SequenceElement).DeserializeJson(ref reader, options);
                break;

            case "text":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.TextElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.TextElement = new FhirString(reader.GetString());
                }
                break;

            case "_text":
                if (current.TextElement == null)
                {
                    current.TextElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.TextElement).DeserializeJson(ref reader, options);
                break;

            case "additionalInstruction":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Dosage error reading 'additionalInstruction' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.AdditionalInstruction = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_AdditionalInstruction = new Hl7.Fhir.Model.CodeableConcept();
                    v_AdditionalInstruction.DeserializeJson(ref reader, options);
                    current.AdditionalInstruction.Add(v_AdditionalInstruction);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Dosage error reading 'additionalInstruction' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.AdditionalInstruction.Count == 0)
                {
                    current.AdditionalInstruction = null;
                }
                break;

            case "patientInstruction":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.PatientInstructionElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.PatientInstructionElement = new FhirString(reader.GetString());
                }
                break;

            case "_patientInstruction":
                if (current.PatientInstructionElement == null)
                {
                    current.PatientInstructionElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.PatientInstructionElement).DeserializeJson(ref reader, options);
                break;

            case "timing":
                current.Timing = new Hl7.Fhir.Model.Timing();
                ((Hl7.Fhir.Model.Timing)current.Timing).DeserializeJson(ref reader, options);
                break;

            case "asNeededBoolean":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.AsNeeded = new FhirBoolean();
                    reader.Skip();
                }
                else
                {
                    current.AsNeeded = new FhirBoolean(reader.GetBoolean());
                }
                break;

            case "_asNeededBoolean":
                if (current.AsNeeded == null)
                {
                    current.AsNeeded = new FhirBoolean();
                }
                ((Hl7.Fhir.Model.Element)current.AsNeeded).DeserializeJson(ref reader, options);
                break;

            case "asNeededCodeableConcept":
                current.AsNeeded = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.AsNeeded).DeserializeJson(ref reader, options);
                break;

            case "site":
                current.Site = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Site).DeserializeJson(ref reader, options);
                break;

            case "route":
                current.Route = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Route).DeserializeJson(ref reader, options);
                break;

            case "method":
                current.Method = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Method).DeserializeJson(ref reader, options);
                break;

            case "doseAndRate":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Dosage error reading 'doseAndRate' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.DoseAndRate = new List <Dosage.DoseAndRateComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Dosage.DoseAndRateComponent v_DoseAndRate = new Hl7.Fhir.Model.Dosage.DoseAndRateComponent();
                    v_DoseAndRate.DeserializeJson(ref reader, options);
                    current.DoseAndRate.Add(v_DoseAndRate);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Dosage error reading 'doseAndRate' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.DoseAndRate.Count == 0)
                {
                    current.DoseAndRate = null;
                }
                break;

            case "maxDosePerPeriod":
                current.MaxDosePerPeriod = new Hl7.Fhir.Model.Ratio();
                ((Hl7.Fhir.Model.Ratio)current.MaxDosePerPeriod).DeserializeJson(ref reader, options);
                break;

            case "maxDosePerAdministration":
                current.MaxDosePerAdministration = new Hl7.Fhir.Model.Quantity();
                ((Hl7.Fhir.Model.Quantity)current.MaxDosePerAdministration).DeserializeJson(ref reader, options);
                break;

            case "maxDosePerLifetime":
                current.MaxDosePerLifetime = new Hl7.Fhir.Model.Quantity();
                ((Hl7.Fhir.Model.Quantity)current.MaxDosePerLifetime).DeserializeJson(ref reader, options);
                break;

            // Complex: Dosage, Export: Dosage, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneType)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
コード例 #29
0
        /// <summary>
        /// Serialize a FHIR Dosage into JSON
        /// </summary>
        public static void SerializeJson(this Dosage current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            // Complex: Dosage, Export: Dosage, Base: BackboneElement (BackboneType)
            ((Hl7.Fhir.Model.BackboneType)current).SerializeJson(writer, options, false);

            if (current.SequenceElement != null)
            {
                if (current.SequenceElement.Value != null)
                {
                    writer.WriteNumber("sequence", (int)current.SequenceElement.Value);
                }
                if (current.SequenceElement.HasExtensions() || (!string.IsNullOrEmpty(current.SequenceElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_sequence", false, current.SequenceElement.Extension, current.SequenceElement.ElementId);
                }
            }

            if (current.TextElement != null)
            {
                if (!string.IsNullOrEmpty(current.TextElement.Value))
                {
                    writer.WriteString("text", current.TextElement.Value);
                }
                if (current.TextElement.HasExtensions() || (!string.IsNullOrEmpty(current.TextElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_text", false, current.TextElement.Extension, current.TextElement.ElementId);
                }
            }

            if ((current.AdditionalInstruction != null) && (current.AdditionalInstruction.Count != 0))
            {
                writer.WritePropertyName("additionalInstruction");
                writer.WriteStartArray();
                foreach (CodeableConcept val in current.AdditionalInstruction)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if (current.PatientInstructionElement != null)
            {
                if (!string.IsNullOrEmpty(current.PatientInstructionElement.Value))
                {
                    writer.WriteString("patientInstruction", current.PatientInstructionElement.Value);
                }
                if (current.PatientInstructionElement.HasExtensions() || (!string.IsNullOrEmpty(current.PatientInstructionElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_patientInstruction", false, current.PatientInstructionElement.Extension, current.PatientInstructionElement.ElementId);
                }
            }

            if (current.Timing != null)
            {
                writer.WritePropertyName("timing");
                current.Timing.SerializeJson(writer, options);
            }

            if (current.AsNeeded != null)
            {
                switch (current.AsNeeded)
                {
                case FhirBoolean v_FhirBoolean:
                    if (v_FhirBoolean != null)
                    {
                        if (v_FhirBoolean.Value != null)
                        {
                            writer.WriteBoolean("asNeededBoolean", (bool)v_FhirBoolean.Value);
                        }
                        if (v_FhirBoolean.HasExtensions() || (!string.IsNullOrEmpty(v_FhirBoolean.ElementId)))
                        {
                            JsonStreamUtilities.SerializeExtensionList(writer, options, "_asNeededBoolean", false, v_FhirBoolean.Extension, v_FhirBoolean.ElementId);
                        }
                    }
                    break;

                case CodeableConcept v_CodeableConcept:
                    writer.WritePropertyName("asNeededCodeableConcept");
                    v_CodeableConcept.SerializeJson(writer, options);
                    break;
                }
            }
            if (current.Site != null)
            {
                writer.WritePropertyName("site");
                current.Site.SerializeJson(writer, options);
            }

            if (current.Route != null)
            {
                writer.WritePropertyName("route");
                current.Route.SerializeJson(writer, options);
            }

            if (current.Method != null)
            {
                writer.WritePropertyName("method");
                current.Method.SerializeJson(writer, options);
            }

            if ((current.DoseAndRate != null) && (current.DoseAndRate.Count != 0))
            {
                writer.WritePropertyName("doseAndRate");
                writer.WriteStartArray();
                foreach (Dosage.DoseAndRateComponent val in current.DoseAndRate)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if (current.MaxDosePerPeriod != null)
            {
                writer.WritePropertyName("maxDosePerPeriod");
                current.MaxDosePerPeriod.SerializeJson(writer, options);
            }

            if (current.MaxDosePerAdministration != null)
            {
                writer.WritePropertyName("maxDosePerAdministration");
                current.MaxDosePerAdministration.SerializeJson(writer, options);
            }

            if (current.MaxDosePerLifetime != null)
            {
                writer.WritePropertyName("maxDosePerLifetime");
                current.MaxDosePerLifetime.SerializeJson(writer, options);
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
コード例 #30
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (nameTxt.Text == "")
            {
                nameTxt.BackColor = Color.Red;
                return;
            }

            if (saleTxt.Text == "")
            {
                saleTxt.BackColor = Color.Red;
                return;
            }
            if (qtyTxt.Text == "")
            {
                qtyTxt.BackColor = Color.Red;
                return;
            }
            if (purchaseTxt.Text == "")
            {
                purchaseTxt.BackColor = Color.Red;
                return;
            }
            if (!String.IsNullOrEmpty(ItemID))
            {
                if (Global._items.Where(t => t.Id.Contains(ItemID)).ToList().Count() < 1)
                {
                    MemoryStream stream    = ImageToStream(imgCapture.Image, System.Drawing.Imaging.ImageFormat.Jpeg);
                    string       fullimage = ImageToBase64(stream);
                    _item = new Item(ItemID, nameTxt.Text, codeTxt.Text, descriptionTxt.Text, mannufacturerTxt.Text, ctryTxt.Text, batchTxt.Text, purchaseTxt.Text, saleTxt.Text, compositionTxt.Text, Convert.ToDateTime(expireDate.Text).ToString("dd-MM-yyyy"), categoryCbx.Text, packageCbx.Text, barcodeTxt.Text, fullimage, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), departmentCbx.Text, Convert.ToDateTime(manufactureDate.Text).ToString("dd-MM-yyyy"), genericTxt.Text, strengthTxt.Text, Helper.orgID);

                    if (DBConnect.Insert(_item) != "")
                    {
                        if (Global._stocks.Where(t => t.ItemID.Contains(ItemID)).Count() > 0)
                        {
                            double value = 0;
                            string qty   = Global._stocks.First(t => t.ItemID.Contains(ItemID)).Quantity;
                            value = Convert.ToDouble(qty) + Convert.ToDouble(qtyTxt.Text);

                            string itemID = Global._stocks.First(t => t.ItemID.Contains(ItemID)).ItemID;
                            string SQL    = "UPDATE stock SET qty = '" + value + "', WHERE itemID = '" + itemID + "'";
                            DBConnect.Execute(SQL);
                        }
                        else
                        {
                            double totalQty = Convert.ToDouble(purchaseTxt.Text) * Convert.ToDouble(qtyTxt.Text);
                            string id       = Guid.NewGuid().ToString();
                            _stock = new Stock(id, ItemID, qtyTxt.Text, descriptionTxt.Text, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), saleTxt.Text, purchaseTxt.Text, purchaseTxt.Text, purchaseTxt.Text, totalQty.ToString(), Helper.orgID);
                            DBConnect.Insert(_stock);
                            Global._stocks.Add(_stock);
                        }

                        if (Global._transactors.Where(t => t.Id.Contains(SupplierID)).Count() < 0)
                        {
                            MemoryStream streams    = ImageToStream(pictureBox1.Image, System.Drawing.Imaging.ImageFormat.Jpeg);
                            string       fullimages = ImageToBase64(streams);
                            string       id         = Guid.NewGuid().ToString();
                            _transactor = new Transactor(id, supplierNoTxt.Text, contactTxt.Text, supplierTxt.Text, emailTxt.Text, addressTxt.Text, fullimages, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), "Supplier", Helper.orgID);
                            DBConnect.Insert(_transactor);
                            SupplierID = id;
                        }


                        if (!String.IsNullOrEmpty(noTxt.Text) && !String.IsNullOrEmpty(SupplierID))
                        {
                            string id = Guid.NewGuid().ToString();
                            _bill = new Bill(id, noTxt.Text, SupplierID, remarksTxt.Text, purchaseDate.Text, purchaseTxt.Text, balanceTxt.Text, methodCbx.Text, paidCbx.Text, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), departmentCbx.Text, Convert.ToDateTime(dueDate.Text).ToString("dd-MM-yyyy"), chqTxt.Text, bankTxt.Text, "Purchase", "", "", Helper.orgID);
                            DBConnect.Insert(_bill);
                            string id2 = Guid.NewGuid().ToString();
                            _transaction = new Transaction(id2, noTxt.Text, ItemID, qtyTxt.Text, Convert.ToDateTime(purchaseDate.Text).ToString("dd-MM-yyyy"), purchaseTxt.Text, "Purchase", DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), Helper.orgID);
                            DBConnect.Insert(_transaction);
                        }

                        if (Global._dosages.Where(t => t.ItemID.Contains(ItemID)).Count() < 0)
                        {
                            string id = Guid.NewGuid().ToString();
                            _dosage = new Dosage(id, ItemID, doseTxt.Text, prescriptionTxt.Text, dosageQtyTxt.Text, minTxt.Text, maxTxt.Text, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), Helper.orgID);
                            DBConnect.Insert(_dosage);
                        }

                        Global._items.Add(_item);
                        MessageBox.Show("Information Saved");
                        this.DialogResult = DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("No valid Item identification ");
                    }
                }
            }
        }
コード例 #31
0
ファイル: DosageService.cs プロジェクト: sam-zhou/lynex.ocr
 public Notification CreateNotification(Dosage dosage, User user, NotificationType type)
 {
     return WCCMainRepository.CreateNotification(dosage, user, type);
 }
コード例 #32
0
ファイル: DosageService.cs プロジェクト: sam-zhou/lynex.ocr
 public Dosage AcknowledgeDosage(Dosage dosage, User user)
 {
     return WCCMainRepository.AcknowledgeDosage(dosage, user);
 }