|
@ -15,6 +15,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.im.ConsultTeamDo;
|
|
|
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
|
|
|
import com.yihu.jw.entity.base.org.BaseOrgDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
|
|
|
import com.yihu.jw.entity.base.wx.*;
|
|
@ -78,12 +79,9 @@ import com.yihu.jw.util.common.LatitudeUtils;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
|
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
|
|
|
import com.yihu.jw.utils.CheckSumBuilder;
|
|
|
import com.yihu.jw.utils.GenerateUserSig;
|
|
|
import com.yihu.jw.utils.PinYinUtils;
|
|
|
import com.yihu.jw.utils.*;
|
|
|
import com.yihu.jw.utils.Pkis.PKIService_PortType;
|
|
|
import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
|
|
|
import com.yihu.jw.utils.WebserviceUtil;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
@ -274,6 +272,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
private YxTokenMappingDao yxTokenMappingDao;
|
|
|
@Autowired
|
|
|
private BaseNatAppointmentDao baseNatAppointmentDao;
|
|
|
@Autowired
|
|
|
private PayInfoNoticeService payInfoNoticeService;
|
|
|
|
|
|
|
|
|
|
|
@ -8265,7 +8265,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if ("0".equals(rsCode)) {
|
|
|
free = res.getString("@total_charge");
|
|
|
}
|
|
|
ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
|
|
|
ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1","WX_PUB");
|
|
|
}else {
|
|
|
throw new Exception(map.get("mes").toString());
|
|
|
}
|
|
@ -8363,7 +8363,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if ("0".equals(rsCode)) {
|
|
|
free = res.getString("@total_charge");
|
|
|
}*/
|
|
|
ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, "", "");
|
|
|
ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, "", "","WX_PUB");
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@ -10458,95 +10458,77 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return null;
|
|
|
}
|
|
|
public Map saveNatAppointment(String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
|
|
|
String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName) throws Exception {
|
|
|
BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
|
|
|
baseNatAppointmentDO.setMedicare(mediaCard);
|
|
|
baseNatAppointmentDO.setName(name);
|
|
|
baseNatAppointmentDO.setCardNo(cardNo);
|
|
|
baseNatAppointmentDO.setCardType(cardType);
|
|
|
baseNatAppointmentDO.setAddress(address);
|
|
|
baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDate(natTime,"yyyy-MM-dd hh:mm:ss"));
|
|
|
baseNatAppointmentDO.setCityName(cityName);
|
|
|
baseNatAppointmentDO.setFirstJobCode(firstJobCode);
|
|
|
baseNatAppointmentDO.setFirstJobName(firstJobName);
|
|
|
baseNatAppointmentDO.setSecondJobCode(secondJobCode);
|
|
|
baseNatAppointmentDO.setSecondJobName(secondJobName);
|
|
|
baseNatAppointmentDO.setProvinceName(provinceName);
|
|
|
baseNatAppointmentDO.setTownName(townName);
|
|
|
baseNatAppointmentDO.setStreetName(streetName);
|
|
|
baseNatAppointmentDO.setPatientId(patientId);
|
|
|
baseNatAppointmentDO.setIsSuccess("0");
|
|
|
baseNatAppointmentDO.setPayStatus("0");
|
|
|
baseNatAppointmentDO.setCreateTime(new Date());
|
|
|
baseNatAppointmentDO.setMobile(mobile);
|
|
|
baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
|
|
|
baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
|
|
|
baseNatAppointmentDO.setIcdCode("Z00.000");
|
|
|
baseNatAppointmentDO.setChargeCode("361322");
|
|
|
baseNatAppointmentDO.setWinNo("6");
|
|
|
baseNatAppointmentDO.setDept("3150000");
|
|
|
baseNatAppointmentDO.setDeptName("感染疾病科");
|
|
|
baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName,String pm,String pushChannel,String pushFlag,String cardNoType) throws Exception {
|
|
|
Map returnMap = new HashMap();
|
|
|
net.sf.json.JSONObject jsondate = new JSONObject();
|
|
|
jsondate.put("checkPart","鼻/咽拭子");
|
|
|
jsondate.put("cardNo",mediaCard);
|
|
|
jsondate.put("chargeFlag","2");
|
|
|
jsondate.put("chargeCode","361322");
|
|
|
jsondate.put("icdCode","Z00.000");
|
|
|
jsondate.put("socialNo",cardNo);
|
|
|
jsondate.put("tellPhone",mobile);
|
|
|
jsondate.put("address1",provinceName);
|
|
|
jsondate.put("address2",cityName);
|
|
|
jsondate.put("address3",townName);
|
|
|
jsondate.put("address4",streetName);
|
|
|
jsondate.put("address5",2);
|
|
|
jsondate.put("area",address);
|
|
|
jsondate.put("winNo",6);
|
|
|
jsondate.put("target",2);
|
|
|
jsondate.put("quantity",1);
|
|
|
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,demoFlag);
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
|
|
|
logger.info("核酸检测预约结束"+result);
|
|
|
Boolean flag = false;
|
|
|
if (object!=null){
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = object.getJSONObject("MsgInfo");
|
|
|
String Msg = jsonObject.getString("Msg");
|
|
|
if (Msg.contains("Error")){
|
|
|
throw new Exception(Msg);
|
|
|
}else {
|
|
|
flag = true;
|
|
|
}
|
|
|
}
|
|
|
if (flag){
|
|
|
try {
|
|
|
logger.info("挂号开始");
|
|
|
String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
|
|
|
List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctorAndDel(patientId, date,map.get("doctorCode").toString() ,1);
|
|
|
if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
|
|
|
WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
|
|
|
//判断是否已经挂号,如果已经挂号
|
|
|
if (StringUtils.isNotBlank(registerDO.getConNo()) && StringUtils.isNotBlank(registerDO.getRegisterNo())) {
|
|
|
net.sf.json.JSONObject res = new JSONObject();
|
|
|
res.put("@RESULT", "0");
|
|
|
logger.info("已经挂号 res: " + res.toString());
|
|
|
jsondate.put("serialNo",registerDO.getRegisterNo());
|
|
|
jsondate.put("dept",map.get("deptCode").toString());
|
|
|
jsondate.put("doctor",map.get("doctorMappingCode").toString());
|
|
|
baseNatAppointmentDO.setRegisterNo(registerDO.getRegisterNo());
|
|
|
baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
|
|
|
baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
|
|
|
}else {
|
|
|
returnMap.put("msg","已经挂号的数据有误");
|
|
|
returnMap.put("status","-1");
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
return returnMap;
|
|
|
}
|
|
|
if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
|
|
|
net.sf.json.JSONObject jsondate = new JSONObject();
|
|
|
jsondate.put("checkPart","鼻/咽拭子");
|
|
|
jsondate.put("cardNo",mediaCard);
|
|
|
jsondate.put("chargeFlag","2");
|
|
|
jsondate.put("chargeCode","361322");
|
|
|
jsondate.put("icdCode","Z00.000");
|
|
|
jsondate.put("socialNo",cardNo);
|
|
|
jsondate.put("tellPhone",mobile);
|
|
|
jsondate.put("address1",provinceName);
|
|
|
jsondate.put("address2",cityName);
|
|
|
jsondate.put("address3",townName);
|
|
|
jsondate.put("address4",streetName);
|
|
|
jsondate.put("address5",2);
|
|
|
jsondate.put("area",address);
|
|
|
jsondate.put("winNo",6);
|
|
|
jsondate.put("target",2);
|
|
|
jsondate.put("quantity",1);
|
|
|
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);
|
|
|
Boolean flag = false;
|
|
|
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;
|
|
|
}
|
|
|
}
|
|
|
if (flag){
|
|
|
BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
|
|
|
baseNatAppointmentDO.setMedicare(mediaCard);
|
|
|
baseNatAppointmentDO.setName(name);
|
|
|
baseNatAppointmentDO.setCardNo(cardNo);
|
|
|
baseNatAppointmentDO.setCardType(cardType);
|
|
|
baseNatAppointmentDO.setAddress(address);
|
|
|
baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
|
|
|
baseNatAppointmentDO.setCityName(cityName);
|
|
|
baseNatAppointmentDO.setFirstJobCode(firstJobCode);
|
|
|
baseNatAppointmentDO.setFirstJobName(firstJobName);
|
|
|
baseNatAppointmentDO.setSecondJobCode(secondJobCode);
|
|
|
baseNatAppointmentDO.setSecondJobName(secondJobName);
|
|
|
baseNatAppointmentDO.setProvinceName(provinceName);
|
|
|
baseNatAppointmentDO.setTownName(townName);
|
|
|
baseNatAppointmentDO.setStreetName(streetName);
|
|
|
baseNatAppointmentDO.setPatientId(patientId);
|
|
|
baseNatAppointmentDO.setIsSuccess("0");
|
|
|
baseNatAppointmentDO.setCardNoType(cardNoType);
|
|
|
baseNatAppointmentDO.setPayStatus("0");
|
|
|
baseNatAppointmentDO.setCreateTime(new Date());
|
|
|
baseNatAppointmentDO.setMobile(mobile);
|
|
|
baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
|
|
|
baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
|
|
|
baseNatAppointmentDO.setIcdCode("Z00.000");
|
|
|
baseNatAppointmentDO.setChargeCode("361322");
|
|
|
baseNatAppointmentDO.setWinNo("6");
|
|
|
baseNatAppointmentDO.setDept("3150000");
|
|
|
baseNatAppointmentDO.setDeptName("感染疾病科");
|
|
|
baseNatAppointmentDO.setAmpm(pm);
|
|
|
baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
try {
|
|
|
rs = entranceService.BS10111(mediaCard, map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
|
|
|
net.sf.json.JSONObject res = rs.getJSONObject("resquest");
|
|
|
logger.info("挂号结果 res: " + res.toString());
|
|
@ -10563,24 +10545,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
jsondate.put("dept",map.get("deptCode").toString());
|
|
|
jsondate.put("doctor",map.get("doctorMappingCode").toString());
|
|
|
baseNatAppointmentDO.setRegisterNo(serialNo);
|
|
|
//存储就诊记录
|
|
|
WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
|
|
|
// 存储挂号医生与挂号科室
|
|
|
registerDO.setDoctor(map.get("doctorCode").toString());
|
|
|
registerDO.setDoctorName(map.get("doctorName").toString());
|
|
|
registerDO.setDept(map.get("deptCode").toString());
|
|
|
registerDO.setDeptName(map.get("deptName").toString());
|
|
|
registerDO.setRealOrder(realOrder);
|
|
|
registerDO.setXtgzh(xtgzh);
|
|
|
registerDO.setPatient(patientId);
|
|
|
registerDO.setPatientName(name);
|
|
|
//挂号流水号与挂号次数
|
|
|
registerDO.setRegisterNo(serialNo);
|
|
|
registerDO.setConNo(conNo);
|
|
|
registerDO.setCreateTime(new Date());
|
|
|
registerDO.setDel(1);
|
|
|
registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
|
|
|
patientRegisterDao.save(registerDO);
|
|
|
//保存日志
|
|
|
WlyyHttpLogDO log = new WlyyHttpLogDO();
|
|
|
log.setCode("registerOutPatient");
|
|
@ -10601,22 +10565,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
jsondate.put("dept",map.get("deptCode").toString());
|
|
|
jsondate.put("doctor",map.get("doctorMappingCode").toString());
|
|
|
logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo);
|
|
|
//存储就诊记录
|
|
|
WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
|
|
|
registerDO.setDoctor(map.get("doctorCode").toString());
|
|
|
registerDO.setDoctorName(map.get("doctorName").toString());
|
|
|
registerDO.setDept(map.get("deptCode").toString());
|
|
|
registerDO.setDeptName(map.get("deptName").toString());
|
|
|
registerDO.setRealOrder(realOrder);
|
|
|
registerDO.setXtgzh(xtgzh);
|
|
|
registerDO.setPatient(patientId);
|
|
|
registerDO.setPatientName(name);
|
|
|
registerDO.setRegisterNo(serialNo);
|
|
|
registerDO.setConNo(conNo);
|
|
|
registerDO.setCreateTime(new Date());
|
|
|
registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
|
|
|
|
|
|
patientRegisterDao.save(registerDO);
|
|
|
//保存日志
|
|
|
WlyyHttpLogDO log = new WlyyHttpLogDO();
|
|
|
log.setCode("registerOutPatient");
|
|
@ -10635,86 +10583,225 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
|
|
|
baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
logger.info("开单开始");
|
|
|
logger.info("saveNatAppointment params:"+jsondate.toString());
|
|
|
com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
|
|
|
array.add(jsondate);
|
|
|
try {
|
|
|
JSONObject jsonObject = entranceService.BS10112(array.toString(),demoFlag);
|
|
|
//判断返回结果
|
|
|
String prers = jsonObject.getString("@RESULT");
|
|
|
//保存日志
|
|
|
WlyyHttpLogDO log = new WlyyHttpLogDO();
|
|
|
log.setCode("saveNatAppointment");
|
|
|
log.setName("核酸检测开方");
|
|
|
log.setPatient(patientId);
|
|
|
log.setDoctor(map.get("doctorCode").toString());
|
|
|
log.setResponse(jsonObject.toString());
|
|
|
log.setRequest(jsondate.toString());
|
|
|
log.setCreateTime(new Date());
|
|
|
wlyyHttpLogDao.save(log);
|
|
|
if ("0".equals(prers)) {
|
|
|
String realOrder = jsonObject.getString("@real_order");
|
|
|
String voucherNo = jsonObject.getString("@xtgzh0");
|
|
|
baseNatAppointmentDO.setRealOrder(realOrder);
|
|
|
baseNatAppointmentDO.setIsSuccess("1");
|
|
|
baseNatAppointmentDO.setVoucherNo(voucherNo);
|
|
|
baseNatAppointmentDO =baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
/*logger.info("模板消息推送标识pushFlag"+pushFlag);
|
|
|
if (!StringUtils.isNoneBlank(pushFlag)){
|
|
|
String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
|
|
|
String applyDepaName = map.get("deptName").toString();
|
|
|
String applyDoctorName = map.get("doctorName").toString();
|
|
|
BasePatientDO patientDO = basePatientDao.findById(patientId);
|
|
|
String userName = null;
|
|
|
String idcard = null;
|
|
|
if (patientDO != null) {
|
|
|
userName = patientDO.getName();
|
|
|
idcard = patientDO.getIdcard();
|
|
|
}
|
|
|
String hisId = patientMappingService.findHisPatNoByPatient(patientId,mediaCard);
|
|
|
logger.info("cardNo:" + cardNo);
|
|
|
JSONObject jsonObject1 =entranceService.BS15054(hisId,realOrder,demoFlag);
|
|
|
net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest");
|
|
|
logger.info("获取待结算数据 res: " + res.toString());
|
|
|
String rsCode = res.getString("@RESULT");
|
|
|
String free= 0+"";
|
|
|
if ("0".equals(rsCode)) {
|
|
|
free = res.getString("@total_charge");
|
|
|
}
|
|
|
ylzPayService.msgPush("01", mediaCard, "01", patientDO.getMobile(), "00", hisId, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1",pushChannel);
|
|
|
}else {
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
logger.info("开单开始");
|
|
|
logger.info("saveNatAppointment params:"+jsondate.toString());
|
|
|
com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
|
|
|
array.add(jsondate);
|
|
|
try {
|
|
|
JSONObject jsonObject = entranceService.BS10112(array.toString(),demoFlag);
|
|
|
//判断返回结果
|
|
|
String prers = jsonObject.getString("@RESULT");
|
|
|
//保存日志
|
|
|
WlyyHttpLogDO log = new WlyyHttpLogDO();
|
|
|
log.setCode("saveNatAppointment");
|
|
|
log.setName("核酸检测开方");
|
|
|
log.setPatient(patientId);
|
|
|
log.setDoctor(map.get("doctorCode").toString());
|
|
|
log.setResponse(jsonObject.toString());
|
|
|
log.setRequest(jsondate.toString());
|
|
|
log.setCreateTime(new Date());
|
|
|
wlyyHttpLogDao.save(log);
|
|
|
if ("0".equals(prers)) {
|
|
|
String realOrder = jsonObject.getString("@real_order");
|
|
|
String voucherNo = jsonObject.getString("@xtgzh0");
|
|
|
baseNatAppointmentDO.setRealOrder(realOrder);
|
|
|
baseNatAppointmentDO.setIsSuccess("1");
|
|
|
baseNatAppointmentDO.setVoucherNo(voucherNo);
|
|
|
baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
|
|
|
String applyDepaName = map.get("deptName").toString();
|
|
|
|
|
|
|
|
|
String applyDoctorName = map.get("doctorName").toString();
|
|
|
BasePatientDO patientDO = basePatientDao.findById(patientId);
|
|
|
String userName = null;
|
|
|
String idcard = null;
|
|
|
if (patientDO != null) {
|
|
|
userName = patientDO.getName();
|
|
|
idcard = patientDO.getIdcard();
|
|
|
}
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patientId);
|
|
|
String userNo = null;
|
|
|
if (patientMappingDO != null) {
|
|
|
userNo = patientMappingDO.getMappingCode();
|
|
|
}
|
|
|
String title="您在厦门大学附属中山医院有一笔交易已支付完成!";
|
|
|
String pushPayLog = payInfoNoticeService.pushPrescriptionPayAndHsjc(baseNatAppointmentDO.getPatientId(),baseNatAppointmentDO.getDoctorName(),waitPayDetailVO.getVoucherNo(),natAppointmentDO.getId()+"",fee,title,null,waitPayDetailVO.getRecipeNo());
|
|
|
}*/
|
|
|
|
|
|
logger.info("cardNo:" + cardNo);
|
|
|
JSONObject jsonObject1 =entranceService.BS15054(patientMappingDO.getMappingCode(),realOrder,demoFlag);
|
|
|
net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest");
|
|
|
logger.info("获取待结算数据 res: " + res.toString());
|
|
|
String rsCode = res.getString("@RESULT");
|
|
|
String free= 0+"";
|
|
|
if ("0".equals(rsCode)) {
|
|
|
free = res.getString("@total_charge");
|
|
|
}
|
|
|
ylzPayService.msgPush("01", mediaCard, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
|
|
|
|
|
|
/*//成功后发送模板消息
|
|
|
sendNatWxTemplat(name,cardNo,mobile,natTime,realOrder,"natAppointmentRemind");*/
|
|
|
}else{
|
|
|
returnMap.put("msg","核酸检测开方失败");
|
|
|
returnMap.put("status","-1");
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
return returnMap;
|
|
|
}else{
|
|
|
returnMap.put("msg","核酸检测开方失败");
|
|
|
returnMap.put("status","-1");
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
return returnMap;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
returnMap.put("msg","预约成功");
|
|
|
returnMap.put("status","200");
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
returnMap.put("realOrder",baseNatAppointmentDO.getRealOrder());
|
|
|
}
|
|
|
}
|
|
|
return returnMap;
|
|
|
}else if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
|
|
|
BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
|
|
|
baseNatAppointmentDO.setMedicare(mediaCard);
|
|
|
baseNatAppointmentDO.setName(name);
|
|
|
baseNatAppointmentDO.setCardNo(cardNo);
|
|
|
baseNatAppointmentDO.setCardType(cardType);
|
|
|
baseNatAppointmentDO.setAddress(address);
|
|
|
baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
|
|
|
baseNatAppointmentDO.setCityName(cityName);
|
|
|
baseNatAppointmentDO.setFirstJobCode(firstJobCode);
|
|
|
baseNatAppointmentDO.setFirstJobName(firstJobName);
|
|
|
baseNatAppointmentDO.setSecondJobCode(secondJobCode);
|
|
|
baseNatAppointmentDO.setSecondJobName(secondJobName);
|
|
|
baseNatAppointmentDO.setProvinceName(provinceName);
|
|
|
baseNatAppointmentDO.setTownName(townName);
|
|
|
baseNatAppointmentDO.setStreetName(streetName);
|
|
|
baseNatAppointmentDO.setPatientId(patientId);
|
|
|
baseNatAppointmentDO.setIsSuccess("0");
|
|
|
baseNatAppointmentDO.setPayStatus("0");
|
|
|
baseNatAppointmentDO.setCreateTime(new Date());
|
|
|
baseNatAppointmentDO.setMobile(mobile);
|
|
|
baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
|
|
|
baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
|
|
|
baseNatAppointmentDO.setIcdCode("Z00.000");
|
|
|
baseNatAppointmentDO.setChargeCode("361322");
|
|
|
baseNatAppointmentDO.setWinNo("6");
|
|
|
baseNatAppointmentDO.setDept("3150000");
|
|
|
baseNatAppointmentDO.setDeptName("感染疾病科");
|
|
|
baseNatAppointmentDO.setAmpm(pm);
|
|
|
baseNatAppointmentDO.setHospitalFlag(pushFlag);
|
|
|
baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
//添加订单
|
|
|
BusinessOrderDO businessDO = new BusinessOrderDO();
|
|
|
businessDO.setPatient(patientId);
|
|
|
businessDO.setPatientName(name);
|
|
|
businessDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
|
|
|
businessDO.setCreateTime(new Date());
|
|
|
businessDO.setStatus(0);
|
|
|
businessDO.setRelationCode(baseNatAppointmentDO.getId()+"");
|
|
|
businessDO.setRelationName("核酸检测订单");
|
|
|
businessDO.setOrderCategory("6");
|
|
|
businessDO.setOrderType(12);
|
|
|
businessDO.setPayPrice(8000.0);
|
|
|
businessDO.setRematk("核酸检测订单");
|
|
|
businessDO.setDescription("核酸检测订单");
|
|
|
businessDO.setPayType(1);
|
|
|
businessDO.setUpdateTime(new Date());
|
|
|
businessOrderDao.save(businessDO);
|
|
|
//同步眼科医院
|
|
|
logger.info("开始同步眼科医院");
|
|
|
ykyyEntranceService.saveKsjc(baseNatAppointmentDO,demoFlag);
|
|
|
logger.info("结束同步眼科医院");
|
|
|
returnMap.put("msg","预约成功");
|
|
|
returnMap.put("status","200");
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
returnMap.put("realOrder",baseNatAppointmentDO.getRealOrder());
|
|
|
return returnMap;
|
|
|
}
|
|
|
|
|
|
|
|
|
return returnMap;
|
|
|
}
|
|
|
public MixEnvelop getNatRecords(String patientId,String id,Integer page ,Integer pageSize){
|
|
|
|
|
|
public String sendMessage(Integer id,String pushChannel,String pushFlag) throws Exception {
|
|
|
BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
|
|
|
if (baseNatAppointmentDO==null){
|
|
|
throw new Exception("预约记录不存在");
|
|
|
}
|
|
|
if (!StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
|
|
|
throw new Exception("核酸项目不存在");
|
|
|
}
|
|
|
|
|
|
logger.info("模板消息推送标识pushFlag"+pushFlag);
|
|
|
if (!StringUtils.isNoneBlank(pushFlag)){
|
|
|
String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
|
|
|
String applyDepaName = baseNatAppointmentDO.getDeptName();
|
|
|
String applyDoctorName = baseNatAppointmentDO.getDoctorName();
|
|
|
BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId());
|
|
|
String userName = null;
|
|
|
String idcard = null;
|
|
|
if (patientDO != null) {
|
|
|
userName = patientDO.getName();
|
|
|
idcard = patientDO.getIdcard();
|
|
|
}
|
|
|
String hisId = patientMappingService.findHisPatNoByPatient(baseNatAppointmentDO.getPatientId(),baseNatAppointmentDO.getMedicare());
|
|
|
logger.info("cardNo:" + baseNatAppointmentDO.getMedicare());
|
|
|
JSONObject jsonObject1 =entranceService.BS15054(hisId,baseNatAppointmentDO.getRealOrder(),demoFlag);
|
|
|
net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest");
|
|
|
logger.info("获取待结算数据 res: " + res.toString());
|
|
|
String rsCode = res.getString("@RESULT");
|
|
|
String free= 0+"";
|
|
|
if ("0".equals(rsCode)) {
|
|
|
free = res.getString("@total_charge");
|
|
|
}
|
|
|
ylzPayService.msgPush("01", baseNatAppointmentDO.getMedicare(), "01", patientDO.getMobile(), "00", hisId, userName, idcard, baseNatAppointmentDO.getVoucherNo(), applyDepaName, applyDoctorName, recipeTime, free, "1",pushChannel);
|
|
|
}else {
|
|
|
if (pushChannel.equalsIgnoreCase("WX_PUB")){
|
|
|
String first="尊敬的用户"+baseNatAppointmentDO.getName()+",您已完成线上自助核酸检测预约申请";
|
|
|
String responseMsg="";
|
|
|
String url="";
|
|
|
String date = DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime());
|
|
|
String contentMsg="申请人:"+baseNatAppointmentDO.getName()+"\r\n预约时间:"+date;
|
|
|
String remark = "1、请于预约时间"+date+"前,携带医保卡/就诊卡/电子健康卡到院区自助机进行结算。\r\n" +
|
|
|
"2、结算完成后请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\r\n" +
|
|
|
"3、核酸检测标本采集24小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
|
|
|
if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)) {
|
|
|
responseMsg = entranceService.ehospitalNotice(
|
|
|
baseNatAppointmentDO.getName(),
|
|
|
baseNatAppointmentDO.getCardNo(),
|
|
|
baseNatAppointmentDO.getMobile(),
|
|
|
first,
|
|
|
url,
|
|
|
contentMsg,
|
|
|
remark);
|
|
|
logger.info("中山发送模板消息返回结果="+responseMsg);
|
|
|
System.out.println("结束发送模板消息");
|
|
|
}
|
|
|
}else if (pushChannel.equalsIgnoreCase("ALI_PUB")){
|
|
|
BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId());
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
|
|
|
jsonObject.put("code","13");
|
|
|
jsonObject.put("open_id",patientDO.getAlipayId());
|
|
|
jsonObject.put("first","尊敬的用户"+baseNatAppointmentDO.getName()+",您已完成线上自助核酸检测预约申请");
|
|
|
jsonObject.put("keyword1",DateUtil.getStringDate());
|
|
|
String date = DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime());
|
|
|
jsonObject.put("keyword2","申请人:"+baseNatAppointmentDO.getName()+"\n预约时间:"+date);
|
|
|
String remark = "1、请于预约时间"+date+"前,携带医保卡/就诊卡/电子健康卡到院区自助机进行结算。\n" +
|
|
|
"2、结算完成后请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\n" +
|
|
|
"3、核酸检测标本采集24小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
|
|
|
jsonObject.put("remark",remark);
|
|
|
jsonObject.put("url","111111");
|
|
|
String url = "https://xmzsyyfwc.xmpbinfo.cn/weixin/1/notification/push/nucleictest";
|
|
|
logger.info("jsonObject"+jsonObject.toJSONString());
|
|
|
String encdata = AES.encrypt("3bdc154ed1e44a9c9f44451a16d8e0aa",jsonObject.toJSONString());
|
|
|
Map<String, String> params = new HashedMap();
|
|
|
params.put("encdata",encdata);
|
|
|
String reponse = httpClientUtil.httpPost(url,params);
|
|
|
logger.info("支付宝模板消息"+reponse);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
return "发送成功!";
|
|
|
}
|
|
|
public MixEnvelop getNatRecords(String patientId,String id,String payStatus,String appointmentTime, String isSuccess,Integer page ,Integer pageSize){
|
|
|
String sql = "select t.name as \"name\"," +
|
|
|
"t.card_no as \"cardNo\"," +
|
|
|
"t.card_type as \"cardType\"," +
|
|
@ -10727,6 +10814,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"t.medicare as \"medicare\","+
|
|
|
"t.voucher_no as \"voucherNo\","+
|
|
|
"t.id as \"id\"," +
|
|
|
"t.card_no_type as \"cardNoType\"," +
|
|
|
"t.appointment_time as \"appointmentTime\" " +
|
|
|
" from base_nat_appointment t where 1=1 ";
|
|
|
if (StringUtils.isNoneBlank(patientId)){
|
|
@ -10735,8 +10823,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
if (StringUtils.isNoneBlank(id)){
|
|
|
sql+=" and t.id ='"+id+"'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(payStatus)){
|
|
|
sql+=" and t.pay_status ='"+payStatus+"'";
|
|
|
sql+=" and t.is_success =1 ";
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNoneBlank(isSuccess)){
|
|
|
sql+=" and t.is_success ="+isSuccess;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (StringUtils.isNoneBlank(appointmentTime)){
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
sql+=" and t.appointment_time >= to_date('" + appointmentTime + " 00:00:00', 'yyyy-mm-dd hh24:mi:ss')";
|
|
|
sql+=" and t.appointment_time <= to_date('" + appointmentTime + " 23:59:59', 'yyyy-mm-dd hh24:mi:ss')";
|
|
|
}else {
|
|
|
sql+=" and t.appointment_time >='"+appointmentTime+" 00:00:00'";
|
|
|
sql+=" and t.appointment_time <='"+appointmentTime+" 23:59:59'";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
sql+=" order by t.appointment_time desc ";
|
|
|
List<Map<String ,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
List<Map<String ,Object>> listCount = hibenateUtils.createSQLQuery(sql);
|
|
|
logger.info("查询数据"+sql);
|
|
|
MixEnvelop mixnvelop = new MixEnvelop();
|
|
|
if (listCount!=null&&listCount.size()>0){
|
|
|
mixnvelop.setCurrPage(page);
|
|
@ -10749,16 +10859,43 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public void savePayStatusByHis(String patientId) throws Exception {
|
|
|
List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientId(patientId);
|
|
|
for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
|
|
|
String hisId = patientMappingService.findHisPatNoByPatient(patientId,baseNatAppointmentDO.getMedicare());
|
|
|
logger.info("cardNo:" + baseNatAppointmentDO.getMedicare());
|
|
|
JSONObject jsonObject1 =entranceService.BS15054(hisId,baseNatAppointmentDO.getRealOrder(),demoFlag);
|
|
|
net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest");
|
|
|
logger.info("获取待结算数据 res: " + res.toString());
|
|
|
String rsCode = res.getString("@RESULT");
|
|
|
String free= 0+"";
|
|
|
String settleFlag = "";
|
|
|
if ("0".equals(rsCode)) {
|
|
|
free = res.getString("@total_charge");
|
|
|
settleFlag = res.getString("@settle_flag");
|
|
|
if (StringUtils.isNoneBlank(settleFlag)&&settleFlag.equalsIgnoreCase("Y")){
|
|
|
baseNatAppointmentDO.setPayStatus("1");
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNoneBlank(free)&&free.equalsIgnoreCase("0")){
|
|
|
baseNatAppointmentDO.setPayStatus("1");
|
|
|
}
|
|
|
baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> findBaseAddress(String addressFlag,String parentName){
|
|
|
String sql="";
|
|
|
if ("1".equalsIgnoreCase(addressFlag)){
|
|
|
sql+="select t.province_name as \"provinceName\" from base_address_mapping t group by t.province_name ";
|
|
|
}else if("2".equalsIgnoreCase(addressFlag)){
|
|
|
sql+="select t.city_name as \"cityName\" from base_address_mapping t where t.province_name ='"+parentName+"' and city_name <> '' and city_name is not null group by t.city_name ";
|
|
|
sql+="select t.city_name as \"cityName\" from base_address_mapping t where t.province_name ='"+parentName+"' and city_name is not null group by t.city_name ";
|
|
|
}else if("3".equalsIgnoreCase(addressFlag)){
|
|
|
sql+="select t.town_name as \"townName\" from base_address_mapping t where t.city_name ='"+parentName+"' and town_name <> '' and town_name is not null group by t.town_name";
|
|
|
sql+="select t.town_name as \"townName\" from base_address_mapping t where t.city_name ='"+parentName+"' and town_name is not null group by t.town_name";
|
|
|
}else if("4".equalsIgnoreCase(addressFlag)){
|
|
|
sql+="select t.street_name as \"streetName\" from base_address_mapping t where t.town_name ='"+parentName+"' and street_name <> '' and street_name is not null";
|
|
|
sql+="select t.street_name as \"streetName\" from base_address_mapping t where t.town_name ='"+parentName+"' and street_name is not null";
|
|
|
}
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
|
|
|
list.stream().forEach(one->{
|
|
@ -10782,12 +10919,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
BasePatientDO patientDO = basePatientDao.findById(patientId);
|
|
|
String res = "";
|
|
|
if (patientDO!=null){
|
|
|
String patientCode = null;
|
|
|
try {
|
|
|
patientCode = patientMappingService.findHisPatNoByIdCard(patientDO.getIdcard());
|
|
|
BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
|
|
|
if (null!=baseNatAppointmentDO){
|
|
|
res = entranceService.BS10145("3150000","0001",DateUtil.dateToStr(baseNatAppointmentDO.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),demoFlag);
|
|
|
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);
|
|
|
Boolean flag = false;
|
|
@ -10802,33 +10937,36 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
baseNatAppointmentDO.setCancelTime(new Date());
|
|
|
baseNatAppointmentDO.setCancelBy(patientId);
|
|
|
baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
//删除处方
|
|
|
logger.info("删除处方开始");
|
|
|
net.sf.json.JSONObject jsondate = new JSONObject();
|
|
|
jsondate.put("checkPart","鼻/咽拭子");
|
|
|
jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
|
|
|
jsondate.put("chargeFlag","2");
|
|
|
jsondate.put("chargeCode","361322");
|
|
|
jsondate.put("icdCode","Z00.000");
|
|
|
jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
|
|
|
jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
|
|
|
jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
|
|
|
jsondate.put("address2",baseNatAppointmentDO.getCityName());
|
|
|
jsondate.put("address3",baseNatAppointmentDO.getTownName());
|
|
|
jsondate.put("address4",baseNatAppointmentDO.getStreetName());
|
|
|
jsondate.put("address5",2);
|
|
|
jsondate.put("area",baseNatAppointmentDO.getAddress());
|
|
|
jsondate.put("winNo",6);
|
|
|
jsondate.put("target",2);
|
|
|
jsondate.put("quantity",1);
|
|
|
jsondate.put("serialNo",baseNatAppointmentDO.getRegisterNo());
|
|
|
jsondate.put("dept",baseNatAppointmentDO.getDept());
|
|
|
jsondate.put("doctor",baseNatAppointmentDO.getDoctorId());
|
|
|
jsondate.put("realOrder",baseNatAppointmentDO.getRealOrder());
|
|
|
JSONArray array = new JSONArray();
|
|
|
array.add(jsondate);
|
|
|
JSONObject object1 = entranceService.BS10112(array.toString(),demoFlag);
|
|
|
logger.info("删除处方结束");
|
|
|
if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
|
|
|
//删除处方
|
|
|
logger.info("删除处方开始");
|
|
|
net.sf.json.JSONObject jsondate = new JSONObject();
|
|
|
jsondate.put("checkPart","鼻/咽拭子");
|
|
|
jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
|
|
|
jsondate.put("chargeFlag","2");
|
|
|
jsondate.put("chargeCode","361322");
|
|
|
jsondate.put("icdCode","Z00.000");
|
|
|
jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
|
|
|
jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
|
|
|
jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
|
|
|
jsondate.put("address2",baseNatAppointmentDO.getCityName());
|
|
|
jsondate.put("address3",baseNatAppointmentDO.getTownName());
|
|
|
jsondate.put("address4",baseNatAppointmentDO.getStreetName());
|
|
|
jsondate.put("address5",2);
|
|
|
jsondate.put("area",baseNatAppointmentDO.getAddress());
|
|
|
jsondate.put("winNo",6);
|
|
|
jsondate.put("target",2);
|
|
|
jsondate.put("quantity",1);
|
|
|
jsondate.put("serialNo",baseNatAppointmentDO.getRegisterNo());
|
|
|
jsondate.put("dept",baseNatAppointmentDO.getDept());
|
|
|
jsondate.put("doctor",baseNatAppointmentDO.getDoctorId());
|
|
|
jsondate.put("realOrder",baseNatAppointmentDO.getRealOrder());
|
|
|
JSONArray array = new JSONArray();
|
|
|
array.add(jsondate);
|
|
|
JSONObject object1 = entranceService.BS10112(array.toString(),demoFlag);
|
|
|
logger.info("删除处方结束");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -10841,267 +10979,58 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
//先调预约核酸检测的接口
|
|
|
public Map natAppointment(String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
|
|
|
String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName) throws Exception {
|
|
|
BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
|
|
|
baseNatAppointmentDO.setMedicare(mediaCard);
|
|
|
baseNatAppointmentDO.setName(name);
|
|
|
baseNatAppointmentDO.setCardNo(cardNo);
|
|
|
baseNatAppointmentDO.setCardType(cardType);
|
|
|
baseNatAppointmentDO.setAddress(address);
|
|
|
baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDate(natTime,"yyyy-MM-dd hh:mm:ss"));
|
|
|
baseNatAppointmentDO.setCityName(cityName);
|
|
|
baseNatAppointmentDO.setFirstJobCode(firstJobCode);
|
|
|
baseNatAppointmentDO.setFirstJobName(firstJobName);
|
|
|
baseNatAppointmentDO.setSecondJobCode(secondJobCode);
|
|
|
baseNatAppointmentDO.setSecondJobName(secondJobName);
|
|
|
baseNatAppointmentDO.setProvinceName(provinceName);
|
|
|
baseNatAppointmentDO.setTownName(townName);
|
|
|
baseNatAppointmentDO.setStreetName(streetName);
|
|
|
baseNatAppointmentDO.setPatientId(patientId);
|
|
|
baseNatAppointmentDO.setIsSuccess("0");
|
|
|
baseNatAppointmentDO.setPayStatus("0");
|
|
|
baseNatAppointmentDO.setCreateTime(new Date());
|
|
|
baseNatAppointmentDO.setMobile(mobile);
|
|
|
baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
|
|
|
baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
|
|
|
baseNatAppointmentDO.setIcdCode("Z00.000");
|
|
|
baseNatAppointmentDO.setChargeCode("361322");
|
|
|
baseNatAppointmentDO.setWinNo("6");
|
|
|
baseNatAppointmentDO.setDept("3150000");
|
|
|
baseNatAppointmentDO.setDeptName("感染疾病科");
|
|
|
baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
Map<String,Object> returnMap = new HashMap();
|
|
|
//先进行核算检测预约
|
|
|
String result = entranceService.BS10144("3150000","0001",natTime,mediaCard,name,cardNo,mobile,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")){
|
|
|
throw new Exception(Msg);
|
|
|
}else {
|
|
|
baseNatAppointmentDO.setIsSuccess("1");
|
|
|
baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
returnMap.put("msg","预约成功");
|
|
|
}
|
|
|
}else {
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
returnMap.put("msg","预约失败");
|
|
|
}
|
|
|
return returnMap;
|
|
|
}
|
|
|
//预约核酸成功后通过订单id去挂号生成订单
|
|
|
public Map<String,Object> registerAndNatPre(Integer id) throws Exception{
|
|
|
BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
|
|
|
Map<String,Object> map = findRandomDoctor();
|
|
|
Map<String,Object> returnMap = new HashMap<>();
|
|
|
if (baseNatAppointmentDO!=null){
|
|
|
net.sf.json.JSONObject jsondate = new JSONObject();
|
|
|
jsondate.put("checkPart","鼻/咽拭子");
|
|
|
jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
|
|
|
jsondate.put("chargeFlag","2");
|
|
|
jsondate.put("chargeCode","361322");
|
|
|
jsondate.put("icdCode","Z00.000");
|
|
|
jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
|
|
|
jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
|
|
|
jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
|
|
|
jsondate.put("address2",baseNatAppointmentDO.getCityName());
|
|
|
jsondate.put("address3",baseNatAppointmentDO.getTownName());
|
|
|
jsondate.put("address4",baseNatAppointmentDO.getStreetName());
|
|
|
jsondate.put("address5","");
|
|
|
jsondate.put("area",baseNatAppointmentDO.getAddress());
|
|
|
jsondate.put("winNo","6");
|
|
|
jsondate.put("target","1");
|
|
|
jsondate.put("quantity","1");
|
|
|
if("1".equalsIgnoreCase(baseNatAppointmentDO.getIsSuccess())){
|
|
|
logger.info("挂号开始");
|
|
|
String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
|
|
|
if (map!=null){
|
|
|
List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctorAndDel(baseNatAppointmentDO.getPatientId(), date,map.get("doctorCode").toString() ,1);
|
|
|
net.sf.json.JSONObject rs = new JSONObject();
|
|
|
if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
|
|
|
WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
|
|
|
//判断是否已经挂号,如果已经挂号
|
|
|
if (StringUtils.isNotBlank(registerDO.getConNo()) && StringUtils.isNotBlank(registerDO.getRegisterNo())) {
|
|
|
net.sf.json.JSONObject res = new JSONObject();
|
|
|
res.put("@RESULT", "0");
|
|
|
logger.info("已经挂号 res: " + res.toString());
|
|
|
jsondate.put("serialNo",registerDO.getRegisterNo());
|
|
|
jsondate.put("dept",map.get("deptCode").toString());
|
|
|
jsondate.put("doctor",map.get("doctorMappingCode").toString());
|
|
|
baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
|
|
|
}else {
|
|
|
returnMap.put("msg","已经挂号的数据有误");
|
|
|
returnMap.put("status","-1");
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
return returnMap;
|
|
|
}
|
|
|
}else {
|
|
|
rs = entranceService.BS10111(baseNatAppointmentDO.getMedicare(), map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
|
|
|
net.sf.json.JSONObject res = rs.getJSONObject("resquest");
|
|
|
logger.info("挂号结果 res: " + res.toString());
|
|
|
String rsCode = res.getString("@RESULT");
|
|
|
if ("0".equals(rsCode)) {
|
|
|
//存储挂号号
|
|
|
// {"resquest":{"@RESULT":"0","@MSG":"完成","@serial_no":"47770476","@times":"28"}}
|
|
|
String serialNo = (String) res.get("@serial_no");
|
|
|
String conNo = (String) res.get("@times");
|
|
|
String xtgzh = (String) res.get("@xtgzh");
|
|
|
String realOrder = (String) res.get("@real_order");
|
|
|
logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo);
|
|
|
jsondate.put("serialNo",serialNo);
|
|
|
jsondate.put("dept",map.get("deptCode").toString());
|
|
|
jsondate.put("doctor",map.get("doctorMappingCode").toString());
|
|
|
//存储就诊记录
|
|
|
WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
|
|
|
// 存储挂号医生与挂号科室
|
|
|
registerDO.setDoctor(map.get("doctorCode").toString());
|
|
|
registerDO.setDoctorName(map.get("doctorName").toString());
|
|
|
registerDO.setDept(map.get("deptCode").toString());
|
|
|
registerDO.setDeptName(map.get("deptName").toString());
|
|
|
registerDO.setRealOrder(realOrder);
|
|
|
registerDO.setXtgzh(xtgzh);
|
|
|
registerDO.setPatient(baseNatAppointmentDO.getPatientId());
|
|
|
registerDO.setPatientName(baseNatAppointmentDO.getName());
|
|
|
//挂号流水号与挂号次数
|
|
|
registerDO.setRegisterNo(serialNo);
|
|
|
registerDO.setConNo(conNo);
|
|
|
registerDO.setCreateTime(new Date());
|
|
|
registerDO.setDel(1);
|
|
|
registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
|
|
|
patientRegisterDao.save(registerDO);
|
|
|
//保存日志
|
|
|
WlyyHttpLogDO log = new WlyyHttpLogDO();
|
|
|
log.setCode("registerNat");
|
|
|
log.setName("挂号");
|
|
|
log.setPatient(baseNatAppointmentDO.getPatientId());
|
|
|
log.setDoctor(map.get("doctorCode").toString());
|
|
|
log.setResponse(rs.toString());
|
|
|
log.setStatus(rsCode);
|
|
|
log.setCreateTime(new Date());
|
|
|
wlyyHttpLogDao.save(log);
|
|
|
|
|
|
} else if ("-2".equals(rsCode)) {
|
|
|
String serialNo = (String) res.get("@serial_no");
|
|
|
String xtgzh = (String) res.get("@xtgzh");
|
|
|
String realOrder = (String) res.get("@real_order");
|
|
|
String conNo = (String) res.get("@times");
|
|
|
jsondate.put("serialNo",serialNo);
|
|
|
jsondate.put("dept",map.get("deptCode").toString());
|
|
|
jsondate.put("doctor",map.get("doctorMappingCode").toString());
|
|
|
logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo);
|
|
|
//存储就诊记录
|
|
|
WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
|
|
|
registerDO.setDoctor(map.get("doctorCode").toString());
|
|
|
registerDO.setDoctorName(map.get("doctorName").toString());
|
|
|
registerDO.setDept(map.get("deptCode").toString());
|
|
|
registerDO.setDeptName(map.get("deptName").toString());
|
|
|
registerDO.setRealOrder(realOrder);
|
|
|
registerDO.setXtgzh(xtgzh);
|
|
|
registerDO.setPatient(baseNatAppointmentDO.getPatientId());
|
|
|
registerDO.setPatientName(baseNatAppointmentDO.getName());
|
|
|
registerDO.setRegisterNo(serialNo);
|
|
|
registerDO.setConNo(conNo);
|
|
|
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(baseNatAppointmentDO.getPatientId());
|
|
|
log.setDoctor(map.get("doctorCode").toString());
|
|
|
log.setResponse(rs.toString());
|
|
|
log.setStatus(rsCode);
|
|
|
log.setCreateTime(new Date());
|
|
|
wlyyHttpLogDao.save(log);
|
|
|
}else {
|
|
|
returnMap.put("msg","请求挂号失败");
|
|
|
returnMap.put("status","-1");
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
return returnMap;
|
|
|
}
|
|
|
baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
|
|
|
}
|
|
|
logger.info("开单开始");
|
|
|
logger.info("NatPre params:"+jsondate.toString());
|
|
|
com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
|
|
|
array.add(jsondate);
|
|
|
try {
|
|
|
JSONObject jsonObject = entranceService.BS10112(array.toString(),demoFlag);
|
|
|
//判断返回结果
|
|
|
String prers = jsonObject.getString("@RESULT");
|
|
|
//保存日志
|
|
|
WlyyHttpLogDO log = new WlyyHttpLogDO();
|
|
|
log.setCode("NatAppointment");
|
|
|
log.setName("核酸检测开方");
|
|
|
log.setPatient(baseNatAppointmentDO.getPatientId());
|
|
|
log.setDoctor(map.get("doctorCode").toString());
|
|
|
log.setResponse(jsonObject.toString());
|
|
|
log.setRequest(jsondate.toString());
|
|
|
log.setCreateTime(new Date());
|
|
|
wlyyHttpLogDao.save(log);
|
|
|
if ("0".equals(prers)) {
|
|
|
String realOrder = jsonObject.getString("@real_order");
|
|
|
baseNatAppointmentDO.setRealOrder(realOrder);
|
|
|
baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
|
|
|
String applyDepaName = map.get("deptName").toString();
|
|
|
String voucherNo = jsonObject.getString("@xtgzh0");
|
|
|
String applyDoctorName = map.get("doctorName").toString();
|
|
|
BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId());
|
|
|
String userName = null;
|
|
|
String idcard = null;
|
|
|
if (patientDO != null) {
|
|
|
userName = patientDO.getName();
|
|
|
idcard = patientDO.getIdcard();
|
|
|
}
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(baseNatAppointmentDO.getPatientId());
|
|
|
String userNo = null;
|
|
|
if (patientMappingDO != null) {
|
|
|
userNo = patientMappingDO.getMappingCode();
|
|
|
}
|
|
|
/*JSONObject jsonObject1 =entranceService.BS15054(patientMappingDO.getMappingCode(),realOrder,demoFlag);
|
|
|
net.sf.json.JSONObject res = jsonObject1.getJSONObject("resquest");
|
|
|
logger.info("获取待结算数据 res: " + res.toString());
|
|
|
String rsCode = res.getString("@RESULT");*/
|
|
|
String free= 80+"";
|
|
|
/*if ("0".equals(rsCode)) {
|
|
|
free = res.getString("@total_charge");
|
|
|
}*/
|
|
|
ylzPayService.msgPush("01", baseNatAppointmentDO.getMedicare(), "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
|
|
|
|
|
|
/*//成功后发送模板消息
|
|
|
sendNatWxTemplat(name,cardNo,mobile,natTime,realOrder,"natAppointmentRemind");*/
|
|
|
}else{
|
|
|
returnMap.put("msg","核酸检测开方失败");
|
|
|
returnMap.put("status","-1");
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
return returnMap;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
returnMap.put("msg","预约成功");
|
|
|
returnMap.put("status","200");
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
}else {
|
|
|
returnMap.put("msg","医生映射表找不到对应信息");
|
|
|
returnMap.put("status","-1");
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
}
|
|
|
}else{
|
|
|
returnMap.put("msg","该单状态出错:"+baseNatAppointmentDO.getIsSuccess());
|
|
|
returnMap.put("status","-1");
|
|
|
returnMap.put("id",baseNatAppointmentDO.getId());
|
|
|
}
|
|
|
public String sendAlipayMessage(String patientId,String code,String fee,String redirdctUrl,String reserverTime,String realorder) throws Exception {
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
|
|
|
/* ⽀付提醒通知:
|
|
|
code: 通知代码,⽀付提醒为“2” open_id:⽀付宝⽤户ID user_name: 姓名 order_id: 订单号
|
|
|
create_time: 订单创建时间 fee: ⾦额 url:通知详情跳转链接*/
|
|
|
/*预约成功通知:
|
|
|
code: 通知代码,预约为“4” open_id: ⽀付宝⽤户ID user_name: 姓名 unit_name: 科室名
|
|
|
doctor_name: 医⽣名 order_time: 预约时间 order_no: 预约号*/
|
|
|
|
|
|
/* ⽀付成功通知:
|
|
|
code:通知代码,⽀付成功为“3” open_id:⽀付宝⽤户ID first: 您好,恭喜⽀付成功! fee: ⾦额
|
|
|
fee_type_name: 费⽤类型 url: 通知详情跳转链接 remark: 备注,以\n换⾏*/
|
|
|
|
|
|
BasePatientDO patientDO = basePatientDao.findById(patientId);
|
|
|
|
|
|
if (code.equalsIgnoreCase("3")){
|
|
|
jsonObject.put("code",code);
|
|
|
jsonObject.put("open_id",patientDO.getAlipayId());
|
|
|
jsonObject.put("first",patientDO.getName()+"您好,您有一笔交易支付成功!支付明细如下:");
|
|
|
jsonObject.put("fee_type_name","核酸预约申请");
|
|
|
jsonObject.put("fee",fee);
|
|
|
jsonObject.put("url",redirdctUrl);
|
|
|
String remark = "发票流水号:"+realorder+"\n" +
|
|
|
"点击查看核酸预约开单信息\n" ;
|
|
|
jsonObject.put("remark",remark);
|
|
|
}else if (code.equalsIgnoreCase("13")){
|
|
|
/* code: 通知代码,预约为“13” open_id: ⽀付宝⽤户ID first: 第⼀⾏ keyword1: 第⼆⾏ keyword2: 第三⾏
|
|
|
remark: 备注 url: 详情链接*/
|
|
|
jsonObject.put("code",code);
|
|
|
jsonObject.put("open_id",patientDO.getAlipayId());
|
|
|
jsonObject.put("first","尊敬的用户"+patientDO.getName()+",您已完成线上自助核酸检测预约申请");
|
|
|
jsonObject.put("keyword1",DateUtil.getStringDate());
|
|
|
jsonObject.put("keyword2","申请人:"+patientDO.getName()+"\n" +
|
|
|
"预约时间:"+reserverTime+"\n" +
|
|
|
"发票流水号:"+realorder+"");
|
|
|
String remark = "1、请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\n" +
|
|
|
"2、核酸检测标本采集24小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
|
|
|
jsonObject.put("remark",remark);
|
|
|
jsonObject.put("url",redirdctUrl);
|
|
|
}
|
|
|
|
|
|
String url = "https://xmzsyyfwc.xmpbinfo.cn/weixin/1/notification/push/nucleictest";
|
|
|
logger.info("jsonObject"+jsonObject.toJSONString());
|
|
|
String encdata = AES.encrypt("3bdc154ed1e44a9c9f44451a16d8e0aa",jsonObject.toJSONString());
|
|
|
Map<String, String> params = new HashedMap();
|
|
|
params.put("encdata",encdata);
|
|
|
String reponse = httpClientUtil.httpPost(url,params);
|
|
|
logger.info("支付宝模板消息"+reponse);
|
|
|
return reponse;
|
|
|
|
|
|
}
|
|
|
return returnMap;
|
|
|
}
|
|
|
|
|
|
}
|