@@ -165,10 +165,9 @@ + (NSDate *)parseDateString:(NSString *)str {
165
165
166
166
NSError *error = nil ;
167
167
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern: @" ([\\ +|\\ -])([0-9]{1,2}):?([0-9]{1,2})$"
168
- options: nil
168
+ options: 0
169
169
error: &error];
170
- NSTextCheckingResult *result = [regex firstMatchInString: str options: nil range: NSMakeRange (0 , str.length)];
171
- NSString *overall = [str substringWithRange: [result range ]];
170
+ NSTextCheckingResult *result = [regex firstMatchInString: str options: 0 range: NSMakeRange (0 , str.length)];
172
171
NSString *timeZoneOffsetMark = [str substringWithRange: [result rangeAtIndex: 1 ]];
173
172
NSString *timeZoneOffsetHour = [str substringWithRange: [result rangeAtIndex: 2 ]];
174
173
NSString *timeZoneOffsetMinutes = [str substringWithRange: [result rangeAtIndex: 3 ]];
@@ -185,6 +184,8 @@ + (NSDate *)parseDateString:(NSString *)str {
185
184
}
186
185
187
186
- (ZurRosePrescription *)toZurRosePrescription {
187
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc ] init ];
188
+ dateFormatter.dateFormat = @" yyyy-MM-dd" ;
188
189
ZurRosePrescription *prescription = [[ZurRosePrescription alloc ] init ];
189
190
190
191
prescription.issueDate = self.date ;
@@ -257,20 +258,24 @@ - (ZurRosePrescription *)toZurRosePrescription {
257
258
product.insuranceEanId = insuranceEan;
258
259
259
260
BOOL repetition = NO ;
261
+ NSDate *validityRepetition = nil ;
260
262
NSMutableArray <ZurRosePosology *> *poses = [NSMutableArray array ];
263
+ ZurRosePosology *pos = [[ZurRosePosology alloc ] init ];
264
+ [poses addObject: pos];
261
265
for (EPrescriptionPosology *mediPos in medi.pos ) {
262
- ZurRosePosology *pos = [[ZurRosePosology alloc ] init ];
263
- [poses addObject: pos];
264
266
if (mediPos.d .count ) {
265
267
pos.qtyMorning = mediPos.d [0 ].intValue ;
266
268
pos.qtyMidday = mediPos.d [1 ].intValue ;
267
269
pos.qtyEvening = mediPos.d [2 ].intValue ;
268
270
pos.qtyNight = mediPos.d [3 ].intValue ;
271
+ pos.posologyText = medi.appInstr ;
269
272
}
270
273
if (mediPos.dtTo ) {
271
274
repetition = YES ;
275
+ validityRepetition = mediPos.dtTo ;
272
276
}
273
277
}
278
+ product.validityRepetition = [dateFormatter stringFromDate: validityRepetition];
274
279
product.repetition = repetition;
275
280
product.posology = poses;
276
281
}
@@ -332,8 +337,8 @@ - (NSDictionary *)amkDict {
332
337
},
333
338
@" patient" : @{
334
339
@" patient_id" : [self generatePatientUniqueID ],
335
- @" given_name" : self.patientLastName ?: @" " ,
336
- @" family_name" : self.patientFirstName ?: @" " ,
340
+ @" given_name" : self.patientFirstName ?: @" " ,
341
+ @" family_name" : self.patientLastName ?: @" " ,
337
342
@" birth_date" : self.patientBirthdate ? [birthDateDateFormatter stringFromDate: self .patientBirthdate] : @" " ,
338
343
@" gender" : self.patientGender .intValue == 1 ? KEY_AMK_PAT_GENDER_M : KEY_AMK_PAT_GENDER_F,
339
344
@" email_address" : self.patientEmail ?: @" " ,
0 commit comments