|
@ -722,6 +722,154 @@ public class HealthCareService {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 2.2.1 门诊提醒(N21.08.09.01)
|
|
|
|
*/
|
|
|
|
public String outpatientReminder(String outpatientId,String doctorCode)throws Exception{
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId);
|
|
|
|
if (outpatientDO == null){
|
|
|
|
throw new Exception("门诊信息不存在");
|
|
|
|
}
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
|
// data.put("order_code","");//订单号
|
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
|
|
|
|
if(wlyyPrescriptionDOS.size()==0){
|
|
|
|
throw new Exception("处方信息不存在");
|
|
|
|
}
|
|
|
|
|
|
|
|
data.put("card_no",outpatientDO.getCardNo());//社保卡号
|
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(outpatientDO.getDoctor());
|
|
|
|
if(doctorHospitalDOS.size()<=0){
|
|
|
|
throw new Exception("未找到医生科室编码");
|
|
|
|
}
|
|
|
|
BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
|
|
|
|
data.put("medical_dept_code",doctorHospitalDO.getDeptCode());//科室编码(使用医院科室编号)
|
|
|
|
data.put("medical_dept_name",doctorHospitalDO.getDeptName());//科室名称
|
|
|
|
data.put("doctor_code",doctorCode);//医师编号(使用医保医生编号)
|
|
|
|
data.put("doctor_name",outpatientDO.getDoctorName());//医师姓名
|
|
|
|
|
|
|
|
String result = requestYlz(data,"N21.08.09.01","门诊提醒");
|
|
|
|
if(result == null){
|
|
|
|
throw new Exception("医保请求失败");
|
|
|
|
}
|
|
|
|
logger.info("门诊提醒:"+result);
|
|
|
|
JSONObject object = JSONObject.parseObject(result);
|
|
|
|
if (object.getString("flag").equalsIgnoreCase("1")){
|
|
|
|
JSONObject encryptData = object.getJSONObject("encrypt_data");
|
|
|
|
return encryptData.toJSONString();
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 2.2.2 门诊事中提醒(N21.08.09.02)
|
|
|
|
*/
|
|
|
|
public String outpatientEventReminder(String outpatientId,String doctorCode)throws Exception{
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId);
|
|
|
|
if (outpatientDO == null){
|
|
|
|
throw new Exception("门诊信息不存在");
|
|
|
|
}
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
|
// data.put("order_code","");//订单号
|
|
|
|
|
|
|
|
data.put("card_no",outpatientDO.getCardNo());//社保卡号
|
|
|
|
data.put("visit_no",outpatientDO.getRegisterNo());//门诊挂号号
|
|
|
|
data.put("visit_type","1");//就诊类型 String Y (1住院、2门诊)
|
|
|
|
data.put("medicine_type","");//医疗类别 String Y
|
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(outpatientDO.getDoctor());
|
|
|
|
if(doctorHospitalDOS.size()<=0){
|
|
|
|
throw new Exception("未找到医生科室编码");
|
|
|
|
}
|
|
|
|
|
|
|
|
BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
|
|
|
|
data.put("medical_dept_code",doctorHospitalDO.getDeptCode());//科室编码(使用医院科室编号)
|
|
|
|
data.put("medical_dept_name",doctorHospitalDO.getDeptName());//科室名称
|
|
|
|
data.put("doctor_code",doctorCode);//医师编号(使用医保医生编号)
|
|
|
|
data.put("doctor_name",outpatientDO.getDoctorName());//医师姓名
|
|
|
|
data.put("doctor_advice_no","");// 处方流水号(医院内部唯一号) String Y
|
|
|
|
|
|
|
|
//医嘱
|
|
|
|
JSONArray advice_details = new JSONArray();
|
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
|
|
|
|
if(wlyyPrescriptionDOS.size()==0){
|
|
|
|
throw new Exception("处方信息不存在");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (WlyyPrescriptionDO wlyyPrescriptionDO:wlyyPrescriptionDOS){
|
|
|
|
List<WlyyPrescriptionInfoDO> prescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
|
|
|
|
for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:prescriptionInfoDOS){
|
|
|
|
JSONObject infoObj = new JSONObject();
|
|
|
|
infoObj.put("project_code","");//项目编码 String Y (使用医保三目录项目编码),正常情况必填,特殊情况,如生化全套等没有医保编码,可放空。
|
|
|
|
infoObj.put("hospital_code","");//院内项目编码
|
|
|
|
infoObj.put("project_name","");//项目名称
|
|
|
|
infoObj.put("recipe_no",wlyyPrescriptionDO.getRealOrder());//处方号
|
|
|
|
infoObj.put("invoice_project","");//发票项目编码 String Y (使用医保发票项目编码)
|
|
|
|
|
|
|
|
infoObj.put("medical_specification",wlyyPrescriptionInfoDO.getSpecification());//规格型号
|
|
|
|
infoObj.put("dose_form",wlyyPrescriptionInfoDO.getDosage());//剂型
|
|
|
|
infoObj.put("charge_unit","");//单位
|
|
|
|
infoObj.put("price",wlyyPrescriptionInfoDO.getPackRetprice());//单价
|
|
|
|
infoObj.put("dose_unit",wlyyPrescriptionInfoDO.getPackRetprice());//单价
|
|
|
|
infoObj.put("medical_number",wlyyPrescriptionInfoDO.getQuantity());//数量
|
|
|
|
infoObj.put("amount",wlyyPrescriptionInfoDO.getPackRetprice()*Integer.parseInt(wlyyPrescriptionInfoDO.getQuantity()));//金额
|
|
|
|
infoObj.put("single_dose_number","");//每次用量
|
|
|
|
infoObj.put("single_dose_unit","");//每次用量
|
|
|
|
infoObj.put("use_frequency",wlyyPrescriptionInfoDO.getUsageName());//使用频次
|
|
|
|
infoObj.put("deliver_way","");//具体给药途径详见附录三的编码
|
|
|
|
infoObj.put("use_day",wlyyPrescriptionInfoDO.getDays());//用药天数
|
|
|
|
|
|
|
|
/* dose_form 剂型, String Y 具体可使用剂型详见附录五的编码
|
|
|
|
medical_specification 规格 String Y
|
|
|
|
price 单价 String Y 必须使用数值型,如”12.5”
|
|
|
|
medical_number 数量 String Y 必须使用数值型,如”10”
|
|
|
|
dose_unit 单价 String Y
|
|
|
|
amount 金额 String Y 必须使用数值型,如”50.5”
|
|
|
|
use_day 用药天数 String Y (项目为药品时非空),医嘱服用该药品天数,必须使用数值型,如”15”
|
|
|
|
single_dose_number 单次用药量 String Y (项目为药品时非空),配合下一个字段的单位,如 50 mg,必须使用数值型,如”50”
|
|
|
|
single_dose_unit 单次用药量剂量单位 String Y (项目为药品时非空),具体可使用剂量单位详见附录四的编码
|
|
|
|
take_medical_number 取药总量( String Y 项目为药品时非空),配合下一个字段的单位,如 500 mg,必须使用数值型,如”500”
|
|
|
|
take_medical_unit 取药总量剂量单位 String Y (项目为药品时非空),具体可使用剂量单位附录四的编码
|
|
|
|
dose_day 药量天数 String Y (项目为药品时非空),依据医嘱服药要求,所配药品患者可以服用的天数,必须使用数值型,如”5”
|
|
|
|
deliver_way 给药途径 String Y 具体给药途径详见附录三的编码
|
|
|
|
take_frequence 服用频次 String Y
|
|
|
|
具体可用服用频次详见附录二的编码*/
|
|
|
|
|
|
|
|
advice_details.add(infoObj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
data.put("advice_details",advice_details);
|
|
|
|
|
|
|
|
//诊断
|
|
|
|
JSONArray diagnoses = new JSONArray();
|
|
|
|
String icd10 = outpatientDO.getIcd10();
|
|
|
|
String icd10Name = outpatientDO.getIcd10Name();
|
|
|
|
String icd[] = icd10.split(",");
|
|
|
|
String icdName[] = icd10Name.split(",");
|
|
|
|
for (int i=0;i<icd.length;i++){
|
|
|
|
JSONObject icdObj = new JSONObject();
|
|
|
|
icdObj.put("disease_code_icd10",icd[i]);//诊断或症状编码
|
|
|
|
icdObj.put("disease_name_icd10",icdName[i]);//诊断或症状名称
|
|
|
|
diagnoses.add(icdObj);
|
|
|
|
}
|
|
|
|
data.put("diagnoses",diagnoses);
|
|
|
|
|
|
|
|
|
|
|
|
String result = requestYlz(data,"N21.08.09.02","门诊事中提醒");
|
|
|
|
if(result == null){
|
|
|
|
throw new Exception("医保请求失败");
|
|
|
|
}
|
|
|
|
logger.info("门诊事中提醒:"+result);
|
|
|
|
JSONObject object = JSONObject.parseObject(result);
|
|
|
|
if (object.getString("flag").equalsIgnoreCase("1")){
|
|
|
|
JSONObject encryptData = object.getJSONObject("encrypt_data");
|
|
|
|
return encryptData.toJSONString();
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getYlzToken() throws Exception {
|
|
public String getYlzToken() throws Exception {
|
|
YlzHttpLogDO ylzHttpLogDO = new YlzHttpLogDO();
|
|
YlzHttpLogDO ylzHttpLogDO = new YlzHttpLogDO();
|
|
String token = null;
|
|
String token = null;
|
|
@ -963,8 +1111,8 @@ public class HealthCareService {
|
|
JSONArray icdArray = new JSONArray();
|
|
JSONArray icdArray = new JSONArray();
|
|
for (int i=0;i<icd.length;i++){
|
|
for (int i=0;i<icd.length;i++){
|
|
JSONObject icdObj = new JSONObject();
|
|
JSONObject icdObj = new JSONObject();
|
|
icdObj.put("disease_code_icd10","");//诊断或症状编码
|
|
|
|
icdObj.put("disease_name_icd10","");//诊断或症状名称
|
|
|
|
|
|
icdObj.put("disease_code_icd10",icd[i]);//诊断或症状编码
|
|
|
|
icdObj.put("disease_name_icd10",icdName[i]);//诊断或症状名称
|
|
icdObj.put("disease_type","");//诊断或症状类型
|
|
icdObj.put("disease_type","");//诊断或症状类型
|
|
icdObj.put("disease_order","");//诊断或症状序号
|
|
icdObj.put("disease_order","");//诊断或症状序号
|
|
icdArray.add(icdObj);
|
|
icdArray.add(icdObj);
|