|
@ -52,6 +52,8 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
//添加关联家属
|
|
|
@Transactional
|
|
|
public MixEnvelop addFamily(String id,String patientId, String familyName, String dictId, String cardType, String idCard, String phoneNum,boolean demo) throws Exception {
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
try{
|
|
|
BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findOne(dictId);
|
|
|
BasePatientDO basePatientDO = basePatientDao.findByIdcard(idCard);
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
@ -66,7 +68,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
if (StringUtils.isNotBlank(id)){
|
|
|
result = wlyyPatientFamilyMemberDao.findOne(id);
|
|
|
}
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
|
|
|
String dictName = "";
|
|
|
if (null!=basePatientMemberDictDO){
|
|
|
dictName = basePatientMemberDictDO.getRelationName();
|
|
@ -89,6 +91,10 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
}
|
|
|
familyId= jsonObject.getString("brid");
|
|
|
birth= jsonObject.getString("csny");
|
|
|
long lt = new Long(birth);
|
|
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
birth = sf.format(lt);
|
|
|
System.out.println("眼科转换后的csny"+birth);
|
|
|
}else {
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("您所添加的家属无就诊记录无法添加");
|
|
@ -133,9 +139,10 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
mixEnvelop.setMessage("心脏中心暂未开放");
|
|
|
}
|
|
|
basePatientDO.setSex(sex);
|
|
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date saveBirth = sf.parse(birth);
|
|
|
basePatientDO.setBirthday(saveBirth);
|
|
|
SimpleDateFormat sf3 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date saveBirth1 = sf3.parse(birth);
|
|
|
System.out.println("====="+saveBirth1);
|
|
|
basePatientDO.setBirthday(saveBirth1);
|
|
|
result.setFamilyRelation(dictId);
|
|
|
result.setFamilyRelationName(dictName);
|
|
|
result.setIsDel(1);
|
|
@ -155,31 +162,36 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
if (sucessPatient!=null){
|
|
|
patientNewId=sucessPatient.getId();
|
|
|
}
|
|
|
result.setFamilyMember(patientNewId);
|
|
|
wlyyPatientFamilyMemberDao.save(result);
|
|
|
patientMappingDO.setIdcard(idCard);
|
|
|
patientMappingDO.setSource("1");
|
|
|
patientMappingDO.setPatientName(familyName);
|
|
|
patientMappingDO.setMappingCode(familyId);
|
|
|
patientMappingDO.setPatient(patientNewId);
|
|
|
patientMappingDO.setCreateTime(new Date());
|
|
|
patientMappingDao.save(patientMappingDO);
|
|
|
resultMap.put("patientId",patientId);
|
|
|
resultMap.put("familyMember",patientNewId);
|
|
|
resultMap.put("idCard",idCard);
|
|
|
resultMap.put("phoneNum",phoneNum);
|
|
|
resultMap.put("relationName",dictName);
|
|
|
resultMap.put("name",familyName);
|
|
|
resultMap.put("cardType",cardType);
|
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
|
resultList.add(resultMap);
|
|
|
mixEnvelop.setStatus(200);
|
|
|
mixEnvelop.setMessage("添加成功");
|
|
|
mixEnvelop.setDetailModelList(resultList);
|
|
|
result.setFamilyMember(patientNewId);
|
|
|
wlyyPatientFamilyMemberDao.save(result);
|
|
|
patientMappingDO.setIdcard(idCard);
|
|
|
patientMappingDO.setSource("1");
|
|
|
patientMappingDO.setPatientName(familyName);
|
|
|
patientMappingDO.setMappingCode(familyId);
|
|
|
patientMappingDO.setPatient(patientNewId);
|
|
|
patientMappingDO.setCreateTime(new Date());
|
|
|
patientMappingDao.save(patientMappingDO);
|
|
|
resultMap.put("patientId",patientId);
|
|
|
resultMap.put("familyMember",patientNewId);
|
|
|
resultMap.put("idCard",idCard);
|
|
|
resultMap.put("phoneNum",phoneNum);
|
|
|
resultMap.put("relationName",dictName);
|
|
|
resultMap.put("name",familyName);
|
|
|
resultMap.put("cardType",cardType);
|
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
|
resultList.add(resultMap);
|
|
|
mixEnvelop.setStatus(200);
|
|
|
mixEnvelop.setMessage("添加成功");
|
|
|
mixEnvelop.setDetailModelList(resultList);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("添加失败");
|
|
|
}
|
|
|
|
|
|
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
|
|
|
//根据患者id查询关联家属
|
|
|
public List<Map<String,Object>> findFamilyByPatientId(String patientId) throws ParseException {
|
|
|
String sql = "select t.id as \"id\",t.card_type as \"cardType\", " +
|