|
@ -2449,9 +2449,10 @@ public class HcyyEntranceService {
|
|
|
|
|
|
|
|
|
|
|
|
public String initParams(String serviceCode,String hisId,String payType,String patient,String doctor,List<WlyyPrescriptionInfoDO> infos,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception {
|
|
|
public String initParams(String serviceCode,String payType,String patient,String doctor,List<WlyyPrescriptionInfoDO> infos,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception {
|
|
|
|
|
|
String xml ="";
|
|
|
String hisId = UUID.randomUUID().toString();
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
if (patientMappingDO == null){
|
|
|
return "患者信息映射表为空";
|
|
@ -2460,20 +2461,30 @@ public class HcyyEntranceService {
|
|
|
if (doctorMappingDO == null){
|
|
|
return "医生信息映射表为空";
|
|
|
}
|
|
|
WlyyOutpatientDO outpatientDO =outpatientDao.findById(outpatientId);
|
|
|
if(outpatientDO==null){
|
|
|
return "就诊记录为空!";
|
|
|
}
|
|
|
String eventTime = DateUtil.dateToStrLong(outpatientDO.getCreateTime());
|
|
|
|
|
|
String recipeTime = DateUtil.dateToStrLong(new Date());
|
|
|
List<BaseDoctorHospitalDO> baseDoctorHospitalDOList = baseDoctorHospitalDao.findByDoctorCode(doctor);
|
|
|
BaseDoctorHospitalDO baseDoctorHospitalDO = baseDoctorHospitalDOList.get(0);
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
|
|
|
BasePatientDO patientDO = patientDao.findById(patient);
|
|
|
String hospital = "";
|
|
|
String eventNo="";
|
|
|
String eventTime = "";
|
|
|
String dept = "";
|
|
|
String deptName = "";
|
|
|
if (infos!=null&&infos.size()!=0){
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
|
|
|
hospital = outpatientDO.getHospital();
|
|
|
eventNo = outpatientDO.getRegisterNo();
|
|
|
eventTime = DateUtil.dateToStrLong(outpatientDO.getRegisterDate());
|
|
|
dept = outpatientDO.getDept();
|
|
|
deptName = outpatientDO.getDeptName();
|
|
|
}
|
|
|
|
|
|
Double recipeFeeTotal = 0.00;
|
|
|
for (int i = 0; i < infos.size(); i++) {
|
|
|
Double packRetprice = infos.get(i).getPackRetprice();
|
|
|
Double feeTotal=Integer.parseInt(infos.get(i).getQuantity()) * packRetprice;
|
|
|
Double feeTotal=infos.get(i).getPackQuantity() * packRetprice;
|
|
|
recipeFeeTotal += feeTotal;
|
|
|
}
|
|
|
if (patientDO == null){
|
|
@ -2501,8 +2512,8 @@ public class HcyyEntranceService {
|
|
|
//基础标记
|
|
|
String base =
|
|
|
"<base> \n" +
|
|
|
" <hospital_code><![CDATA["+outpatientDO.getHospital()+"]]></hospital_code> \n" +
|
|
|
" <event_no><![CDATA["+outpatientDO.getAdmNo()+"]]></event_no> \n" +
|
|
|
" <hospital_code><![CDATA["+hospital+"]]></hospital_code> \n" +
|
|
|
" <event_no><![CDATA["+eventNo+"]]></event_no> \n" +
|
|
|
" <patient_id><![CDATA["+patientMappingDO.getMappingCode()+"]]></patient_id> \n" +
|
|
|
" <source><![CDATA[门诊]]></source> \n" +
|
|
|
"</base> \n";
|
|
@ -2515,9 +2526,9 @@ public class HcyyEntranceService {
|
|
|
" <id_no><![CDATA["+ patientDO.getIdcard()+"]]></id_no> \n" +
|
|
|
" <birthday><![CDATA["+ patientDO.getBirthday()+"]]></birthday> \n" +
|
|
|
" <event_time><![CDATA["+eventTime+"]]></event_time> \n" +
|
|
|
" <dept_id><![CDATA["+outpatientDO.getDept()+"]]></dept_id> \n" +
|
|
|
" <dept_name><![CDATA["+outpatientDO.getDeptName()+"]]></dept_name> \n" +
|
|
|
" <pay_type><![CDATA["+("1".equalsIgnoreCase(payType) ? "医保" : "自费")+"]]></pay_type> \n" +
|
|
|
" <dept_id><![CDATA["+dept+"]]></dept_id> \n" +
|
|
|
" <dept_name><![CDATA["+deptName+"]]></dept_name> \n" +
|
|
|
" <pay_type><![CDATA[自费]]></pay_type> \n" +
|
|
|
" <pregnancy><![CDATA[]]></pregnancy> \n" +
|
|
|
" <time_of_preg><![CDATA[]]></time_of_preg> \n" +
|
|
|
" <breast_feeding><![CDATA[]]></breast_feeding> \n" +
|
|
@ -2545,53 +2556,46 @@ public class HcyyEntranceService {
|
|
|
" <herb_packet_count><![CDATA[]]></herb_packet_count> \n" +
|
|
|
" <recipe_status><![CDATA[0]]></recipe_status> \n" +
|
|
|
" <comments><![CDATA[]]></comments> \n" +
|
|
|
" <urgent_flag><![CDATA[0]]></urgent_flag> \n" +
|
|
|
" <urgent_flag><![CDATA[1]]></urgent_flag> \n" +
|
|
|
" </opt_prescription_info>";
|
|
|
//处方明细
|
|
|
String prescriptionItems="";
|
|
|
for (int i = 0; i < infos.size(); i++) {
|
|
|
String resId = UUID.randomUUID().toString();
|
|
|
String prescriptionItem =
|
|
|
" <opt_prescription_item> \n" +
|
|
|
" <recipe_item_id><![CDATA["+hisId+"]]></recipe_item_id> \n" +
|
|
|
" <recipe_id><![CDATA["+infos.get(i).getId()+"]]></recipe_id> \n" +
|
|
|
" <group_no><![CDATA["+infos.get(i).getGroupNo()+"]]></group_no> \n" +
|
|
|
" <drug_id><![CDATA["+infos.get(i).getDrugNo()+"]]></drug_id> \n" +
|
|
|
" <recipe_item_id><![CDATA["+resId+"]]></recipe_item_id> \n" +
|
|
|
" <recipe_id><![CDATA["+hisId+"]]></recipe_id> \n" +
|
|
|
" <group_no><![CDATA[1]]></group_no> \n" +
|
|
|
" <drug_id><![CDATA["+infos.get(i).getHisCode()+"]]></drug_id> \n" +
|
|
|
" <drug_name><![CDATA["+infos.get(i).getDrugName()+"]]></drug_name> \n" +
|
|
|
" <specification><![CDATA["+infos.get(i).getSpecification()+"]]></specification> \n" +
|
|
|
" <manufacturer_name><![CDATA["+infos.get(i).getDrugPlace()+"]]></manufacturer_name> \n" +
|
|
|
" <drug_dose><![CDATA["+infos.get(i).getDosage() + infos.get(i).getUnitName()+"]]></drug_dose> \n" +
|
|
|
" <drug_admin_route_name><![CDATA["+infos.get(i).getSupplyName()+"]]></drug_admin_route_name> \n" +
|
|
|
" <drug_using_freq><![CDATA["+infos.get(i).getUsageCode()+"]]></drug_using_freq> \n" +
|
|
|
" <despensing_num><![CDATA["+infos.get(i).getQuantity()+"]]></despensing_num> \n" +
|
|
|
" <despensing_num><![CDATA["+infos.get(i).getPackQuantity()+"]]></despensing_num> \n" +
|
|
|
" <pack_unit><![CDATA["+infos.get(i).getPackUnitName()+"]]></pack_unit> \n" +
|
|
|
" <count_unit><![CDATA["+infos.get(i).getPackQuantity()+"]]></count_unit> \n" +
|
|
|
" <unit_price><![CDATA["+infos.get(i).getPackRetprice()+"]]></unit_price> \n" +
|
|
|
" <fee_total><![CDATA["+Integer.parseInt(infos.get(i).getQuantity()) * infos.get(i).getPackRetprice()+"]]></fee_total> \n" +
|
|
|
" <duration><![CDATA["+infos.get(i).getUsageName()+"]]></duration> \n" +
|
|
|
" <fee_total><![CDATA["+infos.get(i).getPackQuantity() * infos.get(i).getPackRetprice()+"]]></fee_total> \n" +
|
|
|
" <duration><![CDATA["+infos.get(i).getDays()+"]]></duration> \n" +
|
|
|
" <preparation><![CDATA["+infos.get(i).getUnitName()+"]]></preparation> \n" +
|
|
|
" <approve_no><![CDATA["+infos.get(i).getPzwh()+"]]></approve_no> \n" +
|
|
|
" <medicare_type><![CDATA[]]></medicare_type> \n" +
|
|
|
" <ouvas_flag><![CDATA[]]></ouvas_flag> \n" +
|
|
|
" <skin_test_flag><![CDATA[]]></skin_test_flag> \n" +
|
|
|
" <duration><![CDATA[]]></duration> \n" +
|
|
|
" <special_prompt><![CDATA[]]></special_prompt> \n" +
|
|
|
" </opt_prescription_item> ";
|
|
|
prescriptionItems += prescriptionItem;
|
|
|
}
|
|
|
//医生反馈信息
|
|
|
String feedback = "<feed_back> \n" +
|
|
|
" <recipe_id><![CDATA["+hisId+"]]></recipe_id> \n" +
|
|
|
" <message><![CDATA["+outpatientDO.getAdvice()+"]]></message> \n" +
|
|
|
" <status><![CDATA[1]]></status> \n" +
|
|
|
" </feed_back> ";
|
|
|
//诊断
|
|
|
String prescriptionDiagnoses="";
|
|
|
for (int i = 0; i < diagnosisDOS.size(); i++) {
|
|
|
String diagDate = DateUtil.dateToStrLong(diagnosisDOS.get(i).getCreateTime());
|
|
|
String prescriptionDiagnose =
|
|
|
" <opt_diagnosis> \n" +
|
|
|
" <diag_id><![CDATA["+diagnosisDOS.get(i).getId()+"]]></diag_id> \n" +
|
|
|
" <diag_date><![CDATA["+diagDate+"]]></diag_date> \n" +
|
|
|
" <diag_date><![CDATA["+eventTime+"]]></diag_date> \n" +
|
|
|
" <diag_name><![CDATA["+diagnosisDOS.get(i).getName()+"]]></diag_name> \n" +
|
|
|
" <diag_code><![CDATA["+diagnosisDOS.get(i).getCode()+"]]></diag_code> \n" +
|
|
|
" <diag_status><![CDATA[0]]></diag_status> \n" +
|
|
@ -2634,9 +2638,9 @@ public class HcyyEntranceService {
|
|
|
else if (serviceCode.equals("CANCEL_GROUP_DRUG_V4")){
|
|
|
xml = "<root>" + base + doctors + cancelPrescription + "</root>";
|
|
|
}
|
|
|
else if (serviceCode.equals("SF_V4_DOUBLE_SIGN")){
|
|
|
/* else if (serviceCode.equals("SF_V4_DOUBLE_SIGN")){
|
|
|
xml = "<root>" + base + doctors + feedback + "</root>";
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
return xml;
|
|
|
}
|
|
@ -2649,28 +2653,41 @@ public class HcyyEntranceService {
|
|
|
* SF_V4_DOUBLE_SIGN 医生在对药师打回的处方进行双签处理后,医生站将双签信息推送给审方系统:、
|
|
|
* CANCEL_GROUP_DRUG_V4 删除已保存处方时调用、
|
|
|
* SF_V4_DISCHARGED 已保存处方进行数据修改
|
|
|
* @param xml 入参数
|
|
|
* @param name 服务名字
|
|
|
* @param name 服务名字c
|
|
|
* @return
|
|
|
*/
|
|
|
public String checkPrescription(String serviceCode,String xml,String name){
|
|
|
|
|
|
String url = getYYCheckUrl()+serviceCode;
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("xml",xml);
|
|
|
String response = httpClientUtil.postBody(url,object);
|
|
|
WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
|
|
|
httpLogDO.setCode(serviceCode);
|
|
|
httpLogDO.setName(name);
|
|
|
httpLogDO.setRequest(xml);
|
|
|
httpLogDO.setResponse(response);
|
|
|
httpLogDO.setStatus("1");
|
|
|
wlyyHttpLogDao.save(httpLogDO);
|
|
|
return response;
|
|
|
public String checkPrescription(String serviceCode,String jsonData,String name) throws Exception {
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
"<root> " +
|
|
|
" <serverName>"+serviceCode+"</serverName> " +
|
|
|
" <format>xml</format>" +
|
|
|
" <callOperator></callOperator> " +
|
|
|
" <certificate>"+caKey+"</certificate> " +
|
|
|
"</root>";
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
jsonData;
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
params.put("msgBody",msgBody);
|
|
|
wlyyHttpLogDO.setRequest(params.toString());
|
|
|
logger.info(name+" params:"+params.toString());
|
|
|
String xml = getHcyyCAWebServiceInfo("CallInterface",params,getYYCheckUrl());
|
|
|
|
|
|
wlyyHttpLogDO.setResponse(xml);
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
wlyyHttpLogDO.setCode(serviceCode);
|
|
|
wlyyHttpLogDO.setName(name);
|
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
|
logger.info(name+" json:"+xml);
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
//处方保存前,进行合理用药审查
|
|
|
public String checkPrescriptions(String outpatient, String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
|
|
|
public String checkPrescriptions(String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception {
|
|
|
|
|
|
if (null == infos || infos.size() == 0) {
|
|
|
return "药品信息为空";
|
|
@ -2679,14 +2696,14 @@ public class HcyyEntranceService {
|
|
|
return "诊断信息为空";
|
|
|
}
|
|
|
String xml = "";
|
|
|
xml = initParams("GY_V4_FLEXIBLE", hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
|
|
|
String response = checkPrescription("GY_V4_FLEXIBLE", xml, "合理用药审查");
|
|
|
xml = initParams("GY_SF_V4",payType, patient, doctor, infos, diagnosisDOS,outpatientId);
|
|
|
String response = checkPrescription("GY_SF_V4", xml, "合理用药审查");
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
//处方在医生站系统成功保存后调用
|
|
|
public String saveCheck(String outpatient, String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
|
|
|
public String saveCheck(String outpatient, String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
|
|
|
if (infos == null || infos.size() == 0) {
|
|
|
return "药品信息为空";
|
|
|
}
|
|
@ -2695,7 +2712,7 @@ public class HcyyEntranceService {
|
|
|
}
|
|
|
String xml = null;
|
|
|
try {
|
|
|
xml = initParams("GY_SF_V4",hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
|
|
|
xml = initParams("GY_SF_V4", payType, patient, doctor, infos, diagnosisDOS,outpatient);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -2704,7 +2721,7 @@ public class HcyyEntranceService {
|
|
|
}
|
|
|
|
|
|
//处方保存成功后,发送给审方系统进行人工审方
|
|
|
public String validCheck(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
|
|
|
public String validCheck(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
|
|
|
if (infos == null || infos.size() == 0) {
|
|
|
return "药品信息为空";
|
|
|
}
|
|
@ -2713,7 +2730,7 @@ public class HcyyEntranceService {
|
|
|
}
|
|
|
String xml = null;
|
|
|
try {
|
|
|
xml = initParams("SF_V4_VALID_FLAG", hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
|
|
|
xml = initParams("SF_V4_VALID_FLAG",payType, patient, doctor, infos, diagnosisDOS,outpatient);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -2722,7 +2739,7 @@ public class HcyyEntranceService {
|
|
|
}
|
|
|
|
|
|
//删除已保存处方时调用
|
|
|
public String deletePrescription(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
|
|
|
public String deletePrescription(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
|
|
|
if (infos == null || infos.size() == 0) {
|
|
|
return "药品信息为空";
|
|
|
}
|
|
@ -2731,7 +2748,7 @@ public class HcyyEntranceService {
|
|
|
}
|
|
|
String xml = null;
|
|
|
try {
|
|
|
xml = initParams("CANCEL_GROUP_DRUG_V4", hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
|
|
|
xml = initParams("CANCEL_GROUP_DRUG_V4",payType, patient, doctor, infos, diagnosisDOS,outpatient);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -2740,7 +2757,7 @@ public class HcyyEntranceService {
|
|
|
}
|
|
|
|
|
|
//医生在对药师打回的处方进行双签处理后,医生站将双签信息推送给审方系统
|
|
|
public String doubleSign(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
|
|
|
public String doubleSign(String outpatient,String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
|
|
|
if (infos == null || infos.size() == 0) {
|
|
|
return "药品信息为空";
|
|
|
}
|
|
@ -2749,7 +2766,7 @@ public class HcyyEntranceService {
|
|
|
}
|
|
|
String xml = null;
|
|
|
try {
|
|
|
xml = initParams("SF_V4_DOUBLE_SIGN", hisId, payType, patient, doctor, infos, diagnosisDOS,outpatient);
|
|
|
xml = initParams("SF_V4_DOUBLE_SIGN",payType, patient, doctor, infos, diagnosisDOS,outpatient);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|