|
|
|
@ -213,7 +213,6 @@ public class PmsPatientServiceImpl implements IPmsPatientService { |
|
|
|
// // Map转JSONObject
|
|
|
|
// jsonObject = (JSONObject) JSON.toJSON(model);
|
|
|
|
// }
|
|
|
|
<<<<<<< HEAD |
|
|
|
//
|
|
|
|
// //验证就诊号是否为空
|
|
|
|
// String visitNo = jsonObject.getString("outpatientNo");
|
|
|
|
@ -221,112 +220,6 @@ public class PmsPatientServiceImpl implements IPmsPatientService { |
|
|
|
// visitNo = jsonObject.getString("visitNo");
|
|
|
|
// if (StrUtil.isEmpty(visitNo)) {
|
|
|
|
// throw new ServiceException("就诊号不能为空");
|
|
|
|
======= |
|
|
|
//验证就诊号是否为空
|
|
|
|
String visitNo = jsonObject.getString("outpatientNo"); |
|
|
|
if (StrUtil.isEmpty(visitNo)) { |
|
|
|
visitNo = jsonObject.getString("visitNo"); |
|
|
|
if (StrUtil.isEmpty(visitNo)) { |
|
|
|
throw new ServiceException("就诊号不能为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
//验证患者id是否为空
|
|
|
|
Long patientId = jsonObject.getLong("patientId"); |
|
|
|
if (patientId == null) { |
|
|
|
throw new ServiceException("患者id不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//如果是就诊信息(PmsPatientBody)
|
|
|
|
if ("PmsPatientBody".equals(param.getEditType())) { |
|
|
|
//就诊信息默认是单个信息,直接用jsonObject
|
|
|
|
PmsPatientBody pmsPatientBody = JSONObject.parseObject(jsonObject.toJSONString(), PmsPatientBody.class); |
|
|
|
//根据就诊号和患者id查询就诊信息是否存在
|
|
|
|
PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample(); |
|
|
|
patientBodyExample.createCriteria().andOutpatientNoEqualTo(visitNo).andPatientIdEqualTo(patientId) |
|
|
|
.andDelFlagEqualTo((byte) 0); |
|
|
|
List<PmsPatientBody> pmsPatientBodies = pmsPatientBodyMapper.selectByExample(patientBodyExample); |
|
|
|
if (CollUtil.isNotEmpty(pmsPatientBodies)) { |
|
|
|
//存在则修改
|
|
|
|
PmsPatientBody oldPatientBody = pmsPatientBodies.get(0); |
|
|
|
pmsPatientBody.setId(oldPatientBody.getId()); |
|
|
|
pmsPatientBodyMapper.updateByPrimaryKeySelective(pmsPatientBody); |
|
|
|
} else { |
|
|
|
//不存在则添加
|
|
|
|
pmsPatientBody.setId(IDGenerator.nextSnowflakeId()); |
|
|
|
pmsPatientBodyMapper.insertSelective(pmsPatientBody); |
|
|
|
} |
|
|
|
} else if ("PmsPatientPersonal".equals(param.getEditType())) { |
|
|
|
//烟酒史默认是单个信息,直接用jsonObject
|
|
|
|
//烟酒史
|
|
|
|
PmsPatientPersonal pmsPatientPersonal = JSONObject.parseObject(jsonObject.toJSONString(), PmsPatientPersonal.class); |
|
|
|
//根据就诊号和患者id查询就诊信息是否存在
|
|
|
|
PmsPatientPersonalExample patientPersonalExample = new PmsPatientPersonalExample(); |
|
|
|
patientPersonalExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(patientId) |
|
|
|
.andDelFlagEqualTo((byte) 0); |
|
|
|
List<PmsPatientPersonal> pmsPatientPersonals = pmsPatientPersonalMapper.selectByExample(patientPersonalExample); |
|
|
|
if (CollUtil.isNotEmpty(pmsPatientPersonals)) { |
|
|
|
//存在则修改
|
|
|
|
PmsPatientPersonal oldPatientPersonal = pmsPatientPersonals.get(0); |
|
|
|
pmsPatientPersonal.setId(oldPatientPersonal.getId()); |
|
|
|
pmsPatientPersonalMapper.updateByPrimaryKeySelective(pmsPatientPersonal); |
|
|
|
} else { |
|
|
|
//不存在则添加
|
|
|
|
pmsPatientPersonal.setId(IDGenerator.nextSnowflakeId()); |
|
|
|
pmsPatientPersonalMapper.insertSelective(pmsPatientPersonal); |
|
|
|
} |
|
|
|
} else if ("PmsPatientParentIllness".equals(param.getEditType())) { |
|
|
|
//根据就诊号和患者id删除旧的用药信息(修改删除状态)
|
|
|
|
PmsPatientParentIllnessExample patientParentIllnessExample = new PmsPatientParentIllnessExample(); |
|
|
|
patientParentIllnessExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(patientId) |
|
|
|
.andDelFlagEqualTo((byte) 0); |
|
|
|
PmsPatientParentIllness illness = new PmsPatientParentIllness(); |
|
|
|
illness.setDelFlag((byte) 1); |
|
|
|
pmsPatientParentIllnessMapper.updateByExampleSelective(illness, patientParentIllnessExample); |
|
|
|
//诊断用药为多个
|
|
|
|
com.alibaba.fastjson2.JSONArray array = (com.alibaba.fastjson2.JSONArray) JSON.toJSON(model); |
|
|
|
for (int i = 0; i < array.size(); i++) { |
|
|
|
PmsPatientParentIllness pmsPatientParentIllness = JSONObject.parseObject(array.getJSONObject(i).toJSONString(), PmsPatientParentIllness.class); |
|
|
|
pmsPatientParentIllness.setId(IDGenerator.nextSnowflakeId()); |
|
|
|
pmsPatientParentIllnessMapper.insertSelective(pmsPatientParentIllness); |
|
|
|
} |
|
|
|
} else if ("PmsPatientDiagnosis".equals(param.getEditType())) { |
|
|
|
//删除旧的诊断信息(修改删除状态)
|
|
|
|
PmsPatientDiagnosisExample patientDiagnosisExample = new PmsPatientDiagnosisExample(); |
|
|
|
patientDiagnosisExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(patientId) |
|
|
|
.andDelFlagEqualTo((byte) 0); |
|
|
|
PmsPatientDiagnosis diagnosis = new PmsPatientDiagnosis(); |
|
|
|
diagnosis.setDelFlag((byte) 1); |
|
|
|
pmsPatientDiagnosisMapper.updateByExampleSelective(diagnosis, patientDiagnosisExample); |
|
|
|
//诊断默认是多个信息,用jsonArray
|
|
|
|
com.alibaba.fastjson2.JSONArray array = (com.alibaba.fastjson2.JSONArray) JSON.toJSON(model); |
|
|
|
for (int i = 0; i < array.size(); i++) { |
|
|
|
PmsPatientDiagnosis pmsPatientDiagnosis = JSONObject.parseObject(array.getJSONObject(i).toJSONString(), PmsPatientDiagnosis.class); |
|
|
|
pmsPatientDiagnosis.setId(IDGenerator.nextSnowflakeId()); |
|
|
|
pmsPatientDiagnosisMapper.insertSelective(pmsPatientDiagnosis); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// try {
|
|
|
|
// String type = param.getEditType();
|
|
|
|
// JSONObject json = param.getModel();
|
|
|
|
// Object bean = SpringContextUtils.getBean(type.substring(0, 1).toLowerCase() + type.substring(1) + "Mapper");
|
|
|
|
// //有id则修改,无则添加
|
|
|
|
// String methodName;
|
|
|
|
// String id = "id";
|
|
|
|
// String createBy = "createBy";
|
|
|
|
// String updateBy = "updateBy";
|
|
|
|
// String recorder = "recorder";
|
|
|
|
// if (json.getLong(id) == null || json.getLong(id) == 0) {
|
|
|
|
// methodName = "insertSelective";
|
|
|
|
// json.put(id, IDGenerator.nextSnowflakeId());
|
|
|
|
// json.put(createBy, SecurityUtils.getUsername());
|
|
|
|
// json.put(recorder, SecurityUtils.getUserId());
|
|
|
|
// } else {
|
|
|
|
// methodName = "updateByPrimaryKeySelective";
|
|
|
|
// json.put(updateBy, SecurityUtils.getUsername());
|
|
|
|
>>>>>>> 7f1337fe87bf2c423681022fdc02c6f2c702adc1 |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// //验证患者id是否为空
|
|
|
|
|