|
@ -177,6 +177,43 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
return mappingCode;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存患者hisid
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public PatientMappingDO selectPatientMapping(String patient,String cardNo) throws Exception {
|
|
|
BasePatientDO patientDO = patientDao.findById(patient);
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
String mappingCode="";
|
|
|
String obj =hcyyEntranceService.findPatientCard(patient);
|
|
|
if (StringUtils.isNoneBlank(obj)){
|
|
|
JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
|
|
|
if (array!=null&&array.size()!=0){
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
JSONObject object1 = array.getJSONObject(i);
|
|
|
String CARD_NO = object1.getString("CARD_NO");
|
|
|
if (cardNo.equalsIgnoreCase(CARD_NO)){
|
|
|
if (patientMappingDO==null){
|
|
|
patientMappingDO = new PatientMappingDO();
|
|
|
patientMappingDO.setIdcard(patientDO.getIdcard());
|
|
|
patientMappingDO.setPatientName(patientDO.getName());
|
|
|
patientMappingDO.setPatient(patientDO.getId());
|
|
|
patientMappingDO.setCreateTime(new Date());
|
|
|
patientMappingDO.setSource("1");
|
|
|
patientMappingDO.setMappingCode(object1.getString("SICKID"));
|
|
|
}else {
|
|
|
patientMappingDO.setMappingCode(object1.getString("SICKID"));
|
|
|
}
|
|
|
mappingCode=object1.getString("SICKID");
|
|
|
patientMappingDO = patientMappingDao.save(patientMappingDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return patientMappingDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新患者hisid
|
|
|
* @param patient
|
|
@ -1125,7 +1162,7 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
* @param doctor flag 0自费1医保
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject registerOutPatient(String outPatientId, String doctor){
|
|
|
public JSONObject registerOutPatient(String outPatientId, String doctor) throws Exception {
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outPatientId);
|
|
|
List<WlyyPrescriptionExpressageDO> expressageDOS =prescriptionExpressageDao.findByOutpatientId(outPatientId);
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
|
|
@ -1133,7 +1170,8 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
if (doctorMappingDO == null) {
|
|
|
throw new RuntimeException("未找到医生映射信息");
|
|
|
}
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
|
|
|
|
|
|
PatientMappingDO patientMappingDO = selectPatientMapping(outpatientDO.getPatient(),outpatientDO.getCardNo());
|
|
|
if (patientMappingDO==null){
|
|
|
throw new RuntimeException("未找到居民映射信息");
|
|
|
}
|
|
@ -1186,19 +1224,22 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
chargeType = doctorDO.getChargeType();
|
|
|
}
|
|
|
JSONObject res = null;
|
|
|
String message = "挂号失败";
|
|
|
try {
|
|
|
String obj = hcyyEntranceService.registered(doctorFlag,outpatientDO.getDept(),patientMappingDO.getMappingCode(),chargeType,courierflag,outpatientDO.getMedicalState());
|
|
|
if (StringUtils.isNoneBlank(obj)){
|
|
|
if (obj.contains("error")){
|
|
|
message = obj;
|
|
|
}else if (StringUtils.isNoneBlank(obj)){
|
|
|
res = JSONObject.parseObject(obj);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
JSONObject result = new JSONObject();
|
|
|
logger.info("挂号结果 res: " + res.toString());
|
|
|
String rsCode = "";
|
|
|
String serialNo = "";
|
|
|
if (res!=null){
|
|
|
logger.info("挂号结果 res: " + res.toString());
|
|
|
JSONObject object = res.getJSONObject("returnContents");
|
|
|
serialNo = object.getString("registerNo");
|
|
|
if (object!=null){
|
|
@ -1208,7 +1249,7 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
}
|
|
|
}else {
|
|
|
result.put("@RESULT", "-1");
|
|
|
result.put("@MSG","挂号失败");
|
|
|
result.put("@MSG",message);
|
|
|
}
|
|
|
|
|
|
|
|
@ -1270,7 +1311,11 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
log.setName("挂号");
|
|
|
log.setPatient(outpatientDO.getPatient());
|
|
|
log.setDoctor(doctor);
|
|
|
log.setResponse(res.toString());
|
|
|
if (res!=null){
|
|
|
log.setResponse(res.toString());
|
|
|
}else {
|
|
|
log.setResponse(message);
|
|
|
}
|
|
|
log.setRequest("outPatientId=" + outPatientId + "&doctor=" + doctor);
|
|
|
log.setStatus("1");
|
|
|
log.setCreateTime(new Date());
|