① 开发环境搭建与依赖快速引入

基于 .dcm4che3

② 实体类构建核心字段

public class QueryDicom {
private String PatientName;
private String PatientID;
private String PatientSex;
private String Modality;
private String AccessionNumber;
private String PatientBirthDate;
private String PatientAge;
private String Studytime;
private String PatientWeight;
private String PregnancyStatus;
private String InstitutionName;
private String ReferringPhysicianName;
private String RequestingPhysician;
//执行医生
private String ScheduledPerformingPhysicianName;
//既往史
private String MedicalAlerts;
//过敏史
private String AlleRGies;
//门诊号(住院号)
private String AdmissionID;
//设备AE
private String ScheduledStationAETiTLe;
//检查STUDYUUID
private String studyuuid;
}

③ Attributes 生成参考

public  Attributes buildAttr(QueryDicom QueryDicom)
{
    Attributes attr = new Attributes();
    String PatientName=QueryDicom.getPatientName();
    if(isencrypt==1) {
        PatientName = AESUtil.decode(QueryDicom.getPatientName());
    }
    attr.setString(Tag.SpecificCharacterSet, VR.CS, encoding);
    if (nametype == 0) {
        patientName = PatientName;
    } else if (nametype == 1) {
        patientName = PinYinUtils.getFullSpell(PatientName);
    } else if (nametype == 2) {
        patientName = PinYinUtils.getFullSpell(PatientName) + "(" + PatientName + ")";
    }
    String OtherPatientName=PinYinUtils.getFullSpell(PatientName);
    String StudyInstanceUID=QueryDicom.getStudyuuid();
    attr.setString(Tag.SpecificCharacterSet, VR.CS, encoding);
    attr.setString(Tag.PatientName, VR.PN, patientName);
    attr.setString(Tag.OtherPatientNames, VR.LO, OtherPatientName);
    attr.setString(Tag.PatientID, VR.LO, QueryDicom.getPatientID());
    attr.setString(Tag.OtherPatientIDs, VR.LO, QueryDicom.getPatientID());
    attr.setString(Tag.PatientSex, VR.CS, QueryDicom.getPatientSex());
    attr.setString(Tag.PatientBirthDate, VR.DA, QueryDicom.getPatientBirthDate());
    attr.setString(Tag.PatientAge, VR.AS, QueryDicom.getPatientAge());
    attr.setString(Tag.PatientWeight, VR.DS, QueryDicom.getPatientWeight());
    attr.setString(Tag.PatientSize, VR.DS, "");
    attr.setString(Tag.PregnancyStatus, VR.US, QueryDicom.getPregnancyStatus()); //怀孕状态
    attr.setString(Tag.PatientComments, VR.LT, "");
    attr.setString(Tag.IssuerOfPatientID, VR.LO, "");
    attr.setString(Tag.PatientInstitutionResidence, VR.LO, "");
    attr.setString(Tag.PatientTransportArrangements, VR.LO, "");
    attr.setString(Tag.PatientState, VR.LO, ""); //状态
    attr.setString(Tag.MedicalAlerts, VR.LO, QueryDicom.getMedicalAlerts()); //既往史
    attr.setString(Tag.Allergies, VR.LO, QueryDicom.getAlleRGies()); //过敏
    attr.setString(Tag.SpecialNeeds, VR.LO, "");
    attr.setString(Tag.CurrentPatientLocation, VR.LO, ""); //患者位置
    attr.setString(Tag.InstitutionName, VR.LO, QueryDicom.getInstitutionName());//医院名称
    attr.setString(Tag.AdmissionID, VR.LO, QueryDicom.getAdmissionID());//门诊号
    attr.setString(Tag.ReferringPhysicianName, VR.PN, QueryDicom.getReferringPhysicianName());//检查医生
    attr.setString(Tag.AdmittingDiagnosesDescription, VR.LO, ""); //诊断描述
    attr.setString(Tag.RequestingPhysician, VR.PN, QueryDicom.getRequestingPhysician()); //申请医生
    attr.setString(Tag.StudyInstanceUID, VR.UI, StudyInstanceUID);
    attr.setString(Tag.StudyDescription, VR.LO, "");
    attr.setString(Tag.StudyID, VR.SH, "");
    attr.setString(Tag.Modality, VR.CS, QueryDicom.getModality());
    attr.setString(Tag.AccessionNumber, VR.SH, QueryDicom.getAccessionNumber());
    attr.setString(Tag.BodyPartExamined,VR.CS,"");
    Date Studytime = null;
    if ("CT".equals(QueryDicom.getStudytime())) {
        Studytime = StrToDate(QueryDicom.getStudytime());
        if (Studytime != null) {
            attr.setDate(Tag.StudyDate, VR.DA, Studytime);
            attr.setDate(Tag.StudyTime, VR.TM, new Date());
        } else {
            attr.setDate(Tag.StudyDate, VR.DA, new Date());
            attr.setDate(Tag.StudyTime, VR.TM, new Date());
        }
    } else {
        Studytime = StrToDate1(QueryDicom.getStudytime());
        if (Studytime != null) {
            attr.setDate(Tag.StudyDate, VR.DA, Studytime);
            attr.setDate(Tag.StudyTime, VR.TM, new Date());
        } else {
            attr.setDate(Tag.StudyDate, VR.DA, new Date());
            attr.setDate(Tag.StudyTime, VR.TM, new Date());
        }
    }
    attr.setString(Tag.ImageType, VR.CS, "");
    attr.setString(Tag.StudyInstanceUID, VR.UI, UIDUtils.createUID());
    attr.setString(Tag.SOPInstanceUID, VR.UI, UIDUtils.createUID());
    attr.setString(Tag.SeriesInstanceUID, VR.UI, UIDUtils.createUID());
    attr.setString(Tag.SOPClassUID, VR.UI, "1.2.840.10008.5.1.4.1.1.7");
    attr.setString(Tag.CurrentPatientLocation, VR.LO, "");
    attr.setString(Tag.RequestingService, VR.LO, "");
    attr.setString(Tag.RequestedProcedureDescription, VR.LO, "");
    attr.setString(Tag.RequestedProcedureID, VR.SH, QueryDicom.getAccessionNumber());
    attr.setString(Tag.ReasonForTheRequestedProcedure, VR.LO, "");
    attr.setString(Tag.RequestedProcedurePriority, VR.SH, "");
    attr.setString(Tag.RequestedProcedureComments, VR.LT, "");
    attr.setString(Tag.ReasonForTheImagingServiceRequest, VR.LO, "");
    attr.setDate(Tag.IssueDateOfImagingServiceRequest, VR.DA, new Date());
    attr.setDate(Tag.IssueTimeOfImagingServiceRequest, VR.TM, new Date());
    attr.setString(Tag.PlacerOrderNumberImagingServiceRequestRetired, VR.SH, "");
    attr.setString(Tag.FillerOrderNumberImagingServiceRequestRetired, VR.SH, QueryDicom.getAccessionNumber());
    attr.setString(Tag.ImagingServiceRequestComments, VR.LT, "");
    attr.setString(Tag.ConfidentialityConstraintOnPatientDataDescription, VR.LO, "Y");
    attr.setString(Tag.PatientTransportArrangements, VR.LO, "");
    attr.setString(Tag.SpecialNeeds, VR.LO, "");
    //ScheduledProcedureStepSequence

    Attributes item = new Attributes();
    item.setString(Tag.Modality, VR.CS, QueryDicom.getModality());
    item.setDate(Tag.ScheduledProcedureStepStartDate, VR.DA, Studytime);
    item.setDate(Tag.ScheduledProcedureStepStartTime, VR.TM, new Date());
    item.setString(Tag.ScheduledPerformingPhysicianName, VR.PN, QueryDicom.getScheduledPerformingPhysicianName()); //执行医生
    item.setString(Tag.ScheduledProcedureStepDescription, VR.LO, "");
    item.setString(Tag.ScheduledStationAETitle, VR.AE, QueryDicom.getScheduledStationAETiTLe()); //设备的 AE
    item.setString(Tag.ScheduledProcedureStepID, VR.SH, QueryDicom.getAccessionNumber());
    item.setString(Tag.ScheduledStationName,VR.SH,"");
    item.setString(Tag.ScheduledProcedureStepLocation, VR.SH,"");
    item.setString(Tag.PreMedication, VR.LO,"");
    attr.newSequence(Tag.ScheduledProcedureStepSequence, 1).add(item);
    //ScheduledProtocolCodeSequence
    Attributes rpcs1 = new Attributes();
    rpcs1.setString(Tag.CodeValue,VR.SH,"");
    rpcs1.setString(Tag.CodingSchemeDesignator,VR.SH,"");
    rpcs1.setString(Tag.CodingSchemeVersion,VR.SH,"");
    rpcs1.setString(Tag.CodeMeaning,VR.LO,"");
    attr.newSequence(Tag.ScheduledProtocolCodeSequence,1).add(rpcs1);
    return  attr;
}
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/b739faa8e6334b9a8b7ebf8faed9883c.png#pic_center)

更多推荐