dcu.dateBorn = born;
dcu.snils = snils != null ? snils.trim() : "";
Integer id = clientMap.get(dcu);
if (id != null) {
Client client = findEntity(Client.class, id);
PersonalData data = new PersonalData();
data.id = id;
data.snils = snils;
Polis polisOMI = ClientBean.findPolisOMI(client, manager);
if (polisOMI != null) {
clientPolisMap.put(client.getId(), polisOMI);
String polisSN ="";
if (polisOMI.getSeries() != null) {
polisSN = polisOMI.getSeries();
}
if (polisOMI.getNumber() != null) {
polisSN = polisSN + " " + polisOMI.getNumber();
}
data.polisSN = polisSN.trim();
String code = polisOMI.getRegionCode().getTitle();
code += "00000000000000000";
Field[] f = new Field[]{new Field("kladrCode", code)};
List<AddressObject> adrs = findEntityList(AddressObject.class, f);
if (!adrs.isEmpty()) {
String okatoS = Long.toString(adrs.get(0).getOkato());
if (okatoS.length() > 5) {
okatoS = okatoS.substring(0, 5);
}
int okatoI = Integer.parseInt(okatoS);
data.okatoOMC = okatoI;
}
else {
data.okatoOMC = Integer.MIN_VALUE;
}
//TODO ОГРН СМО
}
data.surname = surname != null ? surname.getTitle() : null;
data.name = name != null ? name.getTitle() : null;
data.pathronymic = patronymic != null ? patronymic.getTitle() : null;
Sex sex = client.getSex();
if (sex != null) {
data.sex = client.getSex().getId() == Sex.CLIENT_SEX_MALE ? 'М' : 'Ж';
}
else {
data.sex = Character.MIN_VALUE;
}
data.bornDate = born;
Excemption ex = fc.getExcemption1();
if (ex == null) {
ex = fc.getExcemption2();
}
if (ex != null) {
data.exemptionID = ex.getExtKey();
}
ClientDocument doc = client.getClientDocument();
if (doc != null) {
ClientDocumentType type = doc.getDoctype();
if (type != null) {
data.docTypeID = type.getExtKey();
}
String docSN ="";
if (doc.getSeries() != null) {
docSN = doc.getSeries();
}
if (doc.getNumber() != null) {
docSN = docSN + " " + doc.getNumber();
}
data.docSN = docSN.trim();
}
else {
ClientDocumentType type = fc.getDocumentType();
if (type != null) {
data.docTypeID = type.getExtKey();
}
data.docSN = fc.getDocumentSN();
}
Address add = client.getAddress();
if (add != null) {
AddressObject aObj = add.getAddressObject();
String okatoS = Long.toString(aObj.getOkato());
if (okatoS.length() > 5) {
okatoS = okatoS.substring(0, 5);