|
|
@ -610,272 +610,265 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
|
|
|
@Transactional
|
|
|
public MixEnvelop addFamilyAppoint(String id,String patientId, String familyName, String dictId, String cardType, String idCard, String phoneNum,boolean demo,String medicareType,String medicare,String clinicId,String patientCardId) throws Exception {
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
try{
|
|
|
BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findOne(dictId);
|
|
|
BasePatientDO basePatientDO = null;
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
/*List<BasePatientDO> listpatients=basePatientDao.findByMobileAndDel(phoneNum,"1");
|
|
|
if (listpatients!=null&&listpatients.size()>0){
|
|
|
basePatientDO=listpatients.get(0);
|
|
|
}*/
|
|
|
basePatientDO= basePatientDao.findByIdcard(idCard);
|
|
|
}else {
|
|
|
basePatientDO= basePatientDao.findByIdcard(idCard);
|
|
|
}
|
|
|
BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findOne(dictId);
|
|
|
BasePatientDO basePatientDO = null;
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
/*List<BasePatientDO> listpatients=basePatientDao.findByMobileAndDel(phoneNum,"1");
|
|
|
if (listpatients!=null&&listpatients.size()>0){
|
|
|
basePatientDO=listpatients.get(0);
|
|
|
}*/
|
|
|
basePatientDO= basePatientDao.findByIdcard(idCard);
|
|
|
}else {
|
|
|
basePatientDO= basePatientDao.findByIdcard(idCard);
|
|
|
}
|
|
|
|
|
|
List<BasePatientDO> list = basePatientDao.findByMobile(phoneNum);
|
|
|
if ("xm_xzzx_wx".equalsIgnoreCase(wxId)){
|
|
|
if (list!=null&&list.size()>0&&basePatientDO!=null){
|
|
|
if (basePatientDO.getMobile().equalsIgnoreCase(phoneNum)){
|
|
|
List<BasePatientDO> list = basePatientDao.findByMobile(phoneNum);
|
|
|
if ("xm_xzzx_wx".equalsIgnoreCase(wxId)){
|
|
|
if (list!=null&&list.size()>0&&basePatientDO!=null){
|
|
|
if (basePatientDO.getMobile().equalsIgnoreCase(phoneNum)){
|
|
|
|
|
|
}else{
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("您所添加的家属手机号已被他人占用");
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
}else if (list!=null&&list.size()>0&&basePatientDO==null){
|
|
|
mixEnvelop.setStatus(409);
|
|
|
}else{
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("您所添加的家属手机号已被他人占用");
|
|
|
return mixEnvelop;
|
|
|
} else {
|
|
|
if(basePatientDO==null){
|
|
|
basePatientDO = new BasePatientDO();
|
|
|
}
|
|
|
basePatientDO.setMobile(phoneNum);
|
|
|
}
|
|
|
}else{
|
|
|
}else if (list!=null&&list.size()>0&&basePatientDO==null){
|
|
|
mixEnvelop.setStatus(409);
|
|
|
mixEnvelop.setMessage("您所添加的家属手机号已被他人占用");
|
|
|
return mixEnvelop;
|
|
|
} else {
|
|
|
if(basePatientDO==null){
|
|
|
basePatientDO = new BasePatientDO();
|
|
|
}
|
|
|
basePatientDO.setMobile(phoneNum);
|
|
|
}
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByIdcard(idCard);
|
|
|
if(null==patientMappingDO){
|
|
|
patientMappingDO = new PatientMappingDO();
|
|
|
}
|
|
|
WlyyPatientFamilyMemberDO result = new WlyyPatientFamilyMemberDO();
|
|
|
if (StringUtils.isNotBlank(id)){
|
|
|
result = wlyyPatientFamilyMemberDao.findOne(id);
|
|
|
basePatientDO = basePatientDao.findById(result.getFamilyMember());
|
|
|
patientMappingDO = patientMappingDao.findByPatient(result.getFamilyMember());
|
|
|
}else{
|
|
|
if(basePatientDO==null){
|
|
|
basePatientDO = new BasePatientDO();
|
|
|
}
|
|
|
}
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByIdcard(idCard);
|
|
|
if(null==patientMappingDO){
|
|
|
patientMappingDO = new PatientMappingDO();
|
|
|
}
|
|
|
WlyyPatientFamilyMemberDO result = new WlyyPatientFamilyMemberDO();
|
|
|
if (StringUtils.isNotBlank(id)){
|
|
|
result = wlyyPatientFamilyMemberDao.findOne(id);
|
|
|
basePatientDO = basePatientDao.findById(result.getFamilyMember());
|
|
|
patientMappingDO = patientMappingDao.findByPatient(result.getFamilyMember());
|
|
|
}
|
|
|
|
|
|
String dictName = "";
|
|
|
if (null!=basePatientMemberDictDO){
|
|
|
dictName = basePatientMemberDictDO.getRelationName();
|
|
|
String dictName = "";
|
|
|
if (null!=basePatientMemberDictDO){
|
|
|
dictName = basePatientMemberDictDO.getRelationName();
|
|
|
}
|
|
|
String familyId="";
|
|
|
String birth = "";
|
|
|
String yktFamilyId = "";
|
|
|
int sex=3;
|
|
|
//获取his家属数据
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
String familySex = IdCardUtil.getSexForIdcard(idCard);
|
|
|
if (familySex.equalsIgnoreCase("男")){
|
|
|
familySex= "1";
|
|
|
sex =1 ;
|
|
|
}else if (familySex.equalsIgnoreCase("女")){
|
|
|
familySex = "0";
|
|
|
sex = 2 ;
|
|
|
}else {
|
|
|
familySex = "2";
|
|
|
sex = 3;
|
|
|
}
|
|
|
String familyId="";
|
|
|
String birth = "";
|
|
|
String yktFamilyId = "";
|
|
|
int sex=3;
|
|
|
//获取his家属数据
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
String familySex = IdCardUtil.getSexForIdcard(idCard);
|
|
|
if (familySex.equalsIgnoreCase("男")){
|
|
|
familySex= "1";
|
|
|
sex =1 ;
|
|
|
}else if (familySex.equalsIgnoreCase("女")){
|
|
|
familySex = "0";
|
|
|
sex = 2 ;
|
|
|
}else {
|
|
|
familySex = "2";
|
|
|
sex = 3;
|
|
|
}
|
|
|
String familyAge = String.valueOf(IdCardUtil.getAgeForIdcard(idCard));
|
|
|
BasePatientMemberDictDO basePatientMemberDictDO1 = basePatientMemberDictDao.findOne(dictId);
|
|
|
String relationName = "";
|
|
|
if (null!=basePatientMemberDictDO1){
|
|
|
relationName=basePatientMemberDictDO1.getRelationName();
|
|
|
}
|
|
|
BasePatientDO basePatientDO1 = basePatientDao.findById(patientId);
|
|
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
birth = IdCardUtil.getBirthdayForIdcardStr(idCard);
|
|
|
String res = "";
|
|
|
//id不为空则为修改家人关系
|
|
|
if (StringUtils.isNotBlank(id)){
|
|
|
if (null!=basePatientDO1){
|
|
|
String cardType1 = "";
|
|
|
String cardNo = "";
|
|
|
if (StringUtils.isNotBlank(medicare)){
|
|
|
cardType1="1";
|
|
|
cardNo=medicare;
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(clinicId)){
|
|
|
cardType1="2";
|
|
|
cardNo=clinicId;
|
|
|
}
|
|
|
String authorization="";
|
|
|
String tokenRes=ykyyPrescriptionService.mobileOnly(basePatientDO1.getMobile());
|
|
|
if (StringUtils.isNotBlank(tokenRes)){
|
|
|
JSONObject object = JSONObject.parseObject(tokenRes);
|
|
|
if (object.getString("code").equalsIgnoreCase("200")){
|
|
|
JSONObject object1=object.getJSONObject("data");
|
|
|
authorization=object1.getString("accessToken");
|
|
|
}
|
|
|
}
|
|
|
if (!StringUtils.isNotBlank(authorization)){
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("眼科通token失效");
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
res = ykyyPrescriptionService.add(result.getYktFamilyId(),familyName,cardType,idCard,phoneNum, dictId,cardType1,cardNo,authorization,patientCardId);
|
|
|
BasePatientMemberDictDO basePatientMemberDictDO1 = basePatientMemberDictDao.findOne(dictId);
|
|
|
String relationName = "";
|
|
|
if (null!=basePatientMemberDictDO1){
|
|
|
relationName=basePatientMemberDictDO1.getRelationName();
|
|
|
}
|
|
|
BasePatientDO basePatientDO1 = basePatientDao.findById(patientId);
|
|
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
birth = IdCardUtil.getBirthdayForIdcardStr(idCard);
|
|
|
String res = "";
|
|
|
//id不为空则为修改家人关系
|
|
|
if (StringUtils.isNotBlank(id)){
|
|
|
if (null!=basePatientDO1){
|
|
|
String cardType1 = "";
|
|
|
String cardNo = "";
|
|
|
if (StringUtils.isNotBlank(medicare)){
|
|
|
cardType1="1";
|
|
|
cardNo=medicare;
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(res)){
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(res);
|
|
|
if ("200".equalsIgnoreCase(jsonObject1.getString("code"))){
|
|
|
/*JSONObject jsonObject2 = JSONObject.parseObject(jsonObject1.getString("data"));
|
|
|
yktFamilyId = jsonObject2.getString("ID");*/
|
|
|
}else {
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage(jsonObject1.getString("msg"));
|
|
|
return mixEnvelop;
|
|
|
if (StringUtils.isNotBlank(clinicId)){
|
|
|
cardType1="2";
|
|
|
cardNo=clinicId;
|
|
|
}
|
|
|
String authorization="";
|
|
|
String tokenRes=ykyyPrescriptionService.mobileOnly(basePatientDO1.getMobile());
|
|
|
if (StringUtils.isNotBlank(tokenRes)){
|
|
|
JSONObject object = JSONObject.parseObject(tokenRes);
|
|
|
if (object.getString("code").equalsIgnoreCase("200")){
|
|
|
JSONObject object1=object.getJSONObject("data");
|
|
|
authorization=object1.getString("accessToken");
|
|
|
}
|
|
|
}
|
|
|
if (!StringUtils.isNotBlank(authorization)){
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("眼科通token失效");
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
res = ykyyPrescriptionService.add(result.getYktFamilyId(),familyName,cardType,idCard,phoneNum, dictId,cardType1,cardNo,authorization,patientCardId);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(res)){
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(res);
|
|
|
if ("200".equalsIgnoreCase(jsonObject1.getString("code"))){
|
|
|
/*JSONObject jsonObject2 = JSONObject.parseObject(jsonObject1.getString("data"));
|
|
|
yktFamilyId = jsonObject2.getString("ID");*/
|
|
|
}else {
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("更新家人关系失败,请核对个人信息.");
|
|
|
mixEnvelop.setMessage(jsonObject1.getString("msg"));
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
}else {
|
|
|
if (null!=basePatientDO1){
|
|
|
String cardType1 = "";
|
|
|
String cardNo = "";
|
|
|
if (StringUtils.isNotBlank(medicare)){
|
|
|
cardType1="1";
|
|
|
cardNo=medicare;
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(clinicId)){
|
|
|
cardType1="2";
|
|
|
cardNo=clinicId;
|
|
|
}
|
|
|
String authorization="";
|
|
|
String tokenRes=ykyyPrescriptionService.mobileOnly(basePatientDO1.getMobile());
|
|
|
if (StringUtils.isNotBlank(tokenRes)){
|
|
|
JSONObject object = JSONObject.parseObject(tokenRes);
|
|
|
if (object.getString("code").equalsIgnoreCase("200")){
|
|
|
JSONObject object1=object.getJSONObject("data");
|
|
|
authorization=object1.getString("accessToken");
|
|
|
}
|
|
|
}
|
|
|
if (!StringUtils.isNotBlank(authorization)){
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("眼科通token失效");
|
|
|
return mixEnvelop;
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("更新家人关系失败,请核对个人信息.");
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
}else {
|
|
|
if (null!=basePatientDO1){
|
|
|
String cardType1 = "";
|
|
|
String cardNo = "";
|
|
|
if (StringUtils.isNotBlank(medicare)){
|
|
|
cardType1="1";
|
|
|
cardNo=medicare;
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(clinicId)){
|
|
|
cardType1="2";
|
|
|
cardNo=clinicId;
|
|
|
}
|
|
|
String authorization="";
|
|
|
String tokenRes=ykyyPrescriptionService.mobileOnly(basePatientDO1.getMobile());
|
|
|
if (StringUtils.isNotBlank(tokenRes)){
|
|
|
JSONObject object = JSONObject.parseObject(tokenRes);
|
|
|
if (object.getString("code").equalsIgnoreCase("200")){
|
|
|
JSONObject object1=object.getJSONObject("data");
|
|
|
authorization=object1.getString("accessToken");
|
|
|
}
|
|
|
res = ykyyPrescriptionService.add(null,familyName,cardType,idCard,phoneNum, dictId,cardType1,cardNo,authorization,patientCardId);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(res)){
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(res);
|
|
|
if ("200".equalsIgnoreCase(jsonObject1.getString("code"))){
|
|
|
if (!StringUtils.isNotBlank(authorization)){
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("眼科通token失效");
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
res = ykyyPrescriptionService.add(null,familyName,cardType,idCard,phoneNum, dictId,cardType1,cardNo,authorization,patientCardId);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(res)){
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(res);
|
|
|
if ("200".equalsIgnoreCase(jsonObject1.getString("code"))){
|
|
|
// JSONObject jsonObject2 = JSONObject.parseObject(jsonObject1.getString("data"));
|
|
|
// yktFamilyId = jsonObject2.getString("ID");
|
|
|
// result.setYktFamilyId(yktFamilyId);
|
|
|
}else {
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage(jsonObject1.getString("msg"));
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
}else {
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("添加家人关系失败,请核对个人信息.");
|
|
|
mixEnvelop.setMessage(jsonObject1.getString("msg"));
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
}else {
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("添加家人关系失败,请核对个人信息.");
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
|
|
|
System.out.println("眼科转换后的csny"+birth);
|
|
|
}
|
|
|
basePatientDO.setSex(sex);
|
|
|
if ("xm_xzzx_wx".equalsIgnoreCase(wxId)){
|
|
|
basePatientDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
|
|
|
}else if("xm_zsyy_wx".equalsIgnoreCase(wxId)||"xm_ykyy_wx".equalsIgnoreCase(wxId)) {
|
|
|
SimpleDateFormat sf3 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date saveBirth1 = sf3.parse(birth);
|
|
|
System.out.println("====="+saveBirth1);
|
|
|
basePatientDO.setBirthday(saveBirth1);
|
|
|
}else {
|
|
|
basePatientDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
|
|
|
}
|
|
|
result.setFamilyRelation(dictId);
|
|
|
result.setFamilyRelationName(dictName);
|
|
|
result.setIsDel(1);
|
|
|
result.setPatient(patientId);
|
|
|
result.setCardNo(idCard);
|
|
|
result.setCardType(cardType);
|
|
|
result.setMobile(phoneNum);
|
|
|
//保存到base_patient表
|
|
|
basePatientDO.setName(familyName);
|
|
|
basePatientDO.setIdcard(idCard);
|
|
|
basePatientDO.setRegister("0");
|
|
|
basePatientDO.setEnabled(1);
|
|
|
basePatientDO.setDel("1");
|
|
|
|
|
|
BasePatientDO sucessPatient= basePatientDao.save(basePatientDO);
|
|
|
String patientNewId= "";
|
|
|
if (sucessPatient!=null){
|
|
|
patientNewId=sucessPatient.getId();
|
|
|
}
|
|
|
result.setFamilyMember(patientNewId);
|
|
|
wlyyPatientFamilyMemberDao.save(result);
|
|
|
if (!"xm_xzzx_wx".equalsIgnoreCase(wxId)){
|
|
|
if (patientMappingDO!=null){
|
|
|
patientMappingDO.setIdcard(idCard);
|
|
|
patientMappingDO.setSource("1");
|
|
|
patientMappingDO.setPatientName(familyName);
|
|
|
patientMappingDO.setMappingCode(familyId);
|
|
|
patientMappingDO.setPatient(patientNewId);
|
|
|
patientMappingDO.setCreateTime(new Date());
|
|
|
patientMappingDao.save(patientMappingDO);
|
|
|
}
|
|
|
System.out.println("眼科转换后的csny"+birth);
|
|
|
}
|
|
|
basePatientDO.setSex(sex);
|
|
|
if ("xm_xzzx_wx".equalsIgnoreCase(wxId)){
|
|
|
basePatientDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
|
|
|
}else if("xm_zsyy_wx".equalsIgnoreCase(wxId)||"xm_ykyy_wx".equalsIgnoreCase(wxId)) {
|
|
|
SimpleDateFormat sf3 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date saveBirth1 = sf3.parse(birth);
|
|
|
System.out.println("====="+saveBirth1);
|
|
|
basePatientDO.setBirthday(saveBirth1);
|
|
|
}else {
|
|
|
basePatientDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
|
|
|
}
|
|
|
result.setFamilyRelation(dictId);
|
|
|
result.setFamilyRelationName(dictName);
|
|
|
result.setIsDel(1);
|
|
|
result.setPatient(patientId);
|
|
|
result.setCardNo(idCard);
|
|
|
result.setCardType(cardType);
|
|
|
result.setMobile(phoneNum);
|
|
|
//保存到base_patient表
|
|
|
basePatientDO.setName(familyName);
|
|
|
basePatientDO.setIdcard(idCard);
|
|
|
basePatientDO.setRegister("0");
|
|
|
basePatientDO.setEnabled(1);
|
|
|
basePatientDO.setDel("1");
|
|
|
|
|
|
BasePatientDO sucessPatient= basePatientDao.save(basePatientDO);
|
|
|
String patientNewId= "";
|
|
|
if (sucessPatient!=null){
|
|
|
patientNewId=sucessPatient.getId();
|
|
|
}
|
|
|
result.setFamilyMember(patientNewId);
|
|
|
wlyyPatientFamilyMemberDao.save(result);
|
|
|
if (!"xm_xzzx_wx".equalsIgnoreCase(wxId)){
|
|
|
if (patientMappingDO!=null){
|
|
|
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);
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
if (StringUtils.isNotBlank(clinicId)){
|
|
|
PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_02",sucessPatient.getId(),"1");
|
|
|
if (patientMedicareCardDO==null){
|
|
|
patientMedicareCardDO = new PatientMedicareCardDO();
|
|
|
}
|
|
|
patientMedicareCardDO.setCode(clinicId);
|
|
|
//patientMedicareCardDO.setType(medicareType);
|
|
|
patientMedicareCardDO.setPatientCode(patientNewId);
|
|
|
patientMedicareCardDO.setDel("1");
|
|
|
patientMedicareCardDO.setParentType("A");
|
|
|
patientMedicareCardDO.setType("A_02");
|
|
|
basePatientMedicareCardDao.save(patientMedicareCardDO);
|
|
|
|
|
|
}
|
|
|
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);
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
if (StringUtils.isNotBlank(clinicId)){
|
|
|
PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_02",sucessPatient.getId(),"1");
|
|
|
if (patientMedicareCardDO==null){
|
|
|
patientMedicareCardDO = new PatientMedicareCardDO();
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(medicare)){
|
|
|
//PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByCode(medicare);
|
|
|
PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",sucessPatient.getId(),"1");
|
|
|
if (patientMedicareCardDO==null){
|
|
|
patientMedicareCardDO = new PatientMedicareCardDO();
|
|
|
}
|
|
|
patientMedicareCardDO.setCode(medicare);
|
|
|
//patientMedicareCardDO.setType(medicareType);
|
|
|
patientMedicareCardDO.setPatientCode(patientNewId);
|
|
|
patientMedicareCardDO.setDel("1");
|
|
|
patientMedicareCardDO.setParentType("A");
|
|
|
patientMedicareCardDO.setType("A_01");
|
|
|
basePatientMedicareCardDao.save(patientMedicareCardDO);
|
|
|
patientMedicareCardDO.setCode(clinicId);
|
|
|
//patientMedicareCardDO.setType(medicareType);
|
|
|
patientMedicareCardDO.setPatientCode(patientNewId);
|
|
|
patientMedicareCardDO.setDel("1");
|
|
|
patientMedicareCardDO.setParentType("A");
|
|
|
patientMedicareCardDO.setType("A_02");
|
|
|
basePatientMedicareCardDao.save(patientMedicareCardDO);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(medicare)){
|
|
|
//PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByCode(medicare);
|
|
|
PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",sucessPatient.getId(),"1");
|
|
|
if (patientMedicareCardDO==null){
|
|
|
patientMedicareCardDO = new PatientMedicareCardDO();
|
|
|
}
|
|
|
|
|
|
patientMedicareCardDO.setCode(medicare);
|
|
|
//patientMedicareCardDO.setType(medicareType);
|
|
|
patientMedicareCardDO.setPatientCode(patientNewId);
|
|
|
patientMedicareCardDO.setDel("1");
|
|
|
patientMedicareCardDO.setParentType("A");
|
|
|
patientMedicareCardDO.setType("A_01");
|
|
|
basePatientMedicareCardDao.save(patientMedicareCardDO);
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("添加失败");
|
|
|
}
|
|
|
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
//眼科同步家人信息
|