Skip to content

Commit

Permalink
Merge pull request #188 from b123400/fix-187
Browse files Browse the repository at this point in the history
Fix issue with birthday, ean, posology
  • Loading branch information
zdavatz authored Jan 7, 2025
2 parents 0e6a072 + 5770f42 commit eb94782
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions AmiKoDesitin/EPrescription/EPrescription.m
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ - (NSString *)generatePatientUniqueID

if (self.patientBirthdate) {
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:self.patientBirthdate];
birthDateString = [NSString stringWithFormat:@"%d.%d.%d", components.day, components.month, components.year];
birthDateString = [NSString stringWithFormat:@"%ld.%ld.%ld", (long)components.day, (long)components.month, (long)components.year];
}

// The UUID should be unique and should be based on familyname, givenname, and birthday
Expand All @@ -305,7 +305,7 @@ - (NSString *)generatePatientUniqueID

- (NSDictionary *)amkDict {
NSDateFormatter *birthDateDateFormatter = [[NSDateFormatter alloc] init];
birthDateDateFormatter.dateFormat = @"yyyy.MM.dd";
birthDateDateFormatter.dateFormat = @"dd.MM.yyyy";

NSDateFormatter *placeDateFormatter = [[NSDateFormatter alloc] init];
placeDateFormatter.dateFormat = @"dd.MM.yyyy (HH:mm:ss)";
Expand Down
9 changes: 9 additions & 0 deletions AmiKoDesitin/EPrescription/ZurRosePosology.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@

@implementation ZurRosePosology

- (instancetype)init {
self = [super init];
self.qtyMorning = -1;
self.qtyMidday = -1;
self.qtyEvening = -1;
self.qtyNight = -1;
return self;
}

- (DDXMLElement *)toXML {
DDXMLElement *e = [DDXMLElement elementWithName:@"posology"];

Expand Down
2 changes: 1 addition & 1 deletion AmiKoDesitin/EPrescription/ZurRosePrescriptorAddress.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ - (DDXMLElement *)toXML {
[e addAttribute:[DDXMLNode attributeWithName:@"langCode" stringValue:[@(self.langCode) stringValue]]];
[e addAttribute:[DDXMLNode attributeWithName:@"clientNrClustertec" stringValue:self.clientNrClustertec]];
[e addAttribute:[DDXMLNode attributeWithName:@"zsrId" stringValue:self.zsrId]];
if (!self.eanId) {
if (self.eanId) {
[e addAttribute:[DDXMLNode attributeWithName:@"eanId" stringValue:self.eanId]];
}
return e;
Expand Down
9 changes: 7 additions & 2 deletions AmiKoDesitin/Prescription.m
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ - (ZurRosePrescription *)toZurRosePrescription {
patient.zipCode = self.patient.zipCode;
{
NSDateFormatter *birthDateDateFormatter = [[NSDateFormatter alloc] init];
birthDateDateFormatter.dateFormat = @"yyyy.MM.dd";
birthDateDateFormatter.dateFormat = @"dd.MM.yyyy";
patient.birthday = [birthDateDateFormatter dateFromString:self.patient.birthDate];
}
patient.sex = [self.patient.gender isEqual:KEY_AMK_PAT_GENDER_M] ? 1 : 2; // same, 1 = m, 2 = f
Expand All @@ -252,7 +252,12 @@ - (ZurRosePrescription *)toZurRosePrescription {
product.insuranceBillingType = 1;
product.insuranceEanId = self.patient.insuranceGLN;
product.repetition = NO;
product.posology = @[];
product.description_ = m.packageInfo;

ZurRosePosology *pos = [[ZurRosePosology alloc] init];
pos.posologyText = m.comment;
pos.label = 1;
product.posology = @[pos];
}
prescription.products = products;

Expand Down

0 comments on commit eb94782

Please sign in to comment.