|
@ -171,6 +171,78 @@ public class MedOrderService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public JSONObject readCardInfo(String orgCode,String cardNo ,String card_sn,String mdtrt_cert_type,String idcard) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
String sql = " select dp.* from t_mediicine_device de INNER JOIN t_mediicine_device_param dp on de.id = dp.device_id " +
|
|
|
"where de.del=1 and dp.del=1 and de.belong_community='"+orgCode+"' ";
|
|
|
List<Map<String,Object>> deviceParams = jdbcTemplate.queryForList(sql);
|
|
|
if (deviceParams.size()==0){
|
|
|
throw new Exception("药柜参数获取错误");
|
|
|
}
|
|
|
Map<String,Object> deviceParam = deviceParams.get(0);
|
|
|
|
|
|
JSONObject strinObj = JSONObject.parseObject(deviceParam.get("yb_strin").toString());
|
|
|
JSONObject netData = new JSONObject();
|
|
|
netData.put("opter","010XXX");
|
|
|
netData.put("msgid",strinObj.getString("outBizNo")+ DateUtil.getYyyymmddhhmmss(new Date()));
|
|
|
netData.put("opmsgidter","123123");
|
|
|
netData.put("fixmedins_code",strinObj.getString("outBizNo"));
|
|
|
netData.put("opter_name","XX");
|
|
|
netData.put("infver","V1.0");
|
|
|
netData.put("opter_type","1");
|
|
|
netData.put("mdtrtarea_admvs","350200");
|
|
|
netData.put("fixmedins_name","XX");
|
|
|
netData.put("signtype","SM2");
|
|
|
netData.put("recer_sys_code","0");
|
|
|
netData.put("dev_no",strinObj.getString("serialNo"));
|
|
|
JSONObject input = new JSONObject();
|
|
|
JSONObject inputDetail = new JSONObject();
|
|
|
JSONObject dataDetail = new JSONObject();
|
|
|
inputDetail.put("mdtrt_cert_type",mdtrt_cert_type);
|
|
|
if ("01".equals(mdtrt_cert_type)){
|
|
|
|
|
|
}else if ("02".equals(mdtrt_cert_type)){
|
|
|
inputDetail.put("mdtrt_cert_no",idcard);
|
|
|
}
|
|
|
else if ("03".equals(mdtrt_cert_type)){//社保卡时需要传入卡识别码
|
|
|
inputDetail.put("mdtrt_cert_no",cardNo);
|
|
|
if (StringUtils.isNotBlank(card_sn)){
|
|
|
inputDetail.put("card_sn",card_sn);
|
|
|
}else{
|
|
|
sql = " select dict_code,dict_value from wlyy_hospital_sys_dict where dict_name='ylz_card_sn' ";
|
|
|
List<Map<String,Object>> AnalogFlags = jdbcTemplate.queryForList(sql);
|
|
|
String AnalogFlag = "0";
|
|
|
inputDetail.put("mdtrt_cert_no",cardNo);
|
|
|
if (AnalogFlags.size()>0){
|
|
|
AnalogFlag = AnalogFlags.get(0).get("dict_code").toString();
|
|
|
}
|
|
|
if ("1".equals(AnalogFlag)) {//获取调式模拟数据
|
|
|
card_sn = AnalogFlags.get(0).get("dict_value").toString();
|
|
|
inputDetail.put("card_sn",card_sn);
|
|
|
}else {
|
|
|
throw new Exception("卡识别码未传入");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
input.put("data",inputDetail);
|
|
|
dataDetail.put("input",input);
|
|
|
dataDetail.put("net_data",netData);
|
|
|
strinObj.put("func","fsi.terminal.readcard");
|
|
|
strinObj.put("data",dataDetail);
|
|
|
result.put("readcardParam",strinObj.toJSONString());
|
|
|
|
|
|
WlyyHttpLogDO logDO = new WlyyHttpLogDO();
|
|
|
logDO.setCode("fsi.terminal.readcard");
|
|
|
logDO.setName("药柜医保读卡请求参数");
|
|
|
logDO.setPatient(inputDetail.getString("mdtrt_cert_no"));
|
|
|
logDO.setRequest(strinObj.toJSONString());
|
|
|
logDO.setResponse(null);
|
|
|
logDO.setCreateTime(new Date());
|
|
|
httpLogDao.save(logDO);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取患者待结算信息
|
|
|
* 医保个人信息、挂号接口封装
|
|
@ -220,7 +292,7 @@ public class MedOrderService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public com.alibaba.fastjson.JSONArray getSettlementInfoFirst(String recipe_no,String card_sn) throws Exception {
|
|
|
public com.alibaba.fastjson.JSONArray getSettlementInfoFirst(String recipe_no,String card_sn,String mdtrt_cert_type,String idcard) throws Exception {
|
|
|
JSONArray result = new JSONArray();
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByLog_no(recipe_no);
|
|
|
if (null==ylzMedicalRelationDO){
|
|
@ -279,25 +351,37 @@ public class MedOrderService {
|
|
|
JSONObject input = new JSONObject();
|
|
|
JSONObject inputDetail = new JSONObject();
|
|
|
JSONObject dataDetail = new JSONObject();
|
|
|
inputDetail.put("mdtrt_cert_type","03");
|
|
|
inputDetail.put("mdtrt_cert_no",cardNo);
|
|
|
if (StringUtils.isNotBlank(card_sn)){
|
|
|
inputDetail.put("card_sn",card_sn);
|
|
|
}else {
|
|
|
sql = " select dict_code,dict_value from wlyy_hospital_sys_dict where dict_name='ylz_card_sn' ";
|
|
|
List<Map<String,Object>> AnalogFlags = jdbcTemplate.queryForList(sql);
|
|
|
String AnalogFlag = "0";
|
|
|
if (AnalogFlags.size()>0){
|
|
|
AnalogFlag = AnalogFlags.get(0).get("dict_code").toString();
|
|
|
}
|
|
|
if ("1".equals(AnalogFlag)) {//获取调式模拟数据
|
|
|
card_sn = AnalogFlags.get(0).get("dict_value").toString();
|
|
|
inputDetail.put("mdtrt_cert_type",mdtrt_cert_type);
|
|
|
if ("01".equals(mdtrt_cert_type)){
|
|
|
|
|
|
}else if ("02".equals(mdtrt_cert_type)){
|
|
|
inputDetail.put("mdtrt_cert_no",idcard);
|
|
|
}
|
|
|
else if ("03".equals(mdtrt_cert_type)){//社保卡时需要传入卡识别码
|
|
|
inputDetail.put("mdtrt_cert_no",cardNo);
|
|
|
if (StringUtils.isNotBlank(card_sn)){
|
|
|
inputDetail.put("card_sn",card_sn);
|
|
|
}else {
|
|
|
throw new Exception("卡识别码未传入");
|
|
|
}else{
|
|
|
sql = " select dict_code,dict_value from wlyy_hospital_sys_dict where dict_name='ylz_card_sn' ";
|
|
|
List<Map<String,Object>> AnalogFlags = jdbcTemplate.queryForList(sql);
|
|
|
String AnalogFlag = "0";
|
|
|
inputDetail.put("mdtrt_cert_no",cardNo);
|
|
|
if (AnalogFlags.size()>0){
|
|
|
AnalogFlag = AnalogFlags.get(0).get("dict_code").toString();
|
|
|
}
|
|
|
if ("1".equals(AnalogFlag)) {//获取调式模拟数据
|
|
|
card_sn = AnalogFlags.get(0).get("dict_value").toString();
|
|
|
inputDetail.put("card_sn",card_sn);
|
|
|
}else {
|
|
|
throw new Exception("卡识别码未传入");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
ylzMedicalRelationDO.setCardSn(card_sn);
|
|
|
if (StringUtils.isNotBlank(card_sn)){
|
|
|
ylzMedicalRelationDO.setCardSn(card_sn);
|
|
|
}if (StringUtils.isNotBlank(idcard)){
|
|
|
ylzMedicalRelationDO.setIdcard(idcard);
|
|
|
}
|
|
|
ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
input.put("data",inputDetail);
|
|
|
dataDetail.put("input",input);
|
|
@ -331,8 +415,14 @@ public class MedOrderService {
|
|
|
inputDetail.put("psn_no","");//人员编码 前端封装
|
|
|
inputDetail.put("insutype","310");
|
|
|
inputDetail.put("begntime",DateUtil.dateToStrLong(ylzMedicalRelationDO.getDate()));
|
|
|
inputDetail.put("mdtrt_cert_type","03");
|
|
|
inputDetail.put("mdtrt_cert_no",cardNo);
|
|
|
if ("02".equals(mdtrt_cert_type)){
|
|
|
inputDetail.put("mdtrt_cert_no",idcard);
|
|
|
}
|
|
|
else{
|
|
|
inputDetail.put("mdtrt_cert_no",cardNo);
|
|
|
}
|
|
|
inputDetail.put("mdtrt_cert_type",mdtrt_cert_type);
|
|
|
|
|
|
inputDetail.put("ipt_otp_no",ylzMedicalRelationDO.getRelationCode());
|
|
|
inputDetail.put("atddr_no",ylzMedicalRelationDO.getAtddrNo());
|
|
|
inputDetail.put("dr_name",ylzMedicalRelationDO.getDrName());
|
|
@ -453,7 +543,7 @@ public class MedOrderService {
|
|
|
throw new Exception("医保挂号接口失败"+registerObject.getString("retCode"));
|
|
|
}
|
|
|
}
|
|
|
ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
if (0==ylzMedicalRelationDO.getMedicalState()){
|
|
|
resultTmp.put("needCharge",false);
|
|
|
result.add(resultTmp);
|
|
@ -788,7 +878,6 @@ public class MedOrderService {
|
|
|
deptCode = visitDetail.getString("VISIT_DEPT");
|
|
|
deptName = visitDetail.getString("VISIT_DEPT_NAME");
|
|
|
|
|
|
|
|
|
//收费明细
|
|
|
JSONArray SETTLE_DETAILS = visitDetail.getJSONArray("SETTLE_DETAIL");
|
|
|
if (SETTLE_DETAILS!=null&&SETTLE_DETAILS.size()>0) {
|
|
@ -801,6 +890,7 @@ public class MedOrderService {
|
|
|
}
|
|
|
|
|
|
ylzMedicalRelationDO = ylzMedicailRelationDao.findByLog_no(prescription_code);
|
|
|
//新的记录
|
|
|
if (null==ylzMedicalRelationDO){
|
|
|
newYlzRelation = true;
|
|
|
ylzMedicalRelationDO = new YlzMedicalRelationDO();
|
|
@ -808,79 +898,80 @@ public class MedOrderService {
|
|
|
ylzMedicalRelationDO.setStatus(0);
|
|
|
ylzMedicalRelationDO.setState(0);
|
|
|
ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
}
|
|
|
if (!newYlzRelation){
|
|
|
ylzMedicailMxDao.deleteByMedicalId(ylzMedicalRelationDO.getId());
|
|
|
}
|
|
|
for (int j = 0; j < SETTLE_DETAILS.size(); j++) {
|
|
|
SETTLE_DETAIL_OBJ = SETTLE_DETAILS.getJSONObject(j);
|
|
|
YlzMedicalMxDO ylzMedicalMxDO = new YlzMedicalMxDO();
|
|
|
ylzMedicalMxDO.setMedicalId(ylzMedicalRelationDO.getId());//医保关联表id
|
|
|
ylzMedicalMxDO.setPrescriptionCode(prescription_code);//处方code
|
|
|
ylzMedicalMxDO.setHisDetailSn(SETTLE_DETAIL_OBJ.getString("feedetl_sn"));//his处方明细流水号
|
|
|
ylzMedicalMxDO.setItemCode(SETTLE_DETAIL_OBJ.getString("INSUR_ITEM_CODE"));//医保项目编码
|
|
|
ylzMedicalMxDO.setItemName(SETTLE_DETAIL_OBJ.getString("INSUR_ITEM_NAME"));//医保项目名称
|
|
|
ylzMedicalMxDO.setInvoiceType(SETTLE_DETAIL_OBJ.getString("INSUR_INVOICE_TYPE_CODE"));//发票项目类别
|
|
|
ylzMedicalMxDO.setSpecificationType(SETTLE_DETAIL_OBJ.getString("ITEM_SPEC"));//规格型号
|
|
|
ylzMedicalMxDO.setDosageForm(SETTLE_DETAIL_OBJ.getString("PHYSIC_FORM"));//剂型
|
|
|
ylzMedicalMxDO.setChargeUnit(SETTLE_DETAIL_OBJ.getString("ITEM_UNIT"));//单位
|
|
|
ylzMedicalMxDO.setChargeUnitName(SETTLE_DETAIL_OBJ.getString("ITEM_UNIT_NAME"));//单位名称
|
|
|
ylzMedicalMxDO.setPrice(null==SETTLE_DETAIL_OBJ.get("INSUR_ITEM_PRICE")?"0.0":SETTLE_DETAIL_OBJ.getString("INSUR_ITEM_PRICE"));//单价
|
|
|
ylzMedicalMxDO.setAmount(SETTLE_DETAIL_OBJ.getString("ITEM_QUANTITY"));//数量
|
|
|
|
|
|
ylzMedicalMxDO.setTotalMoney(amountDf.format(Double.valueOf(SETTLE_DETAIL_OBJ.getString("COST"))));//金额
|
|
|
totalAmount +=Double.valueOf(SETTLE_DETAIL_OBJ.getString("COST"));
|
|
|
ownPay +=Double.valueOf(SETTLE_DETAIL_OBJ.getString("CHARGE"));
|
|
|
if (null!=SETTLE_DETAIL_OBJ.get("INSUR_ITEM_PRICE")){
|
|
|
INSUR_ITEM_PRICE += Double.valueOf(SETTLE_DETAIL_OBJ.getString("INSUR_ITEM_PRICE"));//医保项目单价
|
|
|
}
|
|
|
ylzMedicalMxDO.setSingleDose(SETTLE_DETAIL_OBJ.getString("PHYSIC_DOSE"));//每次用量
|
|
|
ylzMedicalMxDO.setUseFrequency(SETTLE_DETAIL_OBJ.getString("FREQUENCY"));//使用频率
|
|
|
ylzMedicalMxDO.setMedicalWay(SETTLE_DETAIL_OBJ.getString("PHYSIC_USAGE"));//给药途径
|
|
|
ylzMedicalMxDO.setPrescriptionDate(SETTLE_DETAIL_OBJ.getDate("prescription_date"));//处方日期
|
|
|
ylzMedicalMxDO.setMedicationDays(SETTLE_DETAIL_OBJ.getString("DAY_COUNT"));//执行天数
|
|
|
ylzMedicalMxDO.setDeptCode(SETTLE_DETAIL_OBJ.getString("APPLY_DEPT"));//科室编码
|
|
|
ylzMedicalMxDO.setDeptName(SETTLE_DETAIL_OBJ.getString("APPLY_DEPT_NAME"));//科室名称
|
|
|
ylzMedicalMxDO.setHisDeptCode(SETTLE_DETAIL_OBJ.getString("APPLY_DEPT"));//his内部科室编码
|
|
|
ylzMedicalMxDO.setHisDeptName(SETTLE_DETAIL_OBJ.getString("APPLY_DEPT_NAME"));//his内部科室名称
|
|
|
if (StringUtils.isBlank(hisDeptCode)){
|
|
|
hisDeptCode = SETTLE_DETAIL_OBJ.getString("APPLY_DEPT");
|
|
|
}
|
|
|
if (StringUtils.isBlank(APPLY_TIME)){
|
|
|
APPLY_TIME = SETTLE_DETAIL_OBJ.getString("APPLY_TIME");
|
|
|
}
|
|
|
if (StringUtils.isBlank(hisDeptName)){
|
|
|
hisDeptName = SETTLE_DETAIL_OBJ.getString("APPLY_DEPT_NAME");
|
|
|
}
|
|
|
ylzMedicalMxDO.setMedicalPerName(SETTLE_DETAIL_OBJ.getString("APPLY_OPERATOR_NAME"));//医疗服务人员姓名 开单医生姓名
|
|
|
ylzMedicalMxDO.setMedicalPerId(SETTLE_DETAIL_OBJ.getString("APPLY_OPERATOR"));//医疗服务人员证件号码 开单医生编码
|
|
|
if (StringUtils.isBlank(collector)){
|
|
|
collector = SETTLE_DETAIL_OBJ.getString("APPLY_OPERATOR");
|
|
|
|
|
|
for (int j = 0; j < SETTLE_DETAILS.size(); j++) {
|
|
|
SETTLE_DETAIL_OBJ = SETTLE_DETAILS.getJSONObject(j);
|
|
|
YlzMedicalMxDO ylzMedicalMxDO = new YlzMedicalMxDO();
|
|
|
ylzMedicalMxDO.setMedicalId(ylzMedicalRelationDO.getId());//医保关联表id
|
|
|
ylzMedicalMxDO.setPrescriptionCode(prescription_code);//处方code
|
|
|
ylzMedicalMxDO.setHisDetailSn(SETTLE_DETAIL_OBJ.getString("feedetl_sn"));//his处方明细流水号
|
|
|
ylzMedicalMxDO.setItemCode(SETTLE_DETAIL_OBJ.getString("INSUR_ITEM_CODE"));//医保项目编码
|
|
|
ylzMedicalMxDO.setItemName(SETTLE_DETAIL_OBJ.getString("INSUR_ITEM_NAME"));//医保项目名称
|
|
|
ylzMedicalMxDO.setInvoiceType(SETTLE_DETAIL_OBJ.getString("INSUR_INVOICE_TYPE_CODE"));//发票项目类别
|
|
|
ylzMedicalMxDO.setSpecificationType(SETTLE_DETAIL_OBJ.getString("ITEM_SPEC"));//规格型号
|
|
|
ylzMedicalMxDO.setDosageForm(SETTLE_DETAIL_OBJ.getString("PHYSIC_FORM"));//剂型
|
|
|
ylzMedicalMxDO.setChargeUnit(SETTLE_DETAIL_OBJ.getString("ITEM_UNIT"));//单位
|
|
|
ylzMedicalMxDO.setChargeUnitName(SETTLE_DETAIL_OBJ.getString("ITEM_UNIT_NAME"));//单位名称
|
|
|
ylzMedicalMxDO.setPrice(null==SETTLE_DETAIL_OBJ.get("INSUR_ITEM_PRICE")?"0.0":SETTLE_DETAIL_OBJ.getString("INSUR_ITEM_PRICE"));//单价
|
|
|
ylzMedicalMxDO.setAmount(SETTLE_DETAIL_OBJ.getString("ITEM_QUANTITY"));//数量
|
|
|
|
|
|
ylzMedicalMxDO.setTotalMoney(amountDf.format(Double.valueOf(SETTLE_DETAIL_OBJ.getString("COST"))));//金额
|
|
|
totalAmount +=Double.valueOf(SETTLE_DETAIL_OBJ.getString("COST"));
|
|
|
ownPay +=Double.valueOf(SETTLE_DETAIL_OBJ.getString("CHARGE"));
|
|
|
if (null!=SETTLE_DETAIL_OBJ.get("INSUR_ITEM_PRICE")){
|
|
|
INSUR_ITEM_PRICE += Double.valueOf(SETTLE_DETAIL_OBJ.getString("INSUR_ITEM_PRICE"));//医保项目单价
|
|
|
}
|
|
|
ylzMedicalMxDO.setSingleDose(SETTLE_DETAIL_OBJ.getString("PHYSIC_DOSE"));//每次用量
|
|
|
ylzMedicalMxDO.setUseFrequency(SETTLE_DETAIL_OBJ.getString("FREQUENCY"));//使用频率
|
|
|
ylzMedicalMxDO.setMedicalWay(SETTLE_DETAIL_OBJ.getString("PHYSIC_USAGE"));//给药途径
|
|
|
ylzMedicalMxDO.setPrescriptionDate(SETTLE_DETAIL_OBJ.getDate("prescription_date"));//处方日期
|
|
|
ylzMedicalMxDO.setMedicationDays(SETTLE_DETAIL_OBJ.getString("DAY_COUNT"));//执行天数
|
|
|
ylzMedicalMxDO.setDeptCode(SETTLE_DETAIL_OBJ.getString("APPLY_DEPT"));//科室编码
|
|
|
ylzMedicalMxDO.setDeptName(SETTLE_DETAIL_OBJ.getString("APPLY_DEPT_NAME"));//科室名称
|
|
|
ylzMedicalMxDO.setHisDeptCode(SETTLE_DETAIL_OBJ.getString("APPLY_DEPT"));//his内部科室编码
|
|
|
ylzMedicalMxDO.setHisDeptName(SETTLE_DETAIL_OBJ.getString("APPLY_DEPT_NAME"));//his内部科室名称
|
|
|
if (StringUtils.isBlank(hisDeptCode)){
|
|
|
hisDeptCode = SETTLE_DETAIL_OBJ.getString("APPLY_DEPT");
|
|
|
}
|
|
|
if (StringUtils.isBlank(APPLY_TIME)){
|
|
|
APPLY_TIME = SETTLE_DETAIL_OBJ.getString("APPLY_TIME");
|
|
|
}
|
|
|
if (StringUtils.isBlank(hisDeptName)){
|
|
|
hisDeptName = SETTLE_DETAIL_OBJ.getString("APPLY_DEPT_NAME");
|
|
|
}
|
|
|
ylzMedicalMxDO.setMedicalPerName(SETTLE_DETAIL_OBJ.getString("APPLY_OPERATOR_NAME"));//医疗服务人员姓名 开单医生姓名
|
|
|
ylzMedicalMxDO.setMedicalPerId(SETTLE_DETAIL_OBJ.getString("APPLY_OPERATOR"));//医疗服务人员证件号码 开单医生编码
|
|
|
if (StringUtils.isBlank(collector)){
|
|
|
collector = SETTLE_DETAIL_OBJ.getString("APPLY_OPERATOR");
|
|
|
}
|
|
|
ylzMedicalMxDO.setLimitType(SETTLE_DETAIL_OBJ.getString("INSUR_FLAG"));//限制范围类别
|
|
|
ylzMedicalMxDO.setActgDate(SETTLE_DETAIL_OBJ.getDate("fee_ocur_time"));//记帐日期
|
|
|
ylzMedicalMxDO.setHisItemCode(SETTLE_DETAIL_OBJ.getString("ITEM_CODE"));//HIS院内项目编码
|
|
|
ylzMedicalMxDO.setHisItemName(SETTLE_DETAIL_OBJ.getString("ITEM_NAME"));//HIS院内项目名称
|
|
|
ylzMedicalMxDO.setClerkDays(SETTLE_DETAIL_OBJ.getDate("fee_ocur_time"));//记帐日期
|
|
|
ylzMedicalMxDO.setPrescriptionDate(visitDate);
|
|
|
ylzMedicalMxDO.setPeopleType(null);//医保服务人员类别 todo
|
|
|
ylzMedicalMxDO.setDel(1);
|
|
|
ylzMedicalMxDO.setCreateTime(new Date());
|
|
|
ylzMedicalMxDO.setSetlMsgid(SETTLE_DETAIL_OBJ.getString("setl_msgid"));
|
|
|
ylzMedicalMxDO.setFeeMsgid(SETTLE_DETAIL_OBJ.getString("fee_msgid"));
|
|
|
ylzMedicalMxDO.setInsurSettleSort(SETTLE_DETAIL_OBJ.getString("INSUR_SETTLE_SORT"));
|
|
|
ylzMedicalMxDO.setChrgBchno(SETTLE_DETAIL_OBJ.getString("chrg_bchno"));
|
|
|
ylzMedicalMxDO.setRxCircFlag(SETTLE_DETAIL_OBJ.getString("rx_circ_flag"));
|
|
|
|
|
|
ylzMedicalMxDO.setBilgDeptCodg(SETTLE_DETAIL_OBJ.getString("bilg_dept_codg"));
|
|
|
ylzMedicalMxDO.setBilgDeptName(SETTLE_DETAIL_OBJ.getString("bilg_dept_name"));
|
|
|
ylzMedicalMxDO.setBilgDrCodg(SETTLE_DETAIL_OBJ.getString("APPLY_OPERATOR"));
|
|
|
ylzMedicalMxDO.setBilgDrName(SETTLE_DETAIL_OBJ.getString("APPLY_OPERATOR_NAME"));
|
|
|
ylzMedicalMxDO.setHospApprFlag(SETTLE_DETAIL_OBJ.getString("hosp_appr_flag"));
|
|
|
ylzMedicalMxDO.setRxno(SETTLE_DETAIL_OBJ.getString("APPLY_NO"));
|
|
|
ylzMedicalMxDO.setPsnSetlway(SETTLE_DETAIL_OBJ.getString("psn_setlway"));
|
|
|
ylzMedicailMxDao.save(ylzMedicalMxDO);
|
|
|
mxDOList.add(ylzMedicalMxDO);
|
|
|
}
|
|
|
ylzMedicalMxDO.setLimitType(SETTLE_DETAIL_OBJ.getString("INSUR_FLAG"));//限制范围类别
|
|
|
ylzMedicalMxDO.setActgDate(SETTLE_DETAIL_OBJ.getDate("fee_ocur_time"));//记帐日期
|
|
|
ylzMedicalMxDO.setHisItemCode(SETTLE_DETAIL_OBJ.getString("ITEM_CODE"));//HIS院内项目编码
|
|
|
ylzMedicalMxDO.setHisItemName(SETTLE_DETAIL_OBJ.getString("ITEM_NAME"));//HIS院内项目名称
|
|
|
ylzMedicalMxDO.setClerkDays(SETTLE_DETAIL_OBJ.getDate("fee_ocur_time"));//记帐日期
|
|
|
ylzMedicalMxDO.setPrescriptionDate(visitDate);
|
|
|
ylzMedicalMxDO.setPeopleType(null);//医保服务人员类别 todo
|
|
|
ylzMedicalMxDO.setDel(1);
|
|
|
ylzMedicalMxDO.setCreateTime(new Date());
|
|
|
ylzMedicalMxDO.setSetlMsgid(SETTLE_DETAIL_OBJ.getString("setl_msgid"));
|
|
|
ylzMedicalMxDO.setFeeMsgid(SETTLE_DETAIL_OBJ.getString("fee_msgid"));
|
|
|
ylzMedicalMxDO.setInsurSettleSort(SETTLE_DETAIL_OBJ.getString("INSUR_SETTLE_SORT"));
|
|
|
ylzMedicalMxDO.setChrgBchno(SETTLE_DETAIL_OBJ.getString("chrg_bchno"));
|
|
|
ylzMedicalMxDO.setRxCircFlag(SETTLE_DETAIL_OBJ.getString("rx_circ_flag"));
|
|
|
|
|
|
ylzMedicalMxDO.setBilgDeptCodg(SETTLE_DETAIL_OBJ.getString("bilg_dept_codg"));
|
|
|
ylzMedicalMxDO.setBilgDeptName(SETTLE_DETAIL_OBJ.getString("bilg_dept_name"));
|
|
|
ylzMedicalMxDO.setBilgDrCodg(SETTLE_DETAIL_OBJ.getString("APPLY_OPERATOR"));
|
|
|
ylzMedicalMxDO.setBilgDrName(SETTLE_DETAIL_OBJ.getString("APPLY_OPERATOR_NAME"));
|
|
|
ylzMedicalMxDO.setHospApprFlag(SETTLE_DETAIL_OBJ.getString("hosp_appr_flag"));
|
|
|
ylzMedicalMxDO.setRxno(SETTLE_DETAIL_OBJ.getString("APPLY_NO"));
|
|
|
ylzMedicalMxDO.setPsnSetlway(SETTLE_DETAIL_OBJ.getString("psn_setlway"));
|
|
|
ylzMedicailMxDao.save(ylzMedicalMxDO);
|
|
|
mxDOList.add(ylzMedicalMxDO);
|
|
|
}else {
|
|
|
List<YlzMedicalMxDO> ylzMedicalMxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
|
|
|
mxDOList.addAll(ylzMedicalMxDOList);
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -888,25 +979,27 @@ public class MedOrderService {
|
|
|
JSONArray DIAGNOSIS_DETAIL = visitDetail.getJSONArray("DIAGNOSIS_DETAIL");
|
|
|
if (DIAGNOSIS_DETAIL!=null&&DIAGNOSIS_DETAIL.size()>0){
|
|
|
if (!newYlzRelation){
|
|
|
ylzMedicailIcdDao.deleteByMedicalId(ylzMedicalRelationDO.getId());
|
|
|
}
|
|
|
for (int j=0;j<DIAGNOSIS_DETAIL.size();j++){
|
|
|
JSONObject DIAGNOSIS_DETAIL_OBJ = DIAGNOSIS_DETAIL.getJSONObject(j);
|
|
|
YlzMedicalIcdDO ylzMedicalIcdDO = new YlzMedicalIcdDO();
|
|
|
ylzMedicalIcdDO.setMedicalId(ylzMedicalRelationDO.getId());//医保关联表id
|
|
|
ylzMedicalIcdDO.setDiseaseCodeIcd10(DIAGNOSIS_DETAIL_OBJ.getString("diag_code"));
|
|
|
ylzMedicalIcdDO.setDiseaseNameIcd10(DIAGNOSIS_DETAIL_OBJ.getString("diag_name"));
|
|
|
ylzMedicalIcdDO.setDiseaseType(DIAGNOSIS_DETAIL_OBJ.getString("diag_type"));//诊断或症状类型
|
|
|
ylzMedicalIcdDO.setDiseaseOrder(DIAGNOSIS_DETAIL_OBJ.getString("diag_srt_no"));//诊断或症状序号
|
|
|
ylzMedicalIcdDO.setCreateTime(new Date());
|
|
|
ylzMedicalIcdDO.setDiseMsgid(DIAGNOSIS_DETAIL_OBJ.getString("dise_msgid"));
|
|
|
ylzMedicalIcdDO.setDiagDept(DIAGNOSIS_DETAIL_OBJ.getString("diag_dept"));
|
|
|
ylzMedicalIcdDO.setDiseDorNo(DIAGNOSIS_DETAIL_OBJ.getString("dise_dor_no"));
|
|
|
ylzMedicalIcdDO.setDiseDorName(DIAGNOSIS_DETAIL_OBJ.getString("dise_dor_name"));
|
|
|
ylzMedicalIcdDO.setDiagTime(DIAGNOSIS_DETAIL_OBJ.getString("diag_time"));
|
|
|
ylzMedicalIcdDO.setDel(Integer.valueOf(DIAGNOSIS_DETAIL_OBJ.getString("vali_flag")));
|
|
|
ylzMedicailIcdDao.save(ylzMedicalIcdDO);
|
|
|
icdDOList.add(ylzMedicalIcdDO);
|
|
|
List<YlzMedicalIcdDO> ylzMedicalIcdDOList = ylzMedicailIcdDao.findByMedicalId(ylzMedicalRelationDO.getId());
|
|
|
icdDOList.addAll(ylzMedicalIcdDOList);
|
|
|
}else {
|
|
|
for (int j=0;j<DIAGNOSIS_DETAIL.size();j++){
|
|
|
JSONObject DIAGNOSIS_DETAIL_OBJ = DIAGNOSIS_DETAIL.getJSONObject(j);
|
|
|
YlzMedicalIcdDO ylzMedicalIcdDO = new YlzMedicalIcdDO();
|
|
|
ylzMedicalIcdDO.setMedicalId(ylzMedicalRelationDO.getId());//医保关联表id
|
|
|
ylzMedicalIcdDO.setDiseaseCodeIcd10(DIAGNOSIS_DETAIL_OBJ.getString("diag_code"));
|
|
|
ylzMedicalIcdDO.setDiseaseNameIcd10(DIAGNOSIS_DETAIL_OBJ.getString("diag_name"));
|
|
|
ylzMedicalIcdDO.setDiseaseType(DIAGNOSIS_DETAIL_OBJ.getString("diag_type"));//诊断或症状类型
|
|
|
ylzMedicalIcdDO.setDiseaseOrder(DIAGNOSIS_DETAIL_OBJ.getString("diag_srt_no"));//诊断或症状序号
|
|
|
ylzMedicalIcdDO.setCreateTime(new Date());
|
|
|
ylzMedicalIcdDO.setDiseMsgid(DIAGNOSIS_DETAIL_OBJ.getString("dise_msgid"));
|
|
|
ylzMedicalIcdDO.setDiagDept(DIAGNOSIS_DETAIL_OBJ.getString("diag_dept"));
|
|
|
ylzMedicalIcdDO.setDiseDorNo(DIAGNOSIS_DETAIL_OBJ.getString("dise_dor_no"));
|
|
|
ylzMedicalIcdDO.setDiseDorName(DIAGNOSIS_DETAIL_OBJ.getString("dise_dor_name"));
|
|
|
ylzMedicalIcdDO.setDiagTime(DIAGNOSIS_DETAIL_OBJ.getString("diag_time"));
|
|
|
ylzMedicalIcdDO.setDel(Integer.valueOf(DIAGNOSIS_DETAIL_OBJ.getString("vali_flag")));
|
|
|
ylzMedicailIcdDao.save(ylzMedicalIcdDO);
|
|
|
icdDOList.add(ylzMedicalIcdDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -914,7 +1007,7 @@ public class MedOrderService {
|
|
|
if(!amountDf.format(totalAmount).equals(SUM_COST)||!amountDf.format(ownPay).equals(SUM_CHARGE)){
|
|
|
throw new Exception("金额不对无法结算");
|
|
|
}
|
|
|
if (ylzMedicalRelationDO.getStatus()!=1){
|
|
|
if (newYlzRelation){
|
|
|
ylzMedicalRelationDO.setLogNo(prescription_code);
|
|
|
ylzMedicalRelationDO.setOrgCode(orgCode);
|
|
|
ylzMedicalRelationDO.setRegionCode("350200");
|
|
@ -938,21 +1031,6 @@ public class MedOrderService {
|
|
|
ylzMedicalRelationDO.setTotalAmount(SUM_COST);
|
|
|
ylzMedicalRelationDO.setPreCharges("0");//预扣费金额
|
|
|
ylzMedicalRelationDO.setDataSource("53");
|
|
|
|
|
|
String balance =null;
|
|
|
JSONObject balanceObj = jwService.getSickDispBalance(ylzMedicalRelationDO.getCardNo(),ylzMedicalRelationDO.getOrgCode());
|
|
|
if (balanceObj.getString("status").equalsIgnoreCase("200")) {//i健康返回值
|
|
|
JSONObject responseDataTmp = balanceObj.getJSONObject("data");
|
|
|
String codeTMP = responseDataTmp.getString("CODE");//智业返回值 0失败 1成功
|
|
|
if (codeTMP.equalsIgnoreCase("1")) {
|
|
|
JSONArray byRefParaData = responseDataTmp.getJSONArray("byRefParaData");
|
|
|
if (byRefParaData.size()>0){
|
|
|
balance = byRefParaData.getJSONObject(0).getString("dispBalance");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
ylzMedicalRelationDO.setBalance(balance);//预缴金余额
|
|
|
|
|
|
ylzMedicalRelationDO.setPreCount(presItemCount);//处方项目数
|
|
|
ylzMedicalRelationDO.setDoctorLevel("02");
|
|
|
ylzMedicalRelationDO.setRelationCode(VISIT_NO);
|
|
@ -977,6 +1055,21 @@ public class MedOrderService {
|
|
|
ylzMedicalRelationDO.setDrName(dr_name);
|
|
|
ylzMedicalRelationDO.setVisitMsgid(visit_msgid);
|
|
|
}
|
|
|
if (ylzMedicalRelationDO.getStatus()!=1){
|
|
|
String balance =null;
|
|
|
JSONObject balanceObj = jwService.getSickDispBalance(ylzMedicalRelationDO.getCardNo(),ylzMedicalRelationDO.getOrgCode());
|
|
|
if (balanceObj.getString("status").equalsIgnoreCase("200")) {//i健康返回值
|
|
|
JSONObject responseDataTmp = balanceObj.getJSONObject("data");
|
|
|
String codeTMP = responseDataTmp.getString("CODE");//智业返回值 0失败 1成功
|
|
|
if (codeTMP.equalsIgnoreCase("1")) {
|
|
|
JSONArray byRefParaData = responseDataTmp.getJSONArray("byRefParaData");
|
|
|
if (byRefParaData.size()>0){
|
|
|
balance = byRefParaData.getJSONObject(0).getString("dispBalance");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
ylzMedicalRelationDO.setBalance(balance);//预缴金余额
|
|
|
}
|
|
|
if (1==ylzMedicalRelationDO.getMedicalState()&&0.0==Double.valueOf(ylzMedicalRelationDO.getTotalAmount())){
|
|
|
//费用为0的医保结算也需要当作自费处理
|
|
|
ylzMedicalRelationDO.setMedicalState(0);
|
|
@ -1028,7 +1121,7 @@ public class MedOrderService {
|
|
|
personCash.add(personCashTmp);//个人现金支付
|
|
|
if (0==personCashTmp.doubleValue()){//费用为0
|
|
|
try {
|
|
|
if (!jwService.executeSickSettleMultiNew(recipe_no)){
|
|
|
if (!jwService.executeSickSettleMultiNew(recipe_no,equ_num)){
|
|
|
chargeSettle.add(recipe_no);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
@ -1072,7 +1165,7 @@ public class MedOrderService {
|
|
|
else{
|
|
|
for (String recipe_no:chargeSettle){
|
|
|
try {
|
|
|
if (jwService.executeSickSettleMultiNew(recipe_no)){
|
|
|
if (jwService.executeSickSettleMultiNew(recipe_no,equ_num)){
|
|
|
if (settledErrors.contains(recipe_no)){
|
|
|
settledErrors.remove(recipe_no);
|
|
|
}
|
|
@ -1127,7 +1220,7 @@ public class MedOrderService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean executeSickSettleMultiNew(String recipe_no) throws Exception {
|
|
|
public boolean executeSickSettleMultiNew(String recipe_no,String equ_num) throws Exception {
|
|
|
String sql = " select dict_code,dict_value from wlyy_hospital_sys_dict where dict_name='his_settlement' ";
|
|
|
List<Map<String,Object>> AnalogFlags = jdbcTemplate.queryForList(sql);
|
|
|
String AnalogFlag = "0";
|
|
@ -1143,7 +1236,7 @@ public class MedOrderService {
|
|
|
ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
return true;
|
|
|
}
|
|
|
return jwService.executeSickSettleMultiNew(recipe_no);
|
|
|
return jwService.executeSickSettleMultiNew(recipe_no,equ_num);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -1177,7 +1270,7 @@ public class MedOrderService {
|
|
|
*/
|
|
|
public List<Map<String,Object>> getYjjChargeList(String cardNo,String startTime,String endTime) throws Exception {
|
|
|
List<Map<String,Object>> list = new ArrayList<>();
|
|
|
String sql = "select *,CAST(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') as char) create_time from base_ylz_medical_recharge where ssc='"+cardNo+"' and charge_result<>'ing' ";
|
|
|
String sql = "select *,CAST(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') as char) create_time from base_ylz_medical_recharge where ssc='"+cardNo+"' ";
|
|
|
if (StringUtils.isNotBlank(startTime)){
|
|
|
sql +=" and create_time>='"+startTime+" 00:00:00' ";
|
|
|
}
|