目的:

利用dcmtk工具查询PACS,找到同一患者两次以上的检查的数据

步骤:

1 find 需要的数据,输出到文本

findscu.exe 10.9.9.9 104 -aec PACS_AE -aet OUR_AE -k 0008,0052=PATIENT -P +sr -k PatientID -k StudyInstanceUID -k NumberOfPatientRelatedStudies > find.txt

I: ---------------------------
I: Find Response: 1 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [A0180 ]                                 #   6, 1 PatientID
I: (0010,0030) DA [19370101]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [176 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 2 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [P00812469 ]                             #  10, 1 PatientID
I: (0010,0030) DA [19711002]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 3 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [P00812449 ]                             #  10, 1 PatientID
I: (0010,0030) DA [20120610]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 4 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [P00746565 ]                             #  10, 1 PatientID
I: (0010,0030) DA [19771106]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [2 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [2 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [3 ]                                     #   2, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 5 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [A0093 ]                                 #   6, 1 PatientID
I: (0010,0030) DA [19470101]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [176 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 6 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [CT0581499 ]                             #  10, 1 PatientID
I: (0010,0030) DA [19460118]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [5 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [17]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [823 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 7 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [P00812424 ]                             #  10, 1 PatientID
I: (0010,0030) DA [19461221]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [3 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [3 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [4 ]                                     #   2, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 8 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [002_S_2073]                             #  10, 1 PatientID
I: (0010,0030) DA [19470423]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [170 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 9 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [A0181 ]                                 #   6, 1 PatientID
I: (0010,0030) DA [19470101]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [176 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 10 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [006_S_0322]                             #  10, 1 PatientID
I: (0010,0030) DA [19401105]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [166 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 11 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [P00787721 ]                             #  10, 1 PatientID
I: (0010,0030) DA [20120701]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 12 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [010_S_4135]                             #  10, 1 PatientID
I: (0010,0030) DA [19541205]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [170 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 13 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [A0185 ]                                 #   6, 1 PatientID
I: (0010,0030) DA [19360101]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [176 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 14 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [041_S_4874]                             #  10, 1 PatientID
I: (0010,0030) DA [19541113]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [176 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 15 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [012_S_4128]                             #  10, 1 PatientID
I: (0010,0030) DA [19330909]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 16 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [024_S_1063]                             #  10, 1 PatientID
I: (0010,0030) DA [19280616]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [146 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 17 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [033_S_0741]                             #  10, 1 PatientID
I: (0010,0030) DA [19260409]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [166 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 18 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [009_S_4741]                             #  10, 1 PatientID
I: (0010,0030) DA [19500922]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [176 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 19 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [11094760]                               #   8, 1 PatientID
I: (0010,0030) DA [19720913]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [3 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [271 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 20 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [P00811319 ]                             #  10, 1 PatientID
I: (0010,0030) DA [19450307]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [2 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [2 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [4 ]                                     #   2, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 21 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [A0110 ]                                 #   6, 1 PatientID
I: (0010,0030) DA [19430101]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [176 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 22 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [A0111 ]                                 #   6, 1 PatientID
I: (0010,0030) DA [19450101]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [176 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 23 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [013_S_2389]                             #  10, 1 PatientID
I: (0010,0030) DA [19530819]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [170 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 24 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [037_S_4381]                             #  10, 1 PatientID
I: (0010,0030) DA [19570103]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [176 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 25 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [067_S_0176]                             #  10, 1 PatientID
I: (0010,0030) DA [19310605]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [160 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 26 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [031_S_4024]                             #  10, 1 PatientID
I: (0010,0030) DA [19550501]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [170 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 27 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [031_S_2233]                             #  10, 1 PatientID
I: (0010,0030) DA [19550529]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [170 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 28 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [003_S_1122]                             #  10, 1 PatientID
I: (0010,0030) DA [19300324]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [F ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [160 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:
I: ---------------------------
I: Find Response: 29 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [PATIENT ]                               #   8, 1 QueryRetrieveLevel
I: (0008,0080) LO (no value available)                     #   0, 0 InstitutionName
I: (0010,0020) LO [PID-20190323-112443-0001]               #  24, 1 PatientID
I: (0010,0030) DA [19540101]                               #   8, 1 PatientBirthDate
I: (0010,0040) CS [M ]                                     #   2, 1 PatientSex
I: (0020,1200) IS [1 ]                                     #   2, 1 NumberOfPatientRelatedStudies
I: (0020,1202) IS [9 ]                                     #   2, 1 NumberOfPatientRelatedSeries
I: (0020,1204) IS [441 ]                                   #   4, 1 NumberOfPatientRelatedInstances
I:

Q:为啥不用NumberOfPatientRelatedStudies直接过滤

A:部分PACS不支持。

2 找到多次检查的数据和行号,输出到文本

type find.txt | findstr /N /R /C:"\<[2-9] \]                                     #   2, 1 NumberOfPatientRelatedStudies" > num.txt

3 合并行号

call get_numbers.bat

@echo off
setlocal EnableDelayedExpansionecho 1 > n.txt
set out
call :_DATE
echo %out%
echo 1!out! > n.txt
echo done
goto :EOF:_DATE
FOR /F "tokens=1" %%A in (num.txt) do ( SET result=%%A & echo !result!SET ver=!result:~0,-4!SET /a new=!ver!-3SET out=!out!:!new!:!ver!
)
GOTO :eof

4 找到所有目标数据的PatientID

call print_file_string.bat -n . find.txt 1 /R /C:".*"

@echo offrem Description:
rem   Script for string lines extraction from a text/binary file by findstr
rem   utility pattern and/or line number.rem Command arguments:
rem %1 - Optional flags:
rem      -n - prints line number prefix "<N>:" for each found string from file.
rem           By default, the line number prefix does not print.
rem      -f1 - filter by line numbers for strings after %4..%N filter pattern.
rem           By default, filters by line numbers from the file.
rem      -pe - treats input file as a Portable Executable file
rem           (the strings.exe must exist).
rem           By default, the file treated as a text file.
rem %1 - Path to a directory with a file to extract.
rem %2 - Relative path to a text/binary file with strings.
rem %3 - Set of line numbers separated by : character to print strings of.
rem      These line numbers by default are line numbers of strings from the
rem      file, not from filtered output. If you want to point line numbers
rem      after %4..%N filter pattern, then you must use -f1 flag.
rem      If empty, then treated as "all strings".
rem %4..%N - Arguments for findstr command line in first filter.
rem      If empty, then treated as /R /C:".*", which means "any string".rem CAUTION:
rem   DO NOT use /N flag in %4..%N arguments, instead use script -n flag to
rem   print strings w/ line number prefix.rem Examples:
rem 1. call print_file_string.bat -n . example.txt 1:20:10:30 /R /C:".*"
rem Prints 1, 10, 20, 30 lines of the example.txt file sorted by line number
rem and prints them w/ line number prefix:
rem
rem 2. call print_file_string.bat . example.txt 100 /R /C:".*"
rem Prints 100'th string of example.txt file and prints it w/o line number
rem prefix.
rem
rem 3. call print_file_string.bat -pe c:\Application res.dll "" /B /C:"VERSION="
rem Prints all strings from the c:\Application\res.dll binary file, where
rem strings beginning by the "VERSION=" string and prints them w/o line number
rem prefix.
rem
rem 4. call print_file_string.bat -pe c:\Application res.dll 1:20:10:30 /R /C:".*"
rem Prints 1, 10, 20, 30 lines of string resources from the
rem c:\Application\res.dll binary file, where strings beginning by the
rem "VERSION=" string and prints them w/o line number prefix.setlocal EnableDelayedExpansionset "?~dp0=%~dp0"
set "?~nx0=%~nx0"rem script flags
set FLAG_PRINT_LINE_NUMBER_PREFIX=0
set FLAG_F1_LINE_NUMBER_FILTER=0
set FLAG_FILE_FORMAT_PE=0rem flags
set "FLAGS=":FLAGS_LOOPrem flags always at first
set "FLAG=%~1"if not "%FLAG%" == "" ^
if not "%FLAG:~0,1%" == "-" set "FLAG="if not "%FLAG%" == "" (if "%FLAG%" == "-n" set FLAG_PRINT_LINE_NUMBER_PREFIX=1if "%FLAG%" == "-f1" set FLAG_F1_LINE_NUMBER_FILTER=1if "%FLAG%" == "-pe" set FLAG_FILE_FORMAT_PE=1shiftrem read until no flagsgoto FLAGS_LOOP
)set "DIR_PATH=%~dpf1"
set "FILE_PATH=%~2"set "FILE_PATH_PREFIX="
if not "%DIR_PATH%" == "" set "FILE_PATH_PREFIX=%DIR_PATH%\"if not "%FILE_PATH_PREFIX%" == "" ^
if not exist "%FILE_PATH_PREFIX%" (echo.%?~nx0%: error: Directory path does not exist: "%FILE_PATH_PREFIX%"exit /b 1
) >&2if "%FILE_PATH%" == "" (echo.%?~nx0%: error: File path does not set.exit /b 2
) >&2if not exist "%FILE_PATH_PREFIX%%FILE_PATH%" (echo.%?~nx0%: error: File path does not exist: "%FILE_PATH_PREFIX%%FILE_PATH%"exit /b 3
) >&2set "LINE_NUMBERS=%~3"set "FINDSTR_LINES_FILTER_CMD_LINE="
if "%LINE_NUMBERS%" == "" goto FINDSTR_LINES_FILTER_ENDset LINE_NUMBER_INDEX=1
:FINDSTR_LINES_FILTER_LOOP
set "LINE_NUMBER="
for /F "tokens=%LINE_NUMBER_INDEX% delims=:" %%i in ("%LINE_NUMBERS%") do set "LINE_NUMBER=%%i"rem read LINE numbers from file
FOR /F "tokens=1" %%A in (n.txt) do ( SET LINE_NUMBERS=%%A
)if "%LINE_NUMBER%" == "" goto FINDSTR_LINES_FILTER_ENDset FINDSTR_LINES_FILTER_CMD_LINE=!FINDSTR_LINES_FILTER_CMD_LINE! /C:"!LINE_NUMBER!:"
set /A LINE_NUMBER_INDEX+=1
goto FINDSTR_LINES_FILTER_LOOP:FINDSTR_LINES_FILTER_ENDshift
shift
shiftset "FINDSTR_FIRST_FILTER_CMD_LINE=":FINDSTR_FIRST_FILTER_LOOP
set ARG=%1if not "!ARG!" == "" (set FINDSTR_FIRST_FILTER_CMD_LINE=!FINDSTR_FIRST_FILTER_CMD_LINE! !ARG!shiftgoto FINDSTR_FIRST_FILTER_LOOP
)if "!FINDSTR_FIRST_FILTER_CMD_LINE!" == "" set FINDSTR_FIRST_FILTER_CMD_LINE=/R /C:".*"set OUTPUT_HAS_NUMBER_PREFIX=0rem in case if /N at the end
set "FINDSTR_FIRST_FILTER_CMD_LINE=!FINDSTR_FIRST_FILTER_CMD_LINE! "rem 1. add /N parameter to first filter if must print line prefixes and -f1 flag is not set.
rem 2. flags prefixed output if must print line prefixes.
if %FLAG_PRINT_LINE_NUMBER_PREFIX% NEQ 0 (if %FLAG_F1_LINE_NUMBER_FILTER% EQU 0 (if "!FINDSTR_FIRST_FILTER_CMD_LINE:/N =!" == "!FINDSTR_FIRST_FILTER_CMD_LINE!" (set "FINDSTR_FIRST_FILTER_CMD_LINE=/N !FINDSTR_FIRST_FILTER_CMD_LINE!"))set OUTPUT_HAS_NUMBER_PREFIX=1
)rem 1. add /N parameter to first filter and flags prefixed output if lines filter is not empty and -f1 flag is not set.
rem 2. add /B parameter to lines filter if lines filter is not empty
if not "!FINDSTR_LINES_FILTER_CMD_LINE!" == "" (if %FLAG_F1_LINE_NUMBER_FILTER% EQU 0 (if "!FINDSTR_FIRST_FILTER_CMD_LINE:/N =!" == "!FINDSTR_FIRST_FILTER_CMD_LINE!" (set "FINDSTR_FIRST_FILTER_CMD_LINE=/N !FINDSTR_FIRST_FILTER_CMD_LINE!"set OUTPUT_HAS_NUMBER_PREFIX=1))if "!FINDSTR_LINES_FILTER_CMD_LINE:/B =!" == "!FINDSTR_LINES_FILTER_CMD_LINE!" (set "FINDSTR_LINES_FILTER_CMD_LINE=/B !FINDSTR_LINES_FILTER_CMD_LINE!")
)rem 1. remove /N parameter from first filter if -f1 flag is set.
rem 2. flags prefixed output if -f1 flag is set.
if %FLAG_F1_LINE_NUMBER_FILTER% NEQ 0 (if not "!FINDSTR_FIRST_FILTER_CMD_LINE:/N =!" == "!FINDSTR_FIRST_FILTER_CMD_LINE!" (set "FINDSTR_FIRST_FILTER_CMD_LINE=!FINDSTR_FIRST_FILTER_CMD_LINE:/N =!")set OUTPUT_HAS_NUMBER_PREFIX=1
)if "%TOOLS_PATH%" == "" set "TOOLS_PATH=%?~dp0%"
rem set "TOOLS_PATH=%TOOLS_PATH:\=/%"
if "%TOOLS_PATH:~-1%" == "\" set "TOOLS_PATH=%TOOLS_PATH:~0,-1%"if %FLAG_FILE_FORMAT_PE% EQU 0 (set CMD_LINE=type "%FILE_PATH_PREFIX%%FILE_PATH%" ^| findstr !FINDSTR_FIRST_FILTER_CMD_LINE!
) else (rem add EULA acception into registry to avoid EULA acception GUI dialogreg add HKCU\Software\Sysinternals\Strings /v EulaAccepted /t REG_DWORD /d 0x00000001 /f >nul 2>nulrem @ for bug case workaroundset CMD_LINE=@"%TOOLS_PATH%\strings.exe" -q "%FILE_PATH_PREFIX%%FILE_PATH%" ^| findstr !FINDSTR_FIRST_FILTER_CMD_LINE!
)if %FLAG_F1_LINE_NUMBER_FILTER% NEQ 0 set CMD_LINE=!CMD_LINE! ^| findstr /N /R /C:".*"
if not "!FINDSTR_LINES_FILTER_CMD_LINE!" == "" set CMD_LINE=!CMD_LINE! ^| findstr !FINDSTR_LINES_FILTER_CMD_LINE!echo %LINE_NUMBERS%= = = = = =rem if %CMD_LINE% EQU 0 (
rem echo %CMD_LINE%
rem     echo 00000000000
rem )rem echo !CMD_LINE! >&2
(endlocalrem to avoid ! character truncationsetlocal DisableDelayedExpansionif %OUTPUT_HAS_NUMBER_PREFIX% NEQ 0 (if %FLAG_PRINT_LINE_NUMBER_PREFIX% NEQ 0 (%CMD_LINE% 2>nul) else ( echo %CMD_LINE%======for /F "usebackq eol= tokens=1,* delims=:" %%i in (`^(%CMD_LINE: | findstr = ^| findstr %^) 2^>nul`) do echo.%%j)) else (%CMD_LINE% 2>nul)
)exit /b 0

5 合并代码

find_patientid.bat

@echo offtype find.txt | findstr /N /R /C:"\<[2-9] \]                                     #   2, 1 NumberOfPatientRelatedStudies" > num.txtping -n 1 127.0.0.1 > nul
call get_numbers.bat
ping -n 1 127.0.0.1 > nul
call print_file_string.bat -n . find.txt 1 /R /C:".*"

参考资料

https://stackoverflow.com/questions/2701910/windows-batch-file-to-echo-a-specific-line-number

利用dcmtk工具查询PACS,找到同一患者两次以上的检查的数据相关推荐

  1. Py之pandas:利用pandas工具输出每行的索引值、及其对应的行数据

    Py之pandas:利用pandas工具输出每行的索引值.及其对应的行数据 目录 利用pandas工具输出每行的索引值.及其对应的行数据 输出结果 实现代码 利用pandas工具输出每行的索引值.及其 ...

  2. 数据对接利用hutool工具类进行xml解析,xml转换成map,然后进行数据入库

    数据对接xml解析 <ESBEntry><!--通过MB对请求进行权限验证,验证后将删除AccessControl节点 --><AccessControl>< ...

  3. 使用linux集体升级系统,1.3. 利用mtd工具升级Linux系统

    1.3. 利用mtd工具升级Linux系统 利用mtd工具升级系统,其实说白了,就是: 用flasherase擦除数据 先用flasherase擦除对应mtd分区中的内容 用nandwrite写入数据 ...

  4. 渗透之信息收集准备工作(利用辅助工具与网站查询)

    渗透的第一步肯定是进行信息收集,在信息收集中总结了10中常见的方向,大概分别如下: 本文章目录大纲如下: 1.DNS信息收集 2.敏感目录收集 3.端口扫描信息收集 4.浏览器语法 5.子域探测 6. ...

  5. 利用轨迹度量快速找出新冠患者接触的易感人群

    COVID-19席卷全球,对全球生命卫生安全构成了极大挑战.截至2020年11月3日,COVID-19 全球累计确诊4718万人,累计死亡120万人.在没有疫苗情况下,早发现.早报告.早隔离.早治疗是 ...

  6. 利用百度API查询手机号归属地

    利用百度Api查询手机号归属地 先到百度API官网查看其有关说明,这是其官网:http://apistore.baidu.com/ 可在此页面找到相关说明. 打开网址可以看到好几个号码归属地的查询,有 ...

  7. LTE学习理解系列——利用matlab工具生成4G LTE信源

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 LTE学习理解系列--利用matlab工具生成4G LTE信源 前言 LTE工具箱的使用 直接使用函数 生成信源的采样率 总结 前言 ...

  8. 利用VisualEsxtop工具图形化查看esxtop参数

    怎样使用VisualEsxtop工具 众多VMware的工程师都知道esxtop/rextop在进行故障排查.性能检测的场景中的重要性:一般而言我们都可以通过各种shell工具连接到ESXI主机,默认 ...

  9. linux下利用valgrind工具进行内存泄露检测和性能分析

    http://blog.csdn.net/yanghao23/article/details/7514587 valgrind通常用来成分析程序性能及程序中的内存泄露错误 一 Valgrind工具集简 ...

最新文章

  1. 关于计算机中 原码, 反码, 补码 详解
  2. python画曲线图例-python使用matplotlib绘制折线图教程
  3. TF之pix2pix:基于TF利用Facades数据集训练pix2pix模型、测试并进行生成过程全记录
  4. php随机数字总和固定,php 随机生成固定长度整数、各种服务器请求方法
  5. C和C++线性表的链式存储
  6. 【资料整理】一些英语面试题整理
  7. Silverlight+WCF 新手实例 象棋 棋子定位与象棋类(四)
  8. linux服务器静态,为Linux服务器设置静态IP的方法
  9. 罗永浩抖音直播带货100天,糊了?
  10. P1010 幂次方 P1022 计算器的改良
  11. 关于DevEco Studio踩过的各种坑~
  12. Spark2.2出现异常:ERROR SparkUI: Failed to bind SparkUI
  13. (十)OpenCV相机标定
  14. 使用Python基于BibTeX引用格式自动生成文献的IEEE引用格式
  15. linux系统用rpm安装vsftpd,linux安装vsftpd和vsftpd配置步骤
  16. Mysql——DQL(查询语句语法、格式、举例)以及全部数据库源码,复制就可实现全部功能
  17. labview 读取xml_在LabVIEW中使用XML
  18. 微信支付以及接入SDK支付
  19. 优质计算机教案,信息技术优质课教案.docx
  20. VB.Net - 程序结构

热门文章

  1. Java 遍历HashMap并修改(remove)
  2. 【024】Vue+Springboot+mysql员工考勤管理系统(多角色登录、请假、打卡)(含源码、数据库、运行教程、实验报告)
  3. pytorch安装教程 GPU版本
  4. 在云服务器搭建vulhub靶场
  5. HP LaserJet 1010 打印机 - 在 Win 7 下安装驱动
  6. 处理大数据的四个步骤
  7. C sharp (#) 数据类型获取
  8. sse——字符串数组
  9. Unexpected exception parsing XML document from class path resource处理
  10. mysql原理、索引、优化-【公司内部培训】