本文整理汇总了C#中Patient.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# Patient.Copy方法的具体用法?C# Patient.Copy怎么用?C# Patient.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Patient
的用法示例。
在下文中一共展示了Patient.Copy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessPV1
///<summary>apt could be null if the PV1 segment is from a message that does not refer to an appointment like an ADT or PPR message or if it is from an SIU message and is for a new appointment. If apt is null, do not update any of the apt fields, like clinic or provider.</summary>
public static void ProcessPV1(Patient pat,Appointment apt,HL7DefSegment segDef,SegmentHL7 seg) {
Appointment aptOld=null;
if(apt!=null) {
aptOld=apt.Clone();
}
Patient patOld=pat.Copy();
for(int i=0;i<segDef.hl7DefFields.Count;i++) {
int itemOrder=segDef.hl7DefFields[i].OrdinalPos;
switch(segDef.hl7DefFields[i].FieldName) {
case "pat.GradeLevel":
int intGradeLevel=0;
try {
intGradeLevel=PIn.Int(seg.GetFieldComponent(itemOrder));
}
catch(Exception ex) {
//if parsing field to int fails, do nothing
continue;
}
if(intGradeLevel<Enum.GetNames(typeof(PatientGrade)).Length) {//if parsed value is outside the range of enum, do nothing with the data
pat.GradeLevel=(PatientGrade)intGradeLevel;//0=Unknown,1-12=first-twelfth, 13=PrenatalWIC, 14=PreK, 15=Kindergarten, 16=Other
}
continue;
case "pat.location":
//Example: ClinicDescript^OpName^^PracticeTitle^^c (c for clinic)
if(seg.GetFieldComponent(itemOrder,5).ToLower()!="c") {//LocationType is 'c' for clinic
continue;
}
long clinicNum=Clinics.GetByDesc(seg.GetFieldComponent(itemOrder,0));//0 if field is blank or description doesn't match clinic description in the db
if(clinicNum==0) {
continue;//do nothing, either no clinic description in the message or no matching clinic found
}
pat.ClinicNum=clinicNum;
if(apt!=null) {
apt.ClinicNum=clinicNum;//the apt.ClinicNum may be set based on a different segment, like the AIL segment
}
continue;
case "prov.provIdName":
case "prov.provIdNameLFM":
long provNum=0;
if(_isEcwHL7Def) {//uses prov.EcwID
provNum=FieldParser.ProvProcessEcw(seg.GetField(itemOrder));
}
else {
provNum=FieldParser.ProvParse(seg.GetField(itemOrder),SegmentNameHL7.PV1,_isVerboseLogging);
}
if(provNum==0) {//This segment didn't have valid provider information in it, so do nothing
continue;
}
if(apt!=null) {//We will set the appt.ProvNum (dentist) to the provider located in the PV1 segment, but this may be changed if the AIG or AIP segments are included
apt.ProvNum=provNum;
}
pat.PriProv=provNum;
continue;
case "pat.site":
//Example: |West Salem Elementary^^^^^s| ('s' for site)
if(seg.GetFieldComponent(itemOrder,5).ToLower()!="s") {//LocationType is 's' for site
continue;//not a site description, do nothing
}
long siteNum=Sites.FindMatchSiteNum(seg.GetFieldComponent(itemOrder,0));//0 if component is blank, -1 if no matching site description in the db
if(siteNum>0) {
pat.SiteNum=siteNum;
}
continue;
case "pat.Urgency":
int intPatUrgency=-1;
try {
intPatUrgency=PIn.Int(seg.GetFieldComponent(itemOrder));//if field is empty, PIn.Int will return 0 which will be the Unknown default urgency
}
catch(Exception ex) {
//do nothing, patUrgency will remain -1
}
if(intPatUrgency>-1 && intPatUrgency<4) {//only cast to enum if 0-3
pat.Urgency=(TreatmentUrgency)intPatUrgency;
}
continue;
default:
continue;
}
}
Patients.Update(pat,patOld);
if(_isVerboseLogging) {
EventLog.WriteEntry("OpenDentHL7","Updated patient "+pat.GetNameFLnoPref()+" due to an incoming PV1 segment.",EventLogEntryType.Information);
}
if(apt!=null) {
Appointments.Update(apt,aptOld);
_aptProcessed=apt;
}
if(_isVerboseLogging) {
EventLog.WriteEntry("OpenDentHL7","Updated appointment for patient "+pat.GetNameFLnoPref()+" due to an incoming PV1 segment.",EventLogEntryType.Information);
}
return;
}
示例2: ProcessPV1
public static void ProcessPV1(Patient pat,long aptNum,HL7DefSegment segDef,SegmentHL7 seg) {
long provNum;
int provNumOrder=0;
for(int i=0;i<segDef.hl7DefFields.Count;i++) {
if(segDef.hl7DefFields[i].FieldName=="prov.provIdName" || segDef.hl7DefFields[i].FieldName=="prov.provIdNameLFM") {
provNumOrder=segDef.hl7DefFields[i].OrdinalPos;
break;
}
}
if(provNumOrder==0) {//No provIdName or provIdNameLFM field in this segment definition so do nothing with it
return;
}
provNum=FieldParser.ProvProcess(seg.Fields[provNumOrder]);
if(provNum==0) {//This segment didn't have a valid provider id in it to locate the provider (must have been blank) so do nothing
return;
}
Appointment apt=Appointments.GetOneApt(aptNum);//SCH segment was found and aptNum was retrieved, if no SCH segment for this message then 0
if(apt==null) {//Just in case we can't find an apt with the aptNum from SCH segment
return;
}
Appointment aptOld=apt.Clone();
Patient patOld=pat.Copy();
apt.ProvNum=provNum;
pat.PriProv=provNum;
Appointments.Update(apt,aptOld);
Patients.Update(pat,patOld);
return;
}
示例3: ProcessPID
//public static void ProcessPD1() {
// return;
//}
public static void ProcessPID(Patient pat,HL7DefSegment segDef,SegmentHL7 seg,MessageHL7 msg) {
Patient patOld=pat.Copy();
char escapeChar='\\';
if(msg.Delimiters.Length>2) {//it is possible they did not send all 4 of the delimiter chars, in which case we will use the default \
escapeChar=msg.Delimiters[2];
}
char subcompChar='&';
if(msg.Delimiters.Length>3) {//it is possible they did not send all 4 of the delimiter chars, in which case we will use the default &
subcompChar=msg.Delimiters[3];
}
for(int i=0;i<segDef.hl7DefFields.Count;i++) {
int itemOrder=segDef.hl7DefFields[i].OrdinalPos;
switch(segDef.hl7DefFields[i].FieldName) {
case "pat.addressCityStateZip":
pat.Address=seg.GetFieldComponent(itemOrder,0);
pat.Address2=seg.GetFieldComponent(itemOrder,1);
pat.City=seg.GetFieldComponent(itemOrder,2);
pat.State=seg.GetFieldComponent(itemOrder,3);
pat.Zip=seg.GetFieldComponent(itemOrder,4);
string strAddrNote=FieldParser.StringNewLineParse(seg.GetFieldComponent(itemOrder,19),escapeChar);
if(strAddrNote!="") {
pat.AddrNote=strAddrNote;
}
continue;
case "pat.birthdateTime":
pat.Birthdate=FieldParser.DateTimeParse(seg.GetFieldComponent(itemOrder));
continue;
case "pat.ChartNumber":
pat.ChartNumber=seg.GetFieldComponent(itemOrder);
continue;
case "pat.FeeSched":
if(Programs.IsEnabled(ProgramName.eClinicalWorks) && ProgramProperties.GetPropVal(ProgramName.eClinicalWorks,"FeeSchedulesSetManually")=="1") {
//if using eCW and FeeSchedulesSetManually
continue;//do not process fee sched field, manually set by user
}
else {
pat.FeeSched=FieldParser.FeeScheduleParse(seg.GetFieldComponent(itemOrder));
}
continue;
case "pat.Gender":
pat.Gender=FieldParser.GenderParse(seg.GetFieldComponent(itemOrder));
continue;
case "pat.HmPhone":
if(seg.GetFieldComponent(itemOrder,2)=="" && seg.GetField(itemOrder).ListRepeatFields.Count==0) {//must be eCW, process the old way
//either no component 2 or left blank, and there are no repetitions, process the old way
//the first repetition is considered the primary number, but if the primary number is not sent then it will be blank followed by the list of other numbers
pat.HmPhone=FieldParser.PhoneParse(seg.GetFieldComponent(itemOrder));
}
else {
//XTN data type, repeatable.
//Component 2 values: PH-Phone, FX-Fax, MD-Modem, CP-Cell Phone, Internet-Internet Address, X.400-X.400 email address, TDD-Tel Device for the Deaf, TTY-Teletypewriter.
//We will support PH for pat.HmPhone, CP for pat.WirelessPhone, and Internet for pat.Email
//Component 5 is area code, 6 is number
//Component 3 will be Email if the type is Internet
//Example: ^PRN^PH^^^503^3635432~^PRN^Internet^[email protected]
FieldHL7 phField=seg.GetField(itemOrder);
if(phField==null) {
continue;
}
string strPhType=seg.GetFieldComponent(itemOrder,2);
string strPh=seg.GetFieldComponent(itemOrder,5)+seg.GetFieldComponent(itemOrder,6);
string strEmail=seg.GetFieldComponent(itemOrder,3);
for(int p=-1;p<phField.ListRepeatFields.Count;p++) {
if(p>=0) {
strPhType=phField.ListRepeatFields[p].GetComponentVal(2);
strPh=phField.ListRepeatFields[p].GetComponentVal(5)+phField.ListRepeatFields[p].GetComponentVal(6);
strEmail=phField.ListRepeatFields[p].GetComponentVal(3);
}
switch(strPhType) {
case "PH":
pat.HmPhone=FieldParser.PhoneParse(strPh);
continue;
case "CP":
pat.WirelessPhone=FieldParser.PhoneParse(strPh);
continue;
case "Internet":
pat.Email=strEmail;
continue;
default:
continue;
}
}
}
continue;
case "pat.nameLFM":
pat.LName=seg.GetFieldComponent(itemOrder,0);
pat.FName=seg.GetFieldComponent(itemOrder,1);
pat.MiddleI=seg.GetFieldComponent(itemOrder,2);
pat.Title=seg.GetFieldComponent(itemOrder,4);
continue;
case "pat.PatNum":
//pat.PatNum guaranteed to not be 0, a new patient will be inserted if the field component for PatNum is not an int, is 0, or is blank
//if(pat.PatNum!=0 && pat.PatNum!=PIn.Long(seg.GetFieldComponent(intItemOrder))) {
//if field component is a valid number and the patient located is not the same as the patient with the PatNum in the segment, then throw the exception, message will fail.
long patNumFromPid=0;
try {
//.........这里部分代码省略.........
示例4: GenerateADT
///<summary>Returns null if there is no HL7Def enabled or if there is no outbound ADT defined for the enabled HL7Def.</summary>
public static MessageHL7 GenerateADT(Patient pat,Patient guar,EventTypeHL7 eventType) {
HL7Def hl7Def=HL7Defs.GetOneDeepEnabled();
if(hl7Def==null) {
return null;
}
//find an outbound ADT message in the def
HL7DefMessage hl7DefMessage=null;
for(int i=0;i<hl7Def.hl7DefMessages.Count;i++) {
if(hl7Def.hl7DefMessages[i].MessageType==MessageTypeHL7.ADT && hl7Def.hl7DefMessages[i].InOrOut==InOutHL7.Outgoing) {
hl7DefMessage=hl7Def.hl7DefMessages[i];
//continue;
break;
}
}
if(hl7DefMessage==null) {//ADT message type is not defined so do nothing and return
return null;
}
if(PrefC.GetBool(PrefName.ShowFeaturePatientClone)) {
Patient patClone;
Patient patNonClone;
List<Patient> listAmbiguousMatches;
Patients.GetCloneAndNonClone(pat,out patClone,out patNonClone,out listAmbiguousMatches);
if(patNonClone!=null) {
pat=patNonClone;
}
}
MessageHL7 messageHL7=new MessageHL7(MessageTypeHL7.ADT);
Provider prov=Providers.GetProv(Patients.GetProvNum(pat));
List<PatPlan> listPatPlans=PatPlans.Refresh(pat.PatNum);
for(int i=0;i<hl7DefMessage.hl7DefSegments.Count;i++) {
int countRepeat=1;
//IN1 segment can repeat, get the number of current insurance plans attached to the patient
if(hl7DefMessage.hl7DefSegments[i].SegmentName==SegmentNameHL7.IN1) {
countRepeat=listPatPlans.Count;
}
//countRepeat is usually 1, but for repeatable/optional fields, it may be 0 or greater than 1
//for example, countRepeat can be zero if the patient does not have any current insplans, in which case no IN1 segments will be included
for(int j=0;j<countRepeat;j++) {//IN1 is optional and can repeat so add as many as listPatplans
PatPlan patplanCur=null;
InsPlan insplanCur=null;
InsSub inssubCur=null;
Carrier carrierCur=null;
Patient patSub=null;
if(hl7DefMessage.hl7DefSegments[i].SegmentName==SegmentNameHL7.IN1) {//index repeat is guaranteed to be less than listPatplans.Count
patplanCur=listPatPlans[j];
inssubCur=InsSubs.GetOne(patplanCur.InsSubNum);
insplanCur=InsPlans.RefreshOne(inssubCur.PlanNum);
carrierCur=Carriers.GetCarrier(insplanCur.CarrierNum);
if(pat.PatNum==inssubCur.Subscriber) {
patSub=pat.Copy();
}
else {
patSub=Patients.GetPat(inssubCur.Subscriber);
}
}
SegmentHL7 seg=new SegmentHL7(hl7DefMessage.hl7DefSegments[i].SegmentName);
seg.SetField(0,hl7DefMessage.hl7DefSegments[i].SegmentName.ToString());
for(int k=0;k<hl7DefMessage.hl7DefSegments[i].hl7DefFields.Count;k++) {
string fieldName=hl7DefMessage.hl7DefSegments[i].hl7DefFields[k].FieldName;
if(fieldName=="") {//If fixed text instead of field name just add text to segment
seg.SetField(hl7DefMessage.hl7DefSegments[i].hl7DefFields[k].OrdinalPos,hl7DefMessage.hl7DefSegments[i].hl7DefFields[k].FixedText);
}
else {
string fieldValue="";
if(hl7DefMessage.hl7DefSegments[i].SegmentName==SegmentNameHL7.IN1) {
fieldValue=FieldConstructor.GenerateFieldIN1(hl7Def,fieldName,j+1,patplanCur,inssubCur,insplanCur,carrierCur,listPatPlans.Count,patSub);
}
else {
fieldValue=FieldConstructor.GenerateFieldADT(hl7Def,fieldName,pat,prov,guar,j+1,eventType,seg.Name);
}
seg.SetField(hl7DefMessage.hl7DefSegments[i].hl7DefFields[k].OrdinalPos,fieldValue);
}
}
messageHL7.Segments.Add(seg);
}
}
return messageHL7;
}