|
@ -14,6 +14,7 @@ import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
|
|
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
|
|
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
|
|
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
|
|
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
|
|
import com.yihu.jw.healthCare.utils.AES;
|
|
import com.yihu.jw.healthCare.utils.AES;
|
|
import com.yihu.jw.healthCare.utils.SafeUtil;
|
|
import com.yihu.jw.healthCare.utils.SafeUtil;
|
|
@ -22,8 +23,10 @@ import com.yihu.jw.hospital.httplog.dao.YlzHttpLogDao;
|
|
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
|
|
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
|
|
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
|
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionExpressageDao;
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
|
import com.yihu.jw.util.common.LatitudeUtils;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
@ -37,6 +40,7 @@ import org.springframework.stereotype.Service;
|
|
import javax.transaction.Transactional;
|
|
import javax.transaction.Transactional;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 医保对接
|
|
* 医保对接
|
|
@ -59,6 +63,8 @@ public class HealthCareService {
|
|
@Autowired
|
|
@Autowired
|
|
private DoctorMappingDao doctorMappingDao;
|
|
private DoctorMappingDao doctorMappingDao;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
private PrescriptionExpressageDao prescriptionExpressageDao;
|
|
|
|
@Autowired
|
|
private PrescriptionDao prescriptionDao;
|
|
private PrescriptionDao prescriptionDao;
|
|
@Autowired
|
|
@Autowired
|
|
private HttpClientUtil httpClientUtil;
|
|
private HttpClientUtil httpClientUtil;
|
|
@ -168,6 +174,9 @@ public class HealthCareService {
|
|
*/
|
|
*/
|
|
public void doctorAuthentication(String doctorId) throws Exception{
|
|
public void doctorAuthentication(String doctorId) throws Exception{
|
|
BaseDoctorDO doctorDO = doctorDao.findOne(doctorId);
|
|
BaseDoctorDO doctorDO = doctorDao.findOne(doctorId);
|
|
|
|
if (doctorDO == null){
|
|
|
|
throw new Exception("医生不存在");
|
|
|
|
}
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorId);
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorId);
|
|
if(doctorHospitalDOS.size()<=0){
|
|
if(doctorHospitalDOS.size()<=0){
|
|
throw new Exception("未找到医生科室编码");
|
|
throw new Exception("未找到医生科室编码");
|
|
@ -180,7 +189,7 @@ public class HealthCareService {
|
|
// data.put("dept_name","");//医保科室名称 String N
|
|
// data.put("dept_name","");//医保科室名称 String N
|
|
data.put("name",doctorDO.getName());//医师姓名
|
|
data.put("name",doctorDO.getName());//医师姓名
|
|
data.put("idcard",doctorDO.getIdcard());//医师证件号
|
|
data.put("idcard",doctorDO.getIdcard());//医师证件号
|
|
data.put("cert_type","");//医师证件类型
|
|
|
|
|
|
data.put("cert_type","01");//医师证件类型
|
|
|
|
|
|
requestYlz(data,"N20.17.02.01","医师身份验证");
|
|
requestYlz(data,"N20.17.02.01","医师身份验证");
|
|
}
|
|
}
|
|
@ -196,10 +205,13 @@ public class HealthCareService {
|
|
throw new Exception("未配置回调地址");
|
|
throw new Exception("未配置回调地址");
|
|
}
|
|
}
|
|
BaseDoctorDO doctorDO = doctorDao.findOne(doctorId);
|
|
BaseDoctorDO doctorDO = doctorDao.findOne(doctorId);
|
|
|
|
if (doctorDO == null){
|
|
|
|
throw new Exception("医生不存在");
|
|
|
|
}
|
|
JSONObject data = new JSONObject();
|
|
JSONObject data = new JSONObject();
|
|
data.put("name",doctorDO.getName());//医师姓名
|
|
data.put("name",doctorDO.getName());//医师姓名
|
|
data.put("idcard",doctorDO.getIdcard());//医师证件号
|
|
data.put("idcard",doctorDO.getIdcard());//医师证件号
|
|
data.put("cert_type","");//医师证件类型
|
|
|
|
|
|
data.put("cert_type","01");//医师证件类型
|
|
data.put("redirect_url",hospitalSysDictDO.getDictValue());//回调地址
|
|
data.put("redirect_url",hospitalSysDictDO.getDictValue());//回调地址
|
|
requestYlz(data,"N20.17.02.02","医师人脸签到表单地址");
|
|
requestYlz(data,"N20.17.02.02","医师人脸签到表单地址");
|
|
}
|
|
}
|
|
@ -209,33 +221,44 @@ public class HealthCareService {
|
|
*/
|
|
*/
|
|
public void doctorFaceCheckInData(String doctorId)throws Exception{
|
|
public void doctorFaceCheckInData(String doctorId)throws Exception{
|
|
BaseDoctorDO doctorDO = doctorDao.findOne(doctorId);
|
|
BaseDoctorDO doctorDO = doctorDao.findOne(doctorId);
|
|
|
|
if (doctorDO == null){
|
|
|
|
throw new Exception("医生不存在");
|
|
|
|
}
|
|
JSONObject data = new JSONObject();
|
|
JSONObject data = new JSONObject();
|
|
data.put("name",doctorDO.getName());//医师姓名
|
|
data.put("name",doctorDO.getName());//医师姓名
|
|
data.put("idcard",doctorDO.getIdcard());//医师证件号
|
|
data.put("idcard",doctorDO.getIdcard());//医师证件号
|
|
data.put("cert_type","");//医师证件类型
|
|
|
|
|
|
data.put("cert_type","01");//医师证件类型
|
|
requestYlz(data,"N20.17.02.05","获取医师人脸签到数据");
|
|
requestYlz(data,"N20.17.02.05","获取医师人脸签到数据");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 2.4.1 事前提醒
|
|
* 2.4.1 事前提醒
|
|
*/
|
|
*/
|
|
public void advanceWarning(String prescriptionId) throws Exception{
|
|
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
|
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findOne(prescriptionDO.getOutpatientId());
|
|
|
|
|
|
public void advanceWarning(String outpatientId) throws Exception{
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId);
|
|
|
|
if (outpatientDO == null){
|
|
|
|
throw new Exception("事前提醒失败:门诊信息不存在");
|
|
|
|
}
|
|
BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient());
|
|
BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient());
|
|
|
|
if(patientDO == null){
|
|
|
|
throw new Exception("事前提醒失败:居民不存在");
|
|
|
|
}
|
|
JSONObject data = new JSONObject();
|
|
JSONObject data = new JSONObject();
|
|
data.put("his_serial",outpatientDO.getRegisterNo());//HIS 门诊挂号号
|
|
data.put("his_serial",outpatientDO.getRegisterNo());//HIS 门诊挂号号
|
|
data.put("insurance_serial","insurance_serial");//医保门诊挂号流水号
|
|
|
|
|
|
data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保门诊挂号流水号
|
|
data.put("medical_mode","");//就诊类型 String Y
|
|
data.put("medical_mode","");//就诊类型 String Y
|
|
data.put("region_code","");//参保地区划代码 String Y
|
|
data.put("region_code","");//参保地区划代码 String Y
|
|
data.put("name",patientDO.getName());//姓名
|
|
data.put("name",patientDO.getName());//姓名
|
|
data.put("idcard",patientDO.getIdcard());//证件号码
|
|
data.put("idcard",patientDO.getIdcard());//证件号码
|
|
data.put("cert_type","");//证件类型
|
|
|
|
data.put("sex","");//性别 String Y
|
|
|
|
|
|
data.put("cert_type","01");//证件类型
|
|
|
|
String sex = IdCardUtil.getSexForIdcard_new(patientDO.getIdcard(),patientDO.getSex());
|
|
|
|
if("3".equals(sex)){
|
|
|
|
sex = "9";
|
|
|
|
}
|
|
|
|
data.put("sex",sex);//性别 String Y
|
|
String birth = IdCardUtil.getBirthdayForIdcardStr(patientDO.getIdcard(),patientDO.getBirthday());
|
|
String birth = IdCardUtil.getBirthdayForIdcardStr(patientDO.getIdcard(),patientDO.getBirthday());
|
|
if(StringUtils.isBlank(birth)){
|
|
if(StringUtils.isBlank(birth)){
|
|
throw new Exception("居民生日信息有误");
|
|
|
|
|
|
throw new Exception("事前提醒失败:居民生日信息有误");
|
|
}
|
|
}
|
|
data.put("birth",birth);//出生日期 String Y
|
|
data.put("birth",birth);//出生日期 String Y
|
|
data.put("medical_type","");//医疗类别 String Y
|
|
data.put("medical_type","");//医疗类别 String Y
|
|
@ -244,15 +267,18 @@ public class HealthCareService {
|
|
|
|
|
|
String doctorId = outpatientDO.getDoctor();
|
|
String doctorId = outpatientDO.getDoctor();
|
|
BaseDoctorDO doctorDO = doctorDao.findOne(doctorId);
|
|
BaseDoctorDO doctorDO = doctorDao.findOne(doctorId);
|
|
|
|
if(doctorDO == null){
|
|
|
|
throw new Exception("事前提醒失败:医生不存在");
|
|
|
|
}
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorId);
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorId);
|
|
if(doctorHospitalDOS.size()<=0){
|
|
if(doctorHospitalDOS.size()<=0){
|
|
throw new Exception("未找到医生科室编码");
|
|
|
|
|
|
throw new Exception("事前提醒失败:未找到医生科室编码");
|
|
}
|
|
}
|
|
BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
|
|
BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
|
|
|
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctorId);
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctorId);
|
|
if(doctorMappingDO == null){
|
|
if(doctorMappingDO == null){
|
|
throw new Exception("未找到医生his编码");
|
|
|
|
|
|
throw new Exception("事前提醒失败:未找到医生his编码");
|
|
}
|
|
}
|
|
data.put("dept_code",doctorHospitalDO.getDeptCode());//科室代码
|
|
data.put("dept_code",doctorHospitalDO.getDeptCode());//科室代码
|
|
data.put("dept_name",doctorHospitalDO.getDeptName());//科室名称
|
|
data.put("dept_name",doctorHospitalDO.getDeptName());//科室名称
|
|
@ -274,15 +300,44 @@ public class HealthCareService {
|
|
JSONObject zd = new JSONObject();
|
|
JSONObject zd = new JSONObject();
|
|
zd.put("disease_code_icd10",icd10sz[i].trim());//诊断或症状编码 String Y 见icd-10或症状表编码
|
|
zd.put("disease_code_icd10",icd10sz[i].trim());//诊断或症状编码 String Y 见icd-10或症状表编码
|
|
zd.put("disease_name_icd10",icd10Namesz[i].trim());//诊断或症状名称 String Y 见icd-10或症状表名称
|
|
zd.put("disease_name_icd10",icd10Namesz[i].trim());//诊断或症状名称 String Y 见icd-10或症状表名称
|
|
zd.put("disease_type","");//诊断或症状类型 String Y 参见编码附件
|
|
|
|
|
|
zd.put("disease_type","01");//诊断或症状类型 String Y 参见编码附件 01 门诊
|
|
zd.put("disease_order","");//诊断或症状序号 String Y 参见编码附件
|
|
zd.put("disease_order","");//诊断或症状序号 String Y 参见编码附件
|
|
}
|
|
}
|
|
data.put("zdlist",zdlist);
|
|
data.put("zdlist",zdlist);
|
|
|
|
|
|
//医嘱明细
|
|
//医嘱明细
|
|
JSONArray mxlist = new JSONArray();
|
|
JSONArray mxlist = new JSONArray();
|
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
|
|
|
|
for (WlyyPrescriptionDO wlyyPrescriptionDO:wlyyPrescriptionDOS){
|
|
|
|
List<WlyyPrescriptionInfoDO> prescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId());
|
|
|
|
for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:prescriptionInfoDOS){
|
|
|
|
JSONObject infoObj = new JSONObject();
|
|
|
|
infoObj.put("catalog_item","");//社保三大目录统一编码 String Y
|
|
|
|
infoObj.put("his_item_name",wlyyPrescriptionInfoDO.getDrugName());//HIS院内项目名称
|
|
|
|
infoObj.put("his_item_code",wlyyPrescriptionInfoDO.getDrugNo());//HIS院内项目编码
|
|
|
|
infoObj.put("item_name","");//医保项目名称
|
|
|
|
infoObj.put("item_code","");//医保项目编码
|
|
|
|
infoObj.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
|
|
|
|
infoObj.put("his_detail_sn","");//his处方明细流水号
|
|
|
|
infoObj.put("invoice_type","");//发票项目类别
|
|
|
|
infoObj.put("specification_type",wlyyPrescriptionInfoDO.getSpecification());//规格型号
|
|
|
|
infoObj.put("dosage_form",wlyyPrescriptionInfoDO.getDosage());//剂型
|
|
|
|
infoObj.put("charge_unit","");//单位
|
|
|
|
infoObj.put("price",wlyyPrescriptionInfoDO.getPackRetprice());//单价
|
|
|
|
infoObj.put("amount",wlyyPrescriptionInfoDO.getQuantity());//数量
|
|
|
|
infoObj.put("total_money",wlyyPrescriptionInfoDO.getPackRetprice()*Integer.parseInt(wlyyPrescriptionInfoDO.getQuantity()));//金额
|
|
|
|
infoObj.put("single_dose",wlyyPrescriptionInfoDO.getDosage());//每次用量
|
|
|
|
infoObj.put("use_frequency",wlyyPrescriptionInfoDO.getUsageName());//使用频次
|
|
|
|
infoObj.put("medical_way","");//给药途径
|
|
|
|
|
|
|
|
|
|
|
|
infoObj.put("prescription_date", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()));//处方日期
|
|
|
|
infoObj.put("medication_days",wlyyPrescriptionInfoDO.getDays());//执行天数
|
|
|
|
infoObj.put("his_dept_code",wlyyPrescriptionDO.getDept());//his内部科室编码
|
|
|
|
infoObj.put("his_dept_name",wlyyPrescriptionDO.getDeptName());//his内部科室名称
|
|
|
|
infoObj.put("limit_type","");//限制范围类别
|
|
|
|
mxlist.add(infoObj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
data.put("mxlist",mxlist);
|
|
data.put("mxlist",mxlist);
|
|
|
|
|
|
@ -294,15 +349,128 @@ public class HealthCareService {
|
|
* 2.4.2 医师开方上传
|
|
* 2.4.2 医师开方上传
|
|
*/
|
|
*/
|
|
public void doctorPrescriptionUpload(String prescriptionId)throws Exception{
|
|
public void doctorPrescriptionUpload(String prescriptionId)throws Exception{
|
|
WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
|
|
|
|
if (wlyyPrescriptionDO == null){
|
|
|
|
throw new Exception("续方信息不存在");
|
|
|
|
}
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findOne(wlyyPrescriptionDO.getOutpatientId());
|
|
|
|
if (outpatientDO == null){
|
|
|
|
throw new Exception("门诊信息不存在");
|
|
|
|
}
|
|
|
|
BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient());
|
|
|
|
if(patientDO == null){
|
|
|
|
throw new Exception("居民不存在");
|
|
|
|
}
|
|
JSONObject data = new JSONObject();
|
|
JSONObject data = new JSONObject();
|
|
data.put("insurance_serial","insurance_serial");//医保门诊挂号流水号
|
|
|
|
|
|
data.put("his_serial",outpatientDO.getRegisterNo());//HIS 门诊挂号号
|
|
|
|
data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保门诊挂号流水号
|
|
|
|
data.put("order_id","");//订单号 String Y
|
|
|
|
|
|
|
|
data.put("medical_mode","");//就诊类型 String Y
|
|
|
|
data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
|
|
|
|
data.put("region_code","");//参保地区划代码 String Y
|
|
|
|
data.put("name",patientDO.getName());//姓名
|
|
|
|
data.put("idcard",patientDO.getIdcard());//证件号码
|
|
|
|
data.put("cert_type","01");//证件类型
|
|
|
|
String sex = IdCardUtil.getSexForIdcard_new(patientDO.getIdcard(),patientDO.getSex());
|
|
|
|
if("3".equals(sex)){
|
|
|
|
sex = "9";
|
|
|
|
}
|
|
|
|
data.put("sex",sex);//性别 String Y
|
|
|
|
String birth = IdCardUtil.getBirthdayForIdcardStr(patientDO.getIdcard(),patientDO.getBirthday());
|
|
|
|
if(StringUtils.isBlank(birth)){
|
|
|
|
throw new Exception("事前提醒失败:居民生日信息有误");
|
|
|
|
}
|
|
|
|
data.put("birth",birth);//出生日期 String Y
|
|
|
|
data.put("phone",patientDO.getMobile());//用户手机号
|
|
|
|
data.put("medical_type","");//医疗类别 String Y
|
|
|
|
data.put("medical_type_name","");//医疗类别 String Y
|
|
|
|
// data.put("insurance_ticket_no","");//诊查费结算后的收费单据号 String N
|
|
|
|
data.put("medical_time",DateUtil.dateToStr(outpatientDO.getCreateTime(),DateUtil.YYYY_MM_DD_HH_MM_SS));//特殊门诊病情编码 String Y
|
|
|
|
data.put("disease_code","");//特殊门诊病情编码 String Y
|
|
|
|
|
|
|
|
String doctorId = outpatientDO.getDoctor();
|
|
|
|
BaseDoctorDO doctorDO = doctorDao.findOne(doctorId);
|
|
|
|
if(doctorDO == null){
|
|
|
|
throw new Exception("事前提醒失败:医生不存在");
|
|
|
|
}
|
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorId);
|
|
|
|
if(doctorHospitalDOS.size()<=0){
|
|
|
|
throw new Exception("事前提醒失败:未找到医生科室编码");
|
|
|
|
}
|
|
|
|
BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
|
|
|
|
|
|
//医嘱明细
|
|
|
|
JSONArray mxlist = new JSONArray();
|
|
|
|
|
|
DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctorId);
|
|
|
|
if(doctorMappingDO == null){
|
|
|
|
throw new Exception("事前提醒失败:未找到医生his编码");
|
|
|
|
}
|
|
|
|
data.put("dept_code",doctorHospitalDO.getDeptCode());//科室代码
|
|
|
|
data.put("dept_name",doctorHospitalDO.getDeptName());//科室名称
|
|
|
|
data.put("doctor_code",doctorMappingDO.getMappingCode());//医师编号
|
|
|
|
data.put("doctor_name",doctorDO.getName());//医生名称
|
|
|
|
data.put("doctor_idcard",doctorDO.getIdcard());//医师身份证号
|
|
|
|
|
|
|
|
/* pharmacist_code 医院药师证件号码 String N
|
|
|
|
pharmacist_name 医院药师姓名 String N
|
|
|
|
pharmacist_audit_date 医院药师处方审核时间 String N
|
|
|
|
prescription _valid_date 处方过期时间 String N
|
|
|
|
prescription_type_code 处方类别编号 String N
|
|
|
|
tcm_nums 中药剂数 String N
|
|
|
|
tcm_method_code 中药药品用法编号 String N
|
|
|
|
tcm_method_name 中药药品用法名称 String N
|
|
|
|
tcm_freq_code 中药频次编号 String N
|
|
|
|
tcm_freq_name 中药频次名称 String N*/
|
|
|
|
|
|
|
|
data.put("prescription_date", DateUtil.dateToStr(outpatientDO.getCreateTime(),DateUtil.YYYY_MM_DD));//处方日期
|
|
|
|
data.put("prescription_counts","1");//处方项目数
|
|
|
|
data.put("prescription_source","");//处方来源 String Y 0:非外配处方;1:外配处方
|
|
|
|
|
|
|
|
//诊断
|
|
|
|
JSONArray zdlist = new JSONArray();
|
|
|
|
String icd10 = outpatientDO.getIcd10();
|
|
|
|
String icd10Name = outpatientDO.getIcd10Name();
|
|
|
|
String icd10sz[] = icd10.split(",");
|
|
|
|
String icd10Namesz[] = icd10Name.split(",");
|
|
|
|
for (int i=0;i<icd10sz.length;i++){
|
|
|
|
JSONObject zd = new JSONObject();
|
|
|
|
zd.put("disease_code_icd10",icd10sz[i].trim());//诊断或症状编码 String Y 见icd-10或症状表编码
|
|
|
|
zd.put("disease_name_icd10",icd10Namesz[i].trim());//诊断或症状名称 String Y 见icd-10或症状表名称
|
|
|
|
zd.put("disease_type","");//诊断或症状类型 String Y 参见编码附件
|
|
|
|
zd.put("disease_order","");//诊断或症状序号 String Y 参见编码附件
|
|
|
|
}
|
|
|
|
data.put("zdlist",zdlist);
|
|
|
|
|
|
|
|
//医嘱明细
|
|
|
|
JSONArray mxlist = new JSONArray();
|
|
|
|
List<WlyyPrescriptionInfoDO> prescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId());
|
|
|
|
for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:prescriptionInfoDOS){
|
|
|
|
JSONObject infoObj = new JSONObject();
|
|
|
|
infoObj.put("catalog_item","");//社保三大目录统一编码 String Y
|
|
|
|
infoObj.put("his_item_name",wlyyPrescriptionInfoDO.getDrugName());//HIS院内项目名称
|
|
|
|
infoObj.put("his_item_code",wlyyPrescriptionInfoDO.getDrugNo());//HIS院内项目编码
|
|
|
|
infoObj.put("item_name","");//医保项目名称
|
|
|
|
infoObj.put("item_code","");//医保项目编码
|
|
|
|
infoObj.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
|
|
|
|
infoObj.put("his_detail_sn","");//his处方明细流水号
|
|
|
|
infoObj.put("his_drug_no",wlyyPrescriptionInfoDO.getDrugNo());//院内药品编码
|
|
|
|
infoObj.put("invoice_type","");//发票项目类别
|
|
|
|
infoObj.put("specification_type",wlyyPrescriptionInfoDO.getSpecification());//规格型号
|
|
|
|
infoObj.put("dosage_form",wlyyPrescriptionInfoDO.getDosage());//剂型
|
|
|
|
infoObj.put("charge_unit","");//单位
|
|
|
|
infoObj.put("price",wlyyPrescriptionInfoDO.getPackRetprice());//单价
|
|
|
|
infoObj.put("amount",wlyyPrescriptionInfoDO.getQuantity());//数量
|
|
|
|
infoObj.put("total_money",wlyyPrescriptionInfoDO.getPackRetprice()*Integer.parseInt(wlyyPrescriptionInfoDO.getQuantity()));//金额
|
|
|
|
infoObj.put("single_dose",wlyyPrescriptionInfoDO.getDosage());//每次用量
|
|
|
|
infoObj.put("use_frequency",wlyyPrescriptionInfoDO.getUsageName());//使用频次
|
|
|
|
infoObj.put("medical_way","");//给药途径
|
|
|
|
|
|
|
|
infoObj.put("prescription_date", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()));//处方日期
|
|
|
|
infoObj.put("medication_days",wlyyPrescriptionInfoDO.getDays());//执行天数
|
|
|
|
infoObj.put("his_dept_code",wlyyPrescriptionDO.getDept());//his内部科室编码
|
|
|
|
infoObj.put("his_dept_name",wlyyPrescriptionDO.getDeptName());//his内部科室名称
|
|
|
|
infoObj.put("limit_type","");//限制范围类别
|
|
|
|
mxlist.add(infoObj);
|
|
|
|
}
|
|
|
|
|
|
data.put("mxlist",mxlist);
|
|
data.put("mxlist",mxlist);
|
|
|
|
|
|
@ -321,14 +489,140 @@ public class HealthCareService {
|
|
data.put("region_code","");//参保地区划代码
|
|
data.put("region_code","");//参保地区划代码
|
|
data.put("idcard",prescriptionDO.getIdcard());//证件号码
|
|
data.put("idcard",prescriptionDO.getIdcard());//证件号码
|
|
data.put("name",prescriptionDO.getPatientName());//姓名
|
|
data.put("name",prescriptionDO.getPatientName());//姓名
|
|
data.put("cert_type","");//证件类型
|
|
|
|
|
|
|
|
|
|
data.put("cert_type","01");//证件类型
|
|
|
|
|
|
data.put("data_source","");//数据来源 String Y 参见编码附件
|
|
data.put("data_source","");//数据来源 String Y 参见编码附件
|
|
|
|
|
|
requestYlz(data,"N20.17.03.06","医师开方上传取消");
|
|
requestYlz(data,"N20.17.03.06","医师开方上传取消");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 2.6.1 电子处方订单接收(N20.17.05.02)
|
|
|
|
*/
|
|
|
|
public void electronicPrescriptionReceiving(String outpatientId)throws Exception{
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId);
|
|
|
|
if (outpatientDO == null){
|
|
|
|
throw new Exception("门诊信息不存在");
|
|
|
|
}
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
|
data.put("order_code","");//订单号
|
|
|
|
data.put("order_time",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));//订单时间
|
|
|
|
|
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
|
|
|
|
if(wlyyPrescriptionDOS.size()==0){
|
|
|
|
throw new Exception("处方信息不存在");
|
|
|
|
}
|
|
|
|
data.put("prescription_code",wlyyPrescriptionDOS.get(0).getRealOrder());//医院处方编号
|
|
|
|
data.put("channel","1");//1、微信公众号,2、app,3、web
|
|
|
|
// data.put("insurance_ticket_no","");//医保收费单据号 String N 订单结算后的收费单据号
|
|
|
|
data.put("order_state","");//订单状态 --1待发货、2配送中、3已签收、4已取消 String Y
|
|
|
|
List<WlyyPrescriptionExpressageDO> expressageDOList = prescriptionExpressageDao.findByOutpatientId(outpatientId);
|
|
|
|
if(expressageDOList.size()==0){
|
|
|
|
throw new Exception("收获信息不存在");
|
|
|
|
}
|
|
|
|
|
|
|
|
BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient());
|
|
|
|
if(patientDO==null){
|
|
|
|
throw new Exception("居民信息不存在");
|
|
|
|
}
|
|
|
|
WlyyPrescriptionExpressageDO expressageDO = expressageDOList.get(0);
|
|
|
|
data.put("order_addr_detail",expressageDO.getAddress());//订单详细地址
|
|
|
|
data.put("order_owner",expressageDO.getName());
|
|
|
|
data.put("order_owner_idcard",patientDO.getIdcard());
|
|
|
|
data.put("order_owner_phone",patientDO.getMobile());
|
|
|
|
|
|
|
|
Map<String,String> map = LatitudeUtils.getGeocoderLatitude(expressageDO.getAddress());
|
|
|
|
data.put("addr_lat",map.get("lat"));//收货地址纬度
|
|
|
|
data.put("addr_lng",map.get("lng"));//收货地址经度
|
|
|
|
if(expressageDO.getOneselfPickupFlg()==1){
|
|
|
|
//自取
|
|
|
|
data.put("delivery_way","2");//1.网订配送,2.网订自取
|
|
|
|
data.put("qrcode_check_time","");//扫码校验时间
|
|
|
|
data.put("receiving_time","");//药品签收时间
|
|
|
|
}else {
|
|
|
|
//非自取
|
|
|
|
data.put("delivery_way","1");//配送方式 1.网订配送,2.网订自取
|
|
|
|
data.put("delivery_number",expressageDO.getMailno());//配送单号
|
|
|
|
data.put("delivery_org","");//配送单位
|
|
|
|
data.put("delivery_take_time","");//配送接单时间
|
|
|
|
data.put("delivery_name","");//配送人姓名
|
|
|
|
data.put("delivery_id_card","");//配送人身份证
|
|
|
|
// data.put("delivery_phone","");//配送人联系电话 N
|
|
|
|
data.put("getmedical_time","");//骑手取药记录
|
|
|
|
data.put("delivery_money","");//配送费
|
|
|
|
|
|
|
|
}
|
|
|
|
// apothecary_name 药师姓名 String N
|
|
|
|
// apothecary_id_card 药师身份证 String N
|
|
|
|
// apothecary_audit 药师审核时间 String N
|
|
|
|
|
|
|
|
data.put("money","");//商品金额
|
|
|
|
data.put("settlement_time","");//结算时间
|
|
|
|
data.put("data_source","");//数据来源
|
|
|
|
data.put("delivery_time","");//发单时间
|
|
|
|
|
|
|
|
data.put("elec_prescription_code",wlyyPrescriptionDOS.get(0).getId());//平台处方编号
|
|
|
|
data.put("prescription_code",wlyyPrescriptionDOS.get(0).getRealOrder());//医院处方编号
|
|
|
|
data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保门诊流水号
|
|
|
|
data.put("his_serial","");//门诊业务流水号
|
|
|
|
|
|
|
|
|
|
|
|
// mxlist 药品明细 MXLIST N
|
|
|
|
// MXLIST
|
|
|
|
// order_id 订单号 String Y
|
|
|
|
// settlement_no 医保结算单据号 String Y
|
|
|
|
// item_name 医保项目名称 String Y
|
|
|
|
// item_code 医保项目编码 String Y
|
|
|
|
// supervision_code 药品电子监管码 String N 非必填
|
|
|
|
|
|
|
|
requestYlz(data,"N20.17.05.02","电子处方订单接收");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*2.6.2 电子处方订单取消(N20.17.05.03)
|
|
|
|
*/
|
|
|
|
public void electronicPrescriptionCancle(String outpatientId)throws Exception{
|
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId);
|
|
|
|
if (outpatientDO == null){
|
|
|
|
throw new Exception("门诊信息不存在");
|
|
|
|
}
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
|
data.put("order_code","");//订单号
|
|
|
|
data.put("order_time",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));//订单时间
|
|
|
|
|
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
|
|
|
|
if(wlyyPrescriptionDOS.size()==0){
|
|
|
|
throw new Exception("处方信息不存在");
|
|
|
|
}
|
|
|
|
data.put("prescription_code",wlyyPrescriptionDOS.get(0).getRealOrder());//医院处方编号
|
|
|
|
data.put("channel","1");//1、微信公众号,2、app,3、web
|
|
|
|
// data.put("insurance_ticket_no","");//医保收费单据号 String N 订单结算后的收费单据号
|
|
|
|
data.put("order_state","");//订单状态 --1待发货、2配送中、3已签收、4已取消 String Y
|
|
|
|
data.put("cancel_time","");//订单取消时间 取消时必填
|
|
|
|
data.put("cancel_reason","");//取消原因
|
|
|
|
|
|
|
|
requestYlz(data,"N20.17.05.03","电子处方订单取消");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 2.6.3 获取处方流转平台药师审方结果(N20.17.05.04)
|
|
|
|
*/
|
|
|
|
public void pharmacistReviewResults(String outpatientId)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("prescription_code",wlyyPrescriptionDOS.get(0).getRealOrder());//医院处方编号
|
|
|
|
|
|
|
|
String response = requestYlz(data,"N20.17.05.04","获取处方流转平台药师审方结果");
|
|
|
|
}
|
|
|
|
|
|
public String getYlzToken() throws Exception {
|
|
public String getYlzToken() throws Exception {
|
|
YlzHttpLogDO ylzHttpLogDO = new YlzHttpLogDO();
|
|
YlzHttpLogDO ylzHttpLogDO = new YlzHttpLogDO();
|
|
String token = null;
|
|
String token = null;
|