コード例 #1
0
        string GetTextToothPrepare(List <GroupOfTooth> groups)
        {
            string            text        = "";
            List <text_block> text_blocks = new List <text_block>();

            foreach (GroupOfTooth group in groups)
            {
                text_block tb = new text_block();
                if (group.ToothsInGroup.Count > 1)
                {
                    tb.analogObjects = group.GetToothsText(true);
                }
                tb.textOfBlock = group.ToothsInGroup[0].Treat.prepare
            }
            return(text);
        }
コード例 #2
0
        string GetTextConditionsTreatment(List <GroupOfTooth> groups)
        {
            string text = "";


            List <text_block> text_blocks = new List <text_block>();

            foreach (GroupOfTooth group in groups)
            {
                text_block tb = new text_block();
                if (groups.Count > 1)
                {
                    foreach (Tooth tooth in group.ToothsInGroup)
                    {
                        tb.analogObjectsList.Add(tooth);
                    }
                }
            }

            return(text);
        }
コード例 #3
0
ファイル: Rvg.cs プロジェクト: Vitremer/ClisheRepository
        string GetTextFromTooths(List <GroupOfTooth> groups)
        {
            string            text        = "";
            List <text_block> text_blocks = new List <text_block>();

            foreach (GroupOfTooth group in groups)
            {
                text_block curBlock = new text_block();

                curBlock.analogObjects = group.GetToothsText(true);
                curBlock.analogObjectsList.AddRange(group.ToothsInGroup.ToArray());

                curBlock.allText = GetFacesObjective(group.ToothsInGroup[0]) + GetToothObjective(group.ToothsInGroup[0]);
                text_blocks.Add(curBlock);
            }

            foreach (text_block tb in text_blocks)
            {
                text += tb.analogObjects + " - " + tb.allText;
            }

            return(text);
        }
コード例 #4
0
        string GetTextFromTooths(List <GroupOfTooth> groupsOfPretreat, List <GroupOfTooth> groupsOfDiag)
        {
            string text           = "";
            string textPretreat   = "";
            string textHealedEasy = "";
            string textHealedHard = "";
            string textNotHealed  = "";

            foreach (GroupOfTooth group in groupsOfPretreat) //сборка блоков текста лечен или не лечен
            {
                text_block curBlock = new text_block();

                foreach (Tooth tooth in group.ToothsInGroup)
                {
                    curBlock.analogObjects += tooth.number + ", ";
                }
                curBlock.analogObjects  = curBlock.analogObjects.Remove(curBlock.analogObjects.Length - 2);
                curBlock.analogObjects += " зуб";
                string key = "anamnes_pretreat_" + group.pretreat;
                curBlock.textOfBlock = KlisheParams.GetBlock(key);
                if (group.ToothsInGroup.Count > 1)
                {
                    curBlock.multi          = true;
                    curBlock.analogObjects += "ы";
                    curBlock.textOfBlock    = curBlock.textOfBlock.Replace("лечен", "лечены");
                }
                curBlock.allText = curBlock.analogObjects + curBlock.textOfBlock;
                switch (group.pretreat)
                {
                case 0: textNotHealed = curBlock.allText;
                    break;

                case 1: textHealedEasy = curBlock.allText;
                    break;

                case 2: textHealedHard = curBlock.allText;
                    break;
                }
                textPretreat = textNotHealed + textHealedEasy + textHealedHard;
            }//end of foreach state


            //List<byte> tooths = new List<byte>();



            string            textTrouble   = "";
            string            textOfGroup   = "";
            string            toothsNumbers = "";
            List <text_block> text_blocks   = new List <text_block>();

            foreach (GroupOfTooth group in groupsOfDiag)//создание блоков текста сколько и как беспокоит
            {
                textOfGroup = KlisheParams.GetBlock("anamnes_trouble_" + group.MainDs.identityString);
                if (textOfGroup == "ERROR")
                {
                    textOfGroup = KlisheParams.GetBlock("anamnes_trouble_" + group.MainDs.layer);
                }


                toothsNumbers = group.GetToothsText(false);
                bool alreadyHaveOne = false;
                foreach (text_block block in text_blocks)
                {
                    if (block.textOfBlock == textOfGroup)
                    {
                        block.analogObjects = toothsNumbers + ", " + block.analogObjects;
                        block.multi         = true;
                        alreadyHaveOne      = true;
                        break;
                    }
                }

                if (!alreadyHaveOne)
                {
                    text_block newBlock = new text_block();
                    newBlock.textOfBlock   = textOfGroup;
                    newBlock.analogObjects = toothsNumbers;
                    try
                    {
                        newBlock.changerText = KlisheParams.GetBlock("anamnes_trouble_multi_" + group.MainDs.identityString);
                    }
                    catch
                    {
                    }
                    try
                    {
                        if (newBlock.changerText == " _ " || newBlock.changerText == "")
                        {
                            newBlock.changerText = KlisheParams.GetBlock("anamnes_trouble_multi_" + group.MainDs.layer);
                        }
                    }
                    catch
                    {
                    }
                    if (group.ToothsInGroup.Count > 1)
                    {
                        newBlock.multi = true;
                    }


                    text_blocks.Add(newBlock);
                }
            }//end of foreach for groups


            foreach (text_block block in text_blocks)// теперь все блоки собираем вместе
            {
                if (text_blocks.Count > 1)
                {
                    block.allText += block.analogObjects;

                    if (block.multi)
                    {
                        block.allText += " зубы - ";
                    }
                    else
                    {
                        block.allText += " зуб - ";
                    }
                }
                block.allText += block.textOfBlock;
                if (block.multi)
                {
                    if (!ClisheTextManipulations.MultiplyText(block.allText, block.changerText, out block.allText))
                    {
                        block.allText = block.allText.Replace("оит", "оят");
                    }
                }
                textTrouble += block.allText;
                if (text_blocks.IndexOf(block) + 1 == text_blocks.Count)
                {
                    textTrouble += ". ";
                }
                else
                {
                    textTrouble += ", ";
                }
            }//end of foreach for blocks

            text = textPretreat + textTrouble;
            return(text);
        } //end of GetText method
コード例 #5
0
        string GetTextFromGroups(List <GroupOfTooth> groups)
        {
            string            text          = "";
            string            textOfGroup   = "";
            string            toothsNumbers = "";
            List <text_block> text_blocks   = new List <text_block>();

            foreach (GroupOfTooth group in groups)     //создание блоков текста сколько и как беспокоит
            {
                textOfGroup = KlisheParams.GetBlock("jaloby_" + group.MainCondition.Name + "_" + group.MainCondition.Depth.ToString());
                if (textOfGroup == "ERROR")
                {
                    textOfGroup = KlisheParams.GetBlock("jaloby_" + group.MainCondition.Name);
                }

                toothsNumbers = group.GetToothsText(false);
                bool alreadyHaveOne = false;
                foreach (text_block block in text_blocks)
                {
                    if (block.textOfBlock == textOfGroup)
                    {
                        block.analogObjects = toothsNumbers + ", " + block.analogObjects;
                        block.multi         = true;
                        alreadyHaveOne      = true;
                        break;
                    }
                }

                if (!alreadyHaveOne)
                {
                    text_block newBlock = new text_block();
                    newBlock.textOfBlock   = textOfGroup;
                    newBlock.analogObjects = toothsNumbers;

                    if (group.ToothsInGroup.Count > 1)
                    {
                        newBlock.multi = true;
                    }

                    text_blocks.Add(newBlock);
                }
            }//end of foreach for groups

            foreach (text_block tblock in text_blocks)     // теперь все блоки собираем вместе
            {
                tblock.allText += tblock.textOfBlock;


                if (tblock.multi)
                {
                    tblock.allText += KlisheParams.GetBlock("jaloby_zubMany");
                }
                else
                {
                    tblock.allText += KlisheParams.GetBlock("jaloby_zubOne");
                }
                tblock.allText += tblock.analogObjects + ".";



                text += tblock.allText;
                if (text_blocks.IndexOf(tblock) + 1 != text_blocks.Count)
                {
                    text += "\n";
                }
            }     //end of foreach for blocks

            return(text);



            // string text = "Жалобы: ";
            // string textOfGroup = "";
            // string numbersOfTeeth = "";


            //int first = 0;
            //List<int> analogIndicies = new List<int>();
            //     foreach (GroupOfTooth group in groups)
            // {



            //                         //if (textOfGroup == "")
            //                         //{
            //                         //                textOfGroup = blocks.GetBlock("jaloby_" + group.MainDs.ToString());
            //                         //                numbersOfTeeth = group.GetToothsText(false);
            //                         //                if (group.ToothsInGroup.Count == 1)
            //                         //                {
            //                         //                    text += textOfGroup + blocks.GetBlock("jaloby_zubOne") + numbersOfTeeth + ". \n";
            //                         //                }
            //                         //                else
            //                         //                {
            //                         //                    text += textOfGroup + blocks.GetBlock("jaloby_zubMany") + numbersOfTeeth + ". \n";


            //                         //                }
            //                         //}

            //                         //else
            //     if (!analogIndicies.Contains(first))
            //     {
            //         textOfGroup = blocks.GetBlock("jaloby_" + group.MainDs.ToString());
            //         numbersOfTeeth = group.GetToothsText(false);
            //         if (group.ToothsInGroup.Count == 1)
            //         {
            //             text += textOfGroup + blocks.GetBlock("jaloby_zubOne") + numbersOfTeeth + ". \n";
            //         }
            //         else
            //         {
            //             text += textOfGroup + blocks.GetBlock("jaloby_zubMany") + numbersOfTeeth + ". \n";


            //         }
            //     }
            //      if (textOfGroup != "null"&&!analogIndicies.Contains(first))
            //         {
            //             int second = 0;

            //             foreach (GroupOfTooth insideGroup in groups)
            //             {
            //                 if (second > first && textOfGroup == blocks.GetBlock("jaloby_" + insideGroup.MainDs.ToString()))
            //                 {

            //                     text = text.Replace("зуба " + numbersOfTeeth, "зубов " + insideGroup.GetToothsText(false) + ", " + numbersOfTeeth);
            //                     text = text.Replace("зубов " + numbersOfTeeth, "зубов " + insideGroup.GetToothsText(false) + ", " + numbersOfTeeth);
            //                     numbersOfTeeth = insideGroup.GetToothsText(false);
            //                     analogIndicies.Add(second);

            //                 }
            //                 second++;

            //             }
            //             textOfGroup = "null";
            //         }



            //          first++;
            //     }


            // return text;
        }
コード例 #6
0
ファイル: Rvg.cs プロジェクト: Vitremer/ClisheRepository
        string GetFacesObjective(Tooth tooth)
        {
            string            text        = "";
            List <text_block> text_blocks = new List <text_block>();
            bool haveOne = false;



            foreach (Face face in tooth.GetAllFaces())
            {
                foreach (Condition cond in face.GetConditionsOfFace())
                {
                    foreach (text_block tb in  text_blocks)
                    {
                        if (((Condition)tb.comparer).Name == cond.Name)
                        {
                            haveOne = true;
                            bool alreadyConnected = false;
                            foreach (Face fc in tb.analogObjectsList)//проверяем нет ли среди поверхностей с таким же диагнозом, таких с которым эта поверхность уже соединена
                            {
                                if (face.GetConnections().Contains(fc))
                                {
                                    if (((Condition)tb.comparer).Depth < cond.Depth)
                                    {
                                        tb.comparer = cond;
                                    }
                                    alreadyConnected = true;
                                    break;
                                }
                            }
                            if (!alreadyConnected)//если присоединенных поверхностей нет тогда она будет описываться отдельно.
                            {
                                tb.analogObjectsList.Add(face);
                                tb.multi = true;
                            }
                            break;
                        }
                    }

                    if (!haveOne)
                    {
                        text_block tb = new text_block();
                        tb.analogObjectsList.Add(face);
                        tb.layer       = cond.layerForDiscription;
                        tb.comparer    = cond;
                        tb.textOfBlock = cond.rvgDescription;
                        tb.changerText = cond.multiDiscription;
                        text_blocks.Add(tb);
                    }
                    haveOne = false;
                }
            }

            text_blocks = text_blocks.OrderBy(t => t.layer).ToList();//упорядочиваем список блоков текста по слоям (первые слои наиболее важные - кариес и тому подобное, потом уже идет описание остальных слоев)

            foreach (text_block tb in text_blocks)
            {
                bool edge     = false;
                bool onlyEdge = false;

                foreach (Face fc in tb.analogObjectsList)
                {
                    if (fc.faceName != Face.faceSide.edge)                                                        //если это не режущий край тогда
                    {
                        tb.allText += "на " + KlisheParams.GetBlock("face_name_" + fc.faceName.ToString()) + "о"; //записываем в текст имя поверхности


                        if (fc.GetConnections().Length > 0)//если есть присоединенные поверхности тогда добавляем их
                        {
                            foreach (Face connectedFace in fc.GetConnections())
                            {
                                if (connectedFace.faceName != Face.faceSide.edge)
                                {
                                    tb.allText += "-" + KlisheParams.GetBlock("face_name_" + connectedFace.faceName.ToString()) + "о";
                                }
                                else
                                {
                                    edge = true;
                                }
                            }
                        }
                        tb.allText += "й и ";
                    }
                    //
                    //            if (tb.allText == "") tb.allText += "на " + KlisheParams.GetBlock("face_name_" + fc.faceName.ToString()) + "о";
                    //            else tb.allText += "-" + KlisheParams.GetBlock("face_name_" + fc.faceName.ToString()) + "о";
                    //        }
                    else
                    {
                        if (tb.allText == "" && tb.analogObjectsList.Count == 1)
                        {
                            onlyEdge    = true;
                            tb.allText += "по " + KlisheParams.GetBlock("face_name_" + fc.faceName.ToString() + "_onthe") + " ";
                        }
                        else
                        {
                            edge = true;
                        }
                    }
                }
                if (!onlyEdge)
                {
                    tb.allText = tb.allText.Remove(tb.allText.Length - 2) + " поверхности ";
                }
                if (edge)
                {
                    tb.allText += " с выходом на режущий край ";
                }
                if (tb.multi)
                {
                    tb.allText += tb.MultiplyText();
                }
                else
                {
                    tb.allText += tb.textOfBlock;
                }

                tb.ToUpperFirstChar(text);

                text += tb.allText;
            }//end of foreach text_block



            return(text);
        }