Browse Source

修改配置项

denny 8 months ago
parent
commit
70a9e4e389
2 changed files with 53 additions and 25 deletions
  1. 1 0
      src/Service/PatientInfoDBService.cs
  2. 52 25
      src/Service/RemedicalDBService.cs

+ 1 - 0
src/Service/PatientInfoDBService.cs

@@ -312,6 +312,7 @@ namespace WingMongoDBModule.Service
                     else if (kv.Key == "DevicePatientID")
                     {
                         keywordOrFilter.AppendArrayEq("BaseData.DevicePatientIDs", kv.Value);
+                        continue;
                     }
                     sumItemFilter.AppendEq((item => item.Key, kv.Key));
                     sumItemFilter.AppendRegex(item => item.Value, value, true, false);

+ 52 - 25
src/Service/RemedicalDBService.cs

@@ -1,38 +1,38 @@
+using System;
+using System;
 using System.Collections.Generic;
-using System.Threading.Tasks;
-using WingServerCommon.Service;
-using WingInterfaceLibrary.Result.Record;
-using WingInterfaceLibrary.Interface.DBInterface;
-using WingInterfaceLibrary.DTO.Record;
-using WingServerCommon.Mapper;
 using System.Linq;
+using System.Threading.Tasks;
 using JsonRpcLite.Services;
-using System;
-using WingMongoDBModule.DO;
+using MongoDB.Driver;
 using WingInterfaceLibrary.DB.Request;
-using WingInterfaceLibrary.Enum;
-using WingInterfaceLibrary.DTO.Measure;
 using WingInterfaceLibrary.DTO.Comment;
-using WingMongoDBModule.Mongodb.Driver;
-using WingMongoDBModule.Entity;
-using WingInterfaceLibrary.Result;
-using WingMongoDBModule.Common;
-using WingInterfaceLibrary.Request.DBRequest;
-using MongoDB.Driver;
-using WingServerCommon.Utilities;
-using WingInterfaceLibrary.DTO.Patient;
 using WingInterfaceLibrary.DTO.Common;
-using WingInterfaceLibrary.Request;
+using WingInterfaceLibrary.DTO.DataCenter;
+using WingInterfaceLibrary.DTO.Measure;
 using WingInterfaceLibrary.DTO.Organization;
+using WingInterfaceLibrary.DTO.Patient;
+using WingInterfaceLibrary.DTO.Record;
+using WingInterfaceLibrary.Enum;
+using WingInterfaceLibrary.Interface.DBInterface;
+using WingInterfaceLibrary.Request;
+using WingInterfaceLibrary.Request.Comment;
 using WingInterfaceLibrary.Request.DBCopy;
-using WingInterfaceLibrary.DTO.DataCenter;
-using System;
-using WingServerCommon.Log;
+using WingInterfaceLibrary.Request.DBRequest;
 using WingInterfaceLibrary.Request.Device;
 using WingInterfaceLibrary.Request.Examine;
 using WingInterfaceLibrary.Request.Record;
+using WingInterfaceLibrary.Result;
+using WingInterfaceLibrary.Result.Record;
+using WingMongoDBModule.Common;
+using WingMongoDBModule.DO;
+using WingMongoDBModule.Entity;
+using WingMongoDBModule.Mongodb.Driver;
 using WingMongoDBModule.Request;
-using WingInterfaceLibrary.Request.Comment;
+using WingServerCommon.Log;
+using WingServerCommon.Mapper;
+using WingServerCommon.Service;
+using WingServerCommon.Utilities;
 
 namespace WingMongoDBModule.Service
 {
@@ -431,8 +431,35 @@ namespace WingMongoDBModule.Service
                                             var existFolder = existGroup.Folders.FirstOrDefault(v => v.Name == folder.Name);
                                             if (existFolder != null)
                                             {
-                                                existGroup.Folders.Remove(existFolder);
-                                                existGroup.Folders.Add(folder.MappingTo<UserDefinedMeasureFolderDO>());
+                                                // 找到这个模式。在判断下面的测量项
+                                                if (!string.IsNullOrEmpty(existFolder.ItemMetaJson))
+                                                {
+                                                    var existItemMetas = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ItemMetaDTO>>(existFolder.ItemMetaJson);
+                                                    if (existItemMetas.Count > 0)
+                                                    {
+                                                        foreach (var itemMetaInput in folder.ItemMetas)
+                                                        {
+                                                            var existItemMeta = existItemMetas.Find(c => c.Name == itemMetaInput.Name);
+                                                            if (!string.IsNullOrEmpty(existItemMeta?.Name))
+                                                            {
+                                                                //存在,移除。在添加
+                                                                existItemMetas.Remove(existItemMeta);
+                                                            }
+                                                            existItemMetas.Add(itemMetaInput);
+                                                        }
+                                                        existFolder.ItemMetaJson = Newtonsoft.Json.JsonConvert.SerializeObject(existItemMetas);
+                                                    }
+                                                    else
+                                                    {
+                                                        existGroup.Folders.Remove(existFolder);
+                                                        existGroup.Folders.Add(folder.MappingTo<UserDefinedMeasureFolderDO>());
+                                                    }
+                                                }
+                                                else
+                                                {
+                                                    existGroup.Folders.Remove(existFolder);
+                                                    existGroup.Folders.Add(folder.MappingTo<UserDefinedMeasureFolderDO>());
+                                                }
                                             }
                                             else
                                             {