|
@ -25,6 +25,7 @@ import net.sf.json.xml.XMLSerializer;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
|
import org.checkerframework.checker.units.qual.A;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -336,6 +337,7 @@ public class TasyNatService {
|
|
|
xml=xml.substring(xml.indexOf("<root>"),xml.lastIndexOf("]]"));
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
saveHttpLog("ChargenucleicBill",jsonObject.toString(),json,"ChargenucleicBill");
|
|
|
logger.info("ChargenucleicBill json:"+json);
|
|
|
return json;
|
|
|
}
|
|
@ -540,7 +542,7 @@ public class TasyNatService {
|
|
|
key2.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
key3.put("value",wxTemplateConfigDO1.getKeyword3());
|
|
|
key3.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
key4.put("value",baseNatAppointmentD0.getDoctorName());
|
|
|
key4.put("value",baseNatAppointmentD0.getChargeAmount());
|
|
|
key4.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
key5.put("value",baseNatAppointmentD0.getVoucherNo());
|
|
|
key5.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
@ -798,6 +800,7 @@ public class TasyNatService {
|
|
|
logger.info("QueryApplyInfo json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
public void savePayStatusByHis(String patientId) throws Exception {
|
|
|
List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientId(patientId);
|
|
|
for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
|
|
@ -809,6 +812,11 @@ public class TasyNatService {
|
|
|
baseNatAppointmentDO.setVoucherNo(voucherNo);
|
|
|
if ("已扣费".equalsIgnoreCase(jsonObject.getString("Status"))){
|
|
|
baseNatAppointmentDO.setPayStatus("1");
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
|
|
|
if (businessOrderDO!=null){
|
|
|
businessOrderDO.setStatus(1);
|
|
|
businessOrderDao.save(businessOrderDO);
|
|
|
}
|
|
|
}
|
|
|
baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
}
|
|
@ -830,7 +838,12 @@ public class TasyNatService {
|
|
|
if (wechatList!=null&&wechatList.size()>0){
|
|
|
openId=wechatList.get(0).getOpenid();
|
|
|
}
|
|
|
businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
|
|
|
if (StringUtils.isNoneBlank(businessOrderDO.getOrderNo())){
|
|
|
String orderNo= businessOrderDO.getOrderNo();
|
|
|
String newOrder="HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100;
|
|
|
businessOrderDO.setOrderNo(newOrder);
|
|
|
businessOrderDO.setHistoryOrder(orderNo+","+newOrder);
|
|
|
}
|
|
|
com.alibaba.fastjson.JSONObject orderObj= new com.alibaba.fastjson.JSONObject();
|
|
|
orderObj.put("payType",1);
|
|
|
orderObj.put("tradeNo",businessOrderDO.getOrderNo());
|
|
@ -919,4 +932,106 @@ public class TasyNatService {
|
|
|
logger.info("hdrQueryDataWS json:"+json);
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
public Map checkBalance(String relationCode) throws Exception{
|
|
|
BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.parseInt(relationCode));
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("MzBalance");
|
|
|
String tmpBalance="";
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
tmpBalance=wlyyHospitalSysDictDO.getDictValue();
|
|
|
}
|
|
|
String res = findHisPatientCard(baseNatAppointmentDO.getCardNo());
|
|
|
String mediacard=baseNatAppointmentDO.getMedicare();
|
|
|
Map result=new HashMap();
|
|
|
if (StringUtils.isNoneBlank(res)){
|
|
|
JSONObject jsonObject = JSON.parseObject(res);
|
|
|
if ("1".equalsIgnoreCase(jsonObject.getString("ReturnCode"))) {
|
|
|
String patients=jsonObject.getString("patients");
|
|
|
if (patients.contains("[")){
|
|
|
JSONArray jsonArray = JSON.parseArray(patients);
|
|
|
if (jsonArray != null && jsonArray.size() > 0) {
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
JSONObject child = jsonArray.getJSONObject(i);
|
|
|
if (mediacard.equalsIgnoreCase(child.getString("CardNo"))) {
|
|
|
String MzBalance = child.getString("MzBalance");
|
|
|
if (StringUtils.isNoneBlank(tmpBalance)){
|
|
|
MzBalance=tmpBalance;
|
|
|
}
|
|
|
BigDecimal b = new BigDecimal(MzBalance);
|
|
|
b=b.setScale(2, BigDecimal.ROUND_DOWN);
|
|
|
System.out.println("MzBalance====="+MzBalance);
|
|
|
if (StringUtils.isNoneBlank(MzBalance) && b.compareTo(new BigDecimal("0")) < 0) {
|
|
|
result.put("msgCode", "-1");
|
|
|
result.put("msg", "余额不足");
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}else {
|
|
|
try {
|
|
|
JSONObject jsonObject1= JSONObject.parseObject(patients);
|
|
|
if (mediacard.equalsIgnoreCase(jsonObject1.getString("CardNo"))) {
|
|
|
String MzBalance = jsonObject1.getString("MzBalance");
|
|
|
if (StringUtils.isNoneBlank(tmpBalance)){
|
|
|
MzBalance=tmpBalance;
|
|
|
}
|
|
|
System.out.println("MzBalance====="+MzBalance);
|
|
|
BigDecimal b = new BigDecimal(MzBalance);
|
|
|
b=b.setScale(2, BigDecimal.ROUND_DOWN);
|
|
|
System.out.println("MzBalance====="+b);
|
|
|
if (StringUtils.isNoneBlank(MzBalance) && b.compareTo(new BigDecimal("0")) < 0) {
|
|
|
result.put("msgCode", "-1");
|
|
|
result.put("msg", "余额不足");
|
|
|
return result;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
result.put("msgCode","-1000");
|
|
|
result.put("msg","json格式验证失败");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
result.put("msgCode","200");
|
|
|
result.put("msg","验证通过");
|
|
|
return result;
|
|
|
}
|
|
|
public String getPatientHisId(String idcard,String mediacard) throws Exception{
|
|
|
String res = findHisPatientCard(idcard);
|
|
|
JSONObject jsonObject = JSON.parseObject(res);
|
|
|
if ("1".equalsIgnoreCase(jsonObject.getString("ReturnCode"))) {
|
|
|
String patients=jsonObject.getString("patients");
|
|
|
if (patients.contains("[")) {
|
|
|
JSONArray jsonArray = JSON.parseArray(patients);
|
|
|
if (jsonArray != null && jsonArray.size() > 0) {
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
JSONObject child = jsonArray.getJSONObject(i);
|
|
|
if (mediacard.equalsIgnoreCase(child.getString("CardNo"))) {
|
|
|
String Patientid = child.getString("Patientid");
|
|
|
return Patientid;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
try {
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(patients);
|
|
|
if (mediacard.equalsIgnoreCase(jsonObject1.getString("CardNo"))) {
|
|
|
String Patientid = jsonObject1.getString("Patientid");
|
|
|
return Patientid;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
}
|