|
@ -1198,8 +1198,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
|
|
|
logger.info("心脏中心同步患者开始");
|
|
|
xzzxEntranceService.updatePatientMapping(outpatient.getConsumer(),outpatient.getCardNo());
|
|
|
xzzxEntranceService.updatePatientMapping(outpatient.getPatient(),outpatient.getCardNo());
|
|
|
logger.info("同步患者id成功");
|
|
|
}else if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
|
|
|
logger.info("眼科中心患者档案查询");
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatient.getPatient());
|
|
|
if (patientMappingDO==null){
|
|
|
throw new Exception("您的信息在院内无档案,请确认就诊人信息,并重新保存就诊人信息!");
|
|
|
}
|
|
|
logger.info("眼科中心患者档案查询");
|
|
|
}
|
|
|
|
|
|
|
|
@ -6821,14 +6828,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
if (flag){
|
|
|
sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort;
|
|
|
sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+",dw.workTotal DESC";
|
|
|
}else{
|
|
|
sql += " and d.del='1' order by d.consult_status desc nulls last ,evaluate.score desc nulls last ,a.total " + consutlSort;
|
|
|
sql+=" NULLS LAST,\n" +
|
|
|
"\tD.id DESC";
|
|
|
"\tD.id DESC,dw.workTotal DESC NULLS LAST";
|
|
|
}
|
|
|
}else {
|
|
|
sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort;
|
|
|
sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+"";
|
|
|
}
|
|
|
String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t";
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize);
|
|
@ -9765,6 +9772,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
try {
|
|
|
if (object!=null){
|
|
|
if (object.getString("code").equalsIgnoreCase("0")){
|
|
|
if (healthCareService.isHospitalFlag()){
|
|
|
healthCareService.doctorPrescriptionUploadEntrance(prescriptionId);
|
|
|
}
|
|
|
// * @param applyDepaName @param applyDoctorName
|
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
String patientCode = outpatientDO.getConsumer();
|
|
@ -12209,22 +12219,34 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
Map<String,Object> map = findRandomDoctor();
|
|
|
net.sf.json.JSONObject rs = new JSONObject();
|
|
|
if (map!=null){
|
|
|
//先进行核算检测预约
|
|
|
String result = entranceService.BS10144("3150000","0001",natTime,mediaCard,name,cardNo,mobile,pm,demoFlag);
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
|
|
|
logger.info("核酸检测预约结束"+result);
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("natTimeConfig");
|
|
|
String isOpen = null;
|
|
|
if (hospitalSysDictDO!=null){
|
|
|
String dictValue = hospitalSysDictDO.getDictValue();
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(dictValue);
|
|
|
isOpen = jsonObject.getString("isOpen");
|
|
|
}
|
|
|
Boolean flag = false;
|
|
|
if (object!=null){
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = object.getJSONObject("MsgInfo");
|
|
|
String Msg = jsonObject.getString("Msg");
|
|
|
if (Msg.contains("Error")){
|
|
|
if (isOpen!=null&&isOpen.equalsIgnoreCase("0")){
|
|
|
//先进行核算检测预约
|
|
|
String result = entranceService.BS10144("3150000","0001",natTime,mediaCard,name,cardNo,mobile,pm,demoFlag);
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
|
|
|
logger.info("核酸检测预约结束"+result);
|
|
|
if (object!=null){
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = object.getJSONObject("MsgInfo");
|
|
|
String Msg = jsonObject.getString("Msg");
|
|
|
if (Msg.contains("Error")){
|
|
|
returnMap.put("msg",Msg);
|
|
|
returnMap.put("status","-1");
|
|
|
return returnMap;
|
|
|
}else {
|
|
|
flag = true;
|
|
|
}else {
|
|
|
flag = true;
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
flag = true;
|
|
|
}
|
|
|
|
|
|
if (flag){
|
|
|
BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
|
|
|
baseNatAppointmentDO.setChargeAmount(chargeAmount);
|
|
@ -12968,10 +12990,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
|
|
|
if (null!=baseNatAppointmentDO){
|
|
|
if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
res = entranceService.BS10145("3150000","0001",DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime()),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),baseNatAppointmentDO.getAmpm(),demoFlag);
|
|
|
logger.info("核酸检测预约取消"+res);
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("natTimeConfig");
|
|
|
String isOpen = null;
|
|
|
if (hospitalSysDictDO!=null){
|
|
|
String dictValue = hospitalSysDictDO.getDictValue();
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(dictValue);
|
|
|
isOpen = jsonObject.getString("isOpen");
|
|
|
}
|
|
|
Boolean flag = false;
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
|
|
|
if (isOpen!=null&&isOpen.equalsIgnoreCase("0")){
|
|
|
res = entranceService.BS10145("3150000","0001",DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime()),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),baseNatAppointmentDO.getAmpm(),demoFlag);
|
|
|
logger.info("核酸检测预约取消"+res);
|
|
|
jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
|
|
|
}else {
|
|
|
com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
|
|
|
object.put("Msg","success");
|
|
|
jsonObject.put("MsgInfo",object);
|
|
|
}
|
|
|
if (jsonObject!=null){
|
|
|
com.alibaba.fastjson.JSONObject object = jsonObject.getJSONObject("MsgInfo");
|
|
|
String Msg = object.getString("Msg");
|
|
@ -13792,7 +13828,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject getSettlementInfo(String outpatientId) throws Exception {
|
|
|
public JSONObject getSettlementInfo(String outpatientId,Integer flag) throws Exception {
|
|
|
logger.info("获取患者待结算信息开始!");
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
|
|
|
if(outpatientDO==null){
|
|
@ -13814,15 +13850,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
logger.info("医保预结算信息开始!");
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = healthCareService.preSettlementToEntrance(registerNo);
|
|
|
logger.info("医保预结算信息结束!");
|
|
|
|
|
|
logger.info("获取医保结算页面地址开始!");
|
|
|
String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(registerNo);
|
|
|
logger.info("获取医保结算页面地址结束!");
|
|
|
JSONObject object = new JSONObject();
|
|
|
if (flag==1){
|
|
|
logger.info("获取医保结算页面地址开始!");
|
|
|
String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(registerNo);
|
|
|
logger.info("获取医保结算页面地址结束!");
|
|
|
object.put("getSettlementResultUrl",getSettlementResultUrl);
|
|
|
}else if (flag==2){
|
|
|
logger.info("获取医保结算页面地址开始!");
|
|
|
String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64ToEntrance(registerNo);
|
|
|
logger.info("获取医保结算页面地址结束!");
|
|
|
object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
|
|
|
}
|
|
|
object.put("register",register);
|
|
|
object.put("feeDetailUpload",feeDetailUpload);
|
|
|
object.put("preSettlement",ylzMedicalRelationDO);
|
|
|
object.put("getSettlementResultUrl",getSettlementResultUrl);
|
|
|
|
|
|
object.put("cardNo",outpatientDO.getCardNo());
|
|
|
object.put("deptName",outpatientDO.getPatientName());
|
|
|
return object;
|
|
@ -14373,4 +14416,80 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
throw e;
|
|
|
}
|
|
|
}
|
|
|
public ObjEnvelop selectNatTime()throws Exception{
|
|
|
ObjEnvelop envelop = new ObjEnvelop();
|
|
|
GregorianCalendar ca = new GregorianCalendar();
|
|
|
//i结果为“0”是上午 结果为“1”是下午
|
|
|
Integer i = ca.get(GregorianCalendar.AM_PM);
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("natTimeConfig");
|
|
|
String isOpen = null;
|
|
|
String sql = "SELECT COUNT(1) as count FROM `base_nat_appointment` where is_success = 1 and pay_status=1 ";
|
|
|
if (hospitalSysDictDO!=null){
|
|
|
String dictValue = hospitalSysDictDO.getDictValue();
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(dictValue);
|
|
|
String startAm = jsonObject.getString("startAm");
|
|
|
String endAm = jsonObject.getString("endAm");
|
|
|
String startPm = jsonObject.getString("startPm");
|
|
|
String endPm = jsonObject.getString("endPm");
|
|
|
String message1 = jsonObject.getString("message1");
|
|
|
String message2 = jsonObject.getString("message2");
|
|
|
Integer amTotal = jsonObject.getInteger("amTotal");
|
|
|
Integer pmTotal = jsonObject.getInteger("pmTotal");
|
|
|
Date startAmDate = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+startAm);
|
|
|
Date endAmDate = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+endAm);
|
|
|
Date startPmDate = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+startPm);
|
|
|
Date endPmDate = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+endPm);
|
|
|
Date now = new Date();
|
|
|
if (i==0){
|
|
|
if (now.getTime()>=startAmDate.getTime()&&now.getTime()<=endAmDate.getTime()){
|
|
|
sql += " and create_time >= '"+DateUtil.dateToStrLong(startAmDate)+"' and create_time <='"+DateUtil.dateToStrLong(endAmDate)+"' ";
|
|
|
}else {
|
|
|
envelop.setMessage(message1);
|
|
|
envelop.setStatus(500);
|
|
|
return envelop;
|
|
|
}
|
|
|
}else if (i==1){
|
|
|
if (now.getTime()>=(startPmDate.getTime())&&now.getTime()<=(endPmDate.getTime())){
|
|
|
sql += " and create_time >= '"+DateUtil.dateToStrLong(startPmDate)+"' and create_time <='"+DateUtil.dateToStrLong(endPmDate)+"' ";
|
|
|
}else {
|
|
|
envelop.setMessage(message1);
|
|
|
envelop.setStatus(500);
|
|
|
return envelop;
|
|
|
}
|
|
|
}
|
|
|
Map<String,Object> map = jdbcTemplate.queryForMap(sql);
|
|
|
logger.info("map"+sql);
|
|
|
Integer count = 0;
|
|
|
if (map!=null){
|
|
|
count= Integer.parseInt(map.get("count").toString());
|
|
|
}
|
|
|
if (i==0){
|
|
|
if (amTotal>count){
|
|
|
Integer remainTotal = amTotal-count;
|
|
|
jsonObject.put("remainTotal",remainTotal);
|
|
|
}else {
|
|
|
envelop.setMessage(message2);
|
|
|
envelop.setStatus(500);
|
|
|
return envelop;
|
|
|
}
|
|
|
}else if (i==1){
|
|
|
if (pmTotal>count){
|
|
|
Integer remainTotal = pmTotal-count;
|
|
|
jsonObject.put("remainTotal",remainTotal);
|
|
|
}else {
|
|
|
envelop.setMessage(message2);
|
|
|
envelop.setStatus(500);
|
|
|
return envelop;
|
|
|
}
|
|
|
}
|
|
|
envelop.setStatus(200);
|
|
|
envelop.setMessage("获取号源成功");
|
|
|
envelop.setObj(jsonObject);
|
|
|
return envelop;
|
|
|
}else {
|
|
|
envelop.setStatus(500);
|
|
|
envelop.setMessage("获取号源失败");
|
|
|
return envelop;
|
|
|
}
|
|
|
}
|
|
|
}
|