|
@ -4,19 +4,23 @@ package com.yihu.jw.hospital.prescription.service;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
|
|
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
|
|
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
|
|
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
|
|
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
|
|
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
|
|
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
|
|
import com.yihu.jw.entity.hospital.prescription.BaseNatAppointmentDO;
|
|
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
|
|
|
|
|
|
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
|
|
|
|
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
|
|
|
|
import com.yihu.jw.entity.hospital.prescription.*;
|
|
import com.yihu.jw.entity.order.BusinessOrderDO;
|
|
import com.yihu.jw.entity.order.BusinessOrderDO;
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
import com.yihu.jw.hospital.prescription.dao.BaseNatAppointmentDao;
|
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
|
|
|
|
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
|
|
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
|
|
import com.yihu.jw.hospital.prescription.dao.*;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
|
|
import com.yihu.jw.mysql.query.BaseJpaService;
|
|
import com.yihu.jw.mysql.query.BaseJpaService;
|
|
import com.yihu.jw.order.dao.BusinessOrderDao;
|
|
import com.yihu.jw.order.dao.BusinessOrderDao;
|
|
@ -25,6 +29,8 @@ import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
|
|
import com.yihu.jw.restmodel.hospital.prescription.*;
|
|
import com.yihu.jw.restmodel.hospital.prescription.*;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
|
|
import com.yihu.jw.util.network.HttpResponse;
|
|
|
|
import com.yihu.jw.util.network.HttpUtils;
|
|
import com.yihu.jw.utils.WebserviceUtil;
|
|
import com.yihu.jw.utils.WebserviceUtil;
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
|
|
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
|
|
@ -52,6 +58,23 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
private BasePatientDao patientDao;
|
|
private BasePatientDao patientDao;
|
|
@Autowired
|
|
@Autowired
|
|
private BasePatientMedicareCardDao patientMedicareCardDao;
|
|
private BasePatientMedicareCardDao patientMedicareCardDao;
|
|
|
|
@Autowired
|
|
|
|
private PatientMappingDao patientMappingDao;
|
|
|
|
@Autowired
|
|
|
|
private OutpatientDao outpatientDao;
|
|
|
|
@Autowired
|
|
|
|
private PrescriptionExpressageDao prescriptionExpressageDao;
|
|
|
|
@Autowired
|
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
|
@Autowired
|
|
|
|
private DoctorMappingDao doctorMappingDao;
|
|
|
|
@Autowired
|
|
|
|
private PatientRegisterDao patientRegisterDao;
|
|
|
|
@Autowired
|
|
|
|
private WlyyHttpLogDao wlyyHttpLogDao;
|
|
|
|
|
|
|
|
//请求内网服务
|
|
|
|
public static String entranceUrl = "http://192.168.101.2:10024/dsyy/";
|
|
//=============查询视图========================
|
|
//=============查询视图========================
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -78,6 +101,7 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
return str;
|
|
return str;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取门诊下所有处方信息
|
|
* 获取门诊下所有处方信息
|
|
* @param registerSn 流水号
|
|
* @param registerSn 流水号
|
|
@ -310,4 +334,385 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
public JSONArray getDrugUse(String pydm) throws Exception {
|
|
public JSONArray getDrugUse(String pydm) throws Exception {
|
|
return dsyyEntranceService.getDrugUse(pydm);
|
|
return dsyyEntranceService.getDrugUse(pydm);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//========================调用内网服务开始=========================
|
|
|
|
/**
|
|
|
|
* 挂号--调用内网服务
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public JSONObject register(String doctor,String dept,String sickId,String clinicclass,String courierflag) throws Exception {
|
|
|
|
String url = entranceUrl +"registered";
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
|
params.put("doctor",doctor);
|
|
|
|
params.put("dept",dept);
|
|
|
|
params.put("sickId",sickId);
|
|
|
|
params.put("clinicclass",clinicclass);
|
|
|
|
params.put("courierflag",courierflag);
|
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
|
String content = response.getContent();
|
|
|
|
logger.info("response:"+content);
|
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
|
Integer status = rs.getInteger("status");
|
|
|
|
if (status==200){
|
|
|
|
object = rs.getJSONObject("obj");
|
|
|
|
}
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 退号--调用内网服务
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public JSONObject refundConsultation(String applyNo,String PayCardNo) throws Exception {
|
|
|
|
String url = entranceUrl +"refundConsultation";
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
|
params.put("applyNo",applyNo);
|
|
|
|
params.put("PayCardNo",PayCardNo);
|
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
|
String content = response.getContent();
|
|
|
|
logger.info("response:"+content);
|
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
|
Integer status = rs.getInteger("status");
|
|
|
|
if (status==200){
|
|
|
|
object = rs.getJSONObject("obj");
|
|
|
|
}
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 互联网医院开处方信息更新到his ---调用内网服务
|
|
|
|
*
|
|
|
|
* @param IoFlag 门诊住院标志
|
|
|
|
* @param PayCardNo 就诊卡号
|
|
|
|
* @param NullahNumber 挂号流水号
|
|
|
|
* @param ApplyDept 执行科室
|
|
|
|
* @param ApplyDoctor 开单医生
|
|
|
|
* @param ExecuteDept 执行科室(药房)
|
|
|
|
* @param infoJson 药品列表
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public JSONObject savePrescriptionToHospital(String IoFlag,String PayCardNo,String NullahNumber,String ApplyDept,String ApplyDoctor,String ExecuteDept,List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS) throws Exception {
|
|
|
|
String url = entranceUrl +"savePrescriptionToHospital";
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
|
params.put("IoFlag",IoFlag);
|
|
|
|
params.put("PayCardNo",PayCardNo);
|
|
|
|
params.put("NullahNumber",NullahNumber);
|
|
|
|
params.put("ApplyDept",ApplyDept);
|
|
|
|
params.put("ApplyDoctor",ApplyDoctor);
|
|
|
|
params.put("ExecuteDept",ExecuteDept);
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
for (WlyyPrescriptionInfoDO prescriptionInfoDO:wlyyPrescriptionInfoDOS){
|
|
|
|
array.add(prescriptionInfoDO);
|
|
|
|
}
|
|
|
|
params.put("infoJson",array.toJSONString());
|
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
|
String content = response.getContent();
|
|
|
|
logger.info("response:"+content);
|
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
|
Integer status = rs.getInteger("status");
|
|
|
|
if (status==200){
|
|
|
|
object = rs.getJSONObject("obj");
|
|
|
|
}
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* 作废处方 ---调用内网服务
|
|
|
|
*
|
|
|
|
* @param IoFlag 门诊住院标志
|
|
|
|
* @param PayCardNo 就诊卡号
|
|
|
|
* @param NullahNumber 挂号流水号
|
|
|
|
* @param ApplyDept 执行科室
|
|
|
|
* @param ApplyDoctor 开单医生
|
|
|
|
* @param ExecuteDept 执行科室(药房)
|
|
|
|
* @param PresNo 必填,医嘱号
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public JSONObject delHisPrescriptionByHisNo(String IoFlag,String PayCardNo,String NullahNumber,String ApplyDept,String ApplyDoctor,String ExecuteDept,String PresNo) throws Exception {
|
|
|
|
String url = entranceUrl +"delHisPrescriptionByHisNo";
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
|
params.put("IoFlag",IoFlag);
|
|
|
|
params.put("PayCardNo",PayCardNo);
|
|
|
|
params.put("NullahNumber",NullahNumber);
|
|
|
|
params.put("ApplyDept",ApplyDept);
|
|
|
|
params.put("ApplyDoctor",ApplyDoctor);
|
|
|
|
params.put("ExecuteDept",ExecuteDept);
|
|
|
|
params.put("PresNo",PresNo);
|
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
|
String content = response.getContent();
|
|
|
|
logger.info("response:"+content);
|
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
|
Integer status = rs.getInteger("status");
|
|
|
|
if (status==200){
|
|
|
|
object = rs.getJSONObject("obj");
|
|
|
|
}
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 保存诊断
|
|
|
|
* @param applyNo 挂号号
|
|
|
|
* @param DiagnosisName 诊断名称
|
|
|
|
* @param DiagnosisCode 诊断编码
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public JSONObject saveDiagnosis(String applyNo,String DiagnosisName,String DiagnosisCode) throws Exception {
|
|
|
|
String url = entranceUrl +"saveDiagnosis";
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
|
params.put("applyNo",applyNo);
|
|
|
|
params.put("DiagnosisName",DiagnosisName);
|
|
|
|
params.put("DiagnosisCode",DiagnosisCode);
|
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
|
String content = response.getContent();
|
|
|
|
logger.info("response:"+content);
|
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
|
Integer status = rs.getInteger("status");
|
|
|
|
if (status==200){
|
|
|
|
object = rs.getJSONObject("obj");
|
|
|
|
}
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 组装检查检验项目参数到his ---调用内网服务
|
|
|
|
*
|
|
|
|
* @param IoFlag 门诊住院标志
|
|
|
|
* @param PayCardNo 就诊卡号
|
|
|
|
* @param NullahNumber 挂号流水号
|
|
|
|
* @param ApplyDept 执行科室
|
|
|
|
* @param ApplyDoctor 开单医生
|
|
|
|
* @param inspectJson 检查项目
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public JSONObject saveInspectToHospital(String IoFlag,String PayCardNo,String NullahNumber,String ApplyDept,String ApplyDoctor,String inspectJson) throws Exception {
|
|
|
|
String url = entranceUrl +"saveInspectToHospital";
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
|
params.put("IoFlag",IoFlag);
|
|
|
|
params.put("PayCardNo",PayCardNo);
|
|
|
|
params.put("NullahNumber",NullahNumber);
|
|
|
|
params.put("ApplyDept",ApplyDept);
|
|
|
|
params.put("ApplyDoctor",ApplyDoctor);
|
|
|
|
params.put("inspectJson",inspectJson);
|
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
|
String content = response.getContent();
|
|
|
|
logger.info("response:"+content);
|
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
|
Integer status = rs.getInteger("status");
|
|
|
|
if (status==200){
|
|
|
|
object = rs.getJSONObject("obj");
|
|
|
|
}
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
//========================调用内网服务结束===================
|
|
|
|
|
|
|
|
//============================业务服务调用================================
|
|
|
|
/**
|
|
|
|
* 挂号接口
|
|
|
|
* @param outPatientId
|
|
|
|
* @param doctor
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public JSONObject registerOutPatient(String outPatientId, String doctor){
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId).orElse(null);
|
|
|
|
List<WlyyPrescriptionExpressageDO> expressageDOS =prescriptionExpressageDao.findByOutpatientId(outPatientId);
|
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
|
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findByIdAndDel(doctor);
|
|
|
|
if (doctorMappingDO == null) {
|
|
|
|
throw new RuntimeException("未找到医生映射信息");
|
|
|
|
}
|
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
|
|
|
|
if (patientMappingDO==null){
|
|
|
|
throw new RuntimeException("未找到居民映射信息");
|
|
|
|
}
|
|
|
|
|
|
|
|
//查找居民当天挂号记录
|
|
|
|
String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
|
|
|
|
List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctorAndDel(outpatientDO.getPatient(), date, doctor,1);
|
|
|
|
if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
|
|
|
|
WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
|
|
|
|
//判断是否已经挂号,如果已经挂号
|
|
|
|
if (StringUtils.isNotBlank(registerDO.getRegisterNo())) {
|
|
|
|
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
res.put("@RESULT", "0");
|
|
|
|
logger.info("已经挂号 res: " + res.toString());
|
|
|
|
|
|
|
|
//更新挂号流水号
|
|
|
|
outpatientDO.setConNo(registerDO.getConNo());
|
|
|
|
outpatientDO.setRegisterNo(registerDO.getRegisterNo());
|
|
|
|
outpatientDO.setAdmDate(registerDO.getCreateTime());
|
|
|
|
outpatientDO.setAdmNo(registerDO.getRegisterNo());
|
|
|
|
outpatientDao.save(outpatientDO);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String doctorFlag = doctorMappingDO.getDoctorName()+"/"+doctorMappingDO.getMappingCode();
|
|
|
|
String courierflag = "N";
|
|
|
|
if (expressageDOS!=null&&expressageDOS.size()!=0){
|
|
|
|
WlyyPrescriptionExpressageDO expressageDO = expressageDOS.get(0);
|
|
|
|
if (expressageDO.getOneselfPickupFlg()!=null&&expressageDO.getOneselfPickupFlg()==1){
|
|
|
|
courierflag="N";
|
|
|
|
}else if (expressageDO.getOneselfPickupFlg()!=null&&expressageDO.getOneselfPickupFlg()==0){
|
|
|
|
courierflag="Y";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String chargeType = "";
|
|
|
|
if ("1".equalsIgnoreCase(outpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(outpatientDO.getType())){
|
|
|
|
chargeType = doctorDO.getTwfzChargeType();
|
|
|
|
}else if ("1".equalsIgnoreCase(outpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(outpatientDO.getType())){
|
|
|
|
chargeType = doctorDO.getSpfzChargeType();
|
|
|
|
}else if ("3".equalsIgnoreCase(outpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(outpatientDO.getType())){
|
|
|
|
chargeType = doctorDO.getTwzxChargeType();
|
|
|
|
}else if ("3".equalsIgnoreCase(outpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(outpatientDO.getType())){
|
|
|
|
chargeType = doctorDO.getSpzxChargeType();
|
|
|
|
}else if ("3".equalsIgnoreCase(outpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(outpatientDO.getType())){
|
|
|
|
chargeType = doctorDO.getJyzxChargeType();
|
|
|
|
}else if ("2".equalsIgnoreCase(outpatientDO.getOutpatientType())){
|
|
|
|
chargeType = doctorDO.getXtfzChargeType();
|
|
|
|
}else {
|
|
|
|
chargeType = doctorDO.getChargeType();
|
|
|
|
}
|
|
|
|
JSONObject res = null;
|
|
|
|
try {
|
|
|
|
res = register(doctorFlag,outpatientDO.getDept(),patientMappingDO.getMappingCode(),chargeType,courierflag);
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
logger.info("挂号结果 res: " + res.toString());
|
|
|
|
String rsCode = "";
|
|
|
|
String serialNo = "";
|
|
|
|
if (res!=null){
|
|
|
|
JSONObject object = res.getJSONObject("returnContents");
|
|
|
|
serialNo = object.getString("registerNo");
|
|
|
|
if (object!=null){
|
|
|
|
result.put("@RESULT", "0");
|
|
|
|
result.put("@MSG","挂号成功!");
|
|
|
|
rsCode = object.getString("registerNo");
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
result.put("@RESULT", "-1");
|
|
|
|
result.put("@MSG","挂号失败");
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(rsCode)) {
|
|
|
|
//存储挂号号
|
|
|
|
|
|
|
|
outpatientDO.setRegisterNo(serialNo);
|
|
|
|
outpatientDO.setAdmDate(new Date());
|
|
|
|
outpatientDO.setAdmNo(serialNo);
|
|
|
|
logger.info("挂号流水 registerNo: ");
|
|
|
|
outpatientDao.save(outpatientDO);
|
|
|
|
|
|
|
|
//存储就诊记录
|
|
|
|
WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
|
|
|
|
// 存储挂号医生与挂号科室
|
|
|
|
registerDO.setDoctor(outpatientDO.getDoctor());
|
|
|
|
registerDO.setDoctorName(outpatientDO.getDoctorName());
|
|
|
|
registerDO.setDept(outpatientDO.getDept());
|
|
|
|
registerDO.setDeptName(outpatientDO.getDeptName());
|
|
|
|
registerDO.setDel(1);
|
|
|
|
|
|
|
|
registerDO.setPatient(outpatientDO.getPatient());
|
|
|
|
registerDO.setPatientName(outpatientDO.getPatientName());
|
|
|
|
//挂号流水号与挂号次数
|
|
|
|
registerDO.setRegisterNo(serialNo);
|
|
|
|
registerDO.setCreateTime(new Date());
|
|
|
|
registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
|
|
|
|
patientRegisterDao.save(registerDO);
|
|
|
|
|
|
|
|
} else if ("-2".equals(rsCode)) {
|
|
|
|
|
|
|
|
outpatientDO.setRegisterNo(serialNo);
|
|
|
|
outpatientDO.setAdmDate(new Date());
|
|
|
|
outpatientDO.setAdmNo(serialNo);
|
|
|
|
logger.info("挂号流水 registerNo: " + serialNo );
|
|
|
|
outpatientDao.save(outpatientDO);
|
|
|
|
|
|
|
|
//存储就诊记录
|
|
|
|
WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
|
|
|
|
|
|
|
|
registerDO.setDoctor(outpatientDO.getDoctor());
|
|
|
|
registerDO.setDoctorName(outpatientDO.getDoctorName());
|
|
|
|
registerDO.setDept(outpatientDO.getDept());
|
|
|
|
registerDO.setDeptName(outpatientDO.getDeptName());
|
|
|
|
registerDO.setDel(1);
|
|
|
|
|
|
|
|
registerDO.setPatient(outpatientDO.getPatient());
|
|
|
|
registerDO.setPatientName(outpatientDO.getPatientName());
|
|
|
|
registerDO.setRegisterNo(serialNo);
|
|
|
|
registerDO.setCreateTime(new Date());
|
|
|
|
registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
|
|
|
|
|
|
|
|
patientRegisterDao.save(registerDO);
|
|
|
|
|
|
|
|
}
|
|
|
|
//保存日志
|
|
|
|
WlyyHttpLogDO log = new WlyyHttpLogDO();
|
|
|
|
log.setCode("registerOutPatient");
|
|
|
|
log.setName("挂号");
|
|
|
|
log.setPatient(outpatientDO.getPatient());
|
|
|
|
log.setDoctor(doctor);
|
|
|
|
log.setResponse(res.toString());
|
|
|
|
log.setRequest("outPatientId=" + outPatientId + "&doctor=" + doctor);
|
|
|
|
log.setStatus("1");
|
|
|
|
log.setCreateTime(new Date());
|
|
|
|
wlyyHttpLogDao.save(log);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 退号
|
|
|
|
* @param outpatientId
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public JSONObject refundRegisterNo(String outpatientId) throws Exception {
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId).orElse(null);
|
|
|
|
if(outpatientDO!=null){
|
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(outpatientDO.getDoctor());
|
|
|
|
if (StringUtils.isNoneBlank(outpatientDO.getRegisterNo())){
|
|
|
|
object = refundConsultation(outpatientDO.getRegisterNo(), outpatientDO.getCardNo());
|
|
|
|
logger.info("退号结果 res: " + object.toString());
|
|
|
|
if (object!=null&&object.getString("code").equalsIgnoreCase("0")){
|
|
|
|
WlyyPatientRegisterDO wlyyPatientRegisterDO = patientRegisterDao.findByRegisterNo(outpatientDO.getRegisterNo());
|
|
|
|
wlyyPatientRegisterDO.setDel(0);
|
|
|
|
patientRegisterDao.save(wlyyPatientRegisterDO);
|
|
|
|
outpatientDO.setHisStatus(-1);
|
|
|
|
outpatientDao.save(outpatientDO);
|
|
|
|
}
|
|
|
|
//保存日志
|
|
|
|
WlyyHttpLogDO log = new WlyyHttpLogDO();
|
|
|
|
log.setCode("refundregisterOutPatient");
|
|
|
|
log.setName("退号");
|
|
|
|
log.setPatient(outpatientDO.getPatient());
|
|
|
|
log.setDoctor(outpatientDO.getDoctor());
|
|
|
|
log.setResponse(object.toString());
|
|
|
|
log.setRequest("outPatientId=" + outpatientId + "&doctor=" + outpatientDO.getDoctor());
|
|
|
|
log.setStatus(object.getString("code"));
|
|
|
|
log.setCreateTime(new Date());
|
|
|
|
wlyyHttpLogDao.save(log);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return object;
|
|
|
|
}
|
|
}
|
|
}
|