|
@ -1,10 +1,17 @@
|
|
|
package com.yihu.wlyy.service.service.prescription;
|
|
|
|
|
|
import com.yihu.wlyy.service.common.model.Result;
|
|
|
import com.yihu.wlyy.service.dao.DoctorMappingDao;
|
|
|
import com.yihu.wlyy.service.dao.PatientDao;
|
|
|
import com.yihu.wlyy.service.dao.SignFamilyDao;
|
|
|
import com.yihu.wlyy.service.dao.prescription.PrescriptionDao;
|
|
|
import com.yihu.wlyy.service.dao.prescription.PrescriptionDiagnosisDao;
|
|
|
import com.yihu.wlyy.service.dao.prescription.PrescriptionInfoDao;
|
|
|
import com.yihu.wlyy.service.dao.prescription.PrescriptionLogDao;
|
|
|
import com.yihu.wlyy.service.entity.Patient;
|
|
|
import com.yihu.wlyy.service.entity.SignFamily;
|
|
|
import com.yihu.wlyy.service.entity.prescription.Prescription;
|
|
|
import com.yihu.wlyy.service.entity.prescription.PrescriptionDiagnosis;
|
|
|
import com.yihu.wlyy.service.entity.prescription.PrescriptionInfo;
|
|
|
import com.yihu.wlyy.service.entity.prescription.PrescriptionLog;
|
|
|
import com.yihu.wlyy.service.service.ZysoftBaseService;
|
|
@ -20,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
@ -40,6 +48,14 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
private StringRedisTemplate redisTemplate;
|
|
|
@Autowired
|
|
|
private PrescriptionInfoDao prescriptionInfoDao;
|
|
|
@Autowired
|
|
|
private PatientDao patientDao;
|
|
|
@Autowired
|
|
|
private DoctorMappingDao doctorMappingDao;
|
|
|
@Autowired
|
|
|
private SignFamilyDao signFamilyDao;
|
|
|
@Autowired
|
|
|
private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
|
|
|
|
|
|
private String channelTopic = "redisPrescription";
|
|
|
|
|
@ -279,17 +295,15 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
* 7.1字典获取接口
|
|
|
* @param dictName 字典名称
|
|
|
* @param hospital
|
|
|
* @param licence
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getDictForI(String dictName,String hospital,String licence) throws Exception
|
|
|
public String getDictForI(String dictName,String hospital) throws Exception
|
|
|
{
|
|
|
if(hospital==null){
|
|
|
String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
|
|
|
hospital = hospitalMapping[0];
|
|
|
licence = hospitalMapping[1];
|
|
|
}
|
|
|
|
|
|
String[] hospitalMapping = getHospitalMapping(hospital); //获取机构映射
|
|
|
hospital = hospitalMapping[0];
|
|
|
String licence = hospitalMapping[1];
|
|
|
|
|
|
Map<String,String> header = new HashMap<>();
|
|
|
header.put("ORGCODE",hospital);
|
|
@ -308,17 +322,14 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
* @param staffCode 员工编码
|
|
|
* @param deptCode 部门编码
|
|
|
* @param hospital
|
|
|
* @param licence
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getRecipeTemplate(String staffCode,String deptCode,String hospital,String licence) throws Exception
|
|
|
public String getRecipeTemplate(String staffCode,String deptCode,String hospital) throws Exception
|
|
|
{
|
|
|
if(hospital==null){
|
|
|
String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
|
|
|
hospital = hospitalMapping[0];
|
|
|
licence = hospitalMapping[1];
|
|
|
}
|
|
|
String[] hospitalMapping = getHospitalMapping(hospital); //获取机构映射
|
|
|
hospital = hospitalMapping[0];
|
|
|
String licence = hospitalMapping[1];
|
|
|
|
|
|
Map<String,String> header = new HashMap<>();
|
|
|
header.put("ORGCODE",hospital);
|
|
@ -335,20 +346,25 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
|
|
|
/**
|
|
|
* 调阅历史处方接口
|
|
|
* @param cardNo 卡号
|
|
|
* @param cardNo 社保卡号
|
|
|
* @param recipeNo 医嘱号
|
|
|
* @param hospital
|
|
|
* @param licence
|
|
|
* @param applyTimeFrom 开始时间
|
|
|
* @param applyTimeEnd 结束时间
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getLastRecipe(String cardNo,String recipeNo,String hospital,String licence) throws Exception
|
|
|
public String getLastRecipe(String cardNo,String recipeNo,String applyTimeFrom,String applyTimeEnd) throws Exception
|
|
|
{
|
|
|
if(hospital==null){
|
|
|
String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
|
|
|
hospital = hospitalMapping[0];
|
|
|
licence = hospitalMapping[1];
|
|
|
}
|
|
|
String hospital = null;
|
|
|
String licence = null;
|
|
|
|
|
|
Patient patient = patientDao.findBySsc(cardNo);
|
|
|
SignFamily signFamily = signFamilyDao.findByPatient(patient.getCode());
|
|
|
//
|
|
|
String[] hospitalMapping = getHospitalMapping(signFamily.getHospital()); //获取机构映射
|
|
|
hospital = hospitalMapping[0];
|
|
|
licence = hospitalMapping[1];
|
|
|
|
|
|
|
|
|
Map<String,String> header = new HashMap<>();
|
|
|
header.put("ORGCODE",hospital);
|
|
@ -357,6 +373,8 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
params.put("cardNo",cardNo);
|
|
|
params.put("recipeNo",recipeNo);
|
|
|
params.put("applyTimeFrom",applyTimeFrom);
|
|
|
params.put("applyTimeEnd",applyTimeEnd);
|
|
|
|
|
|
String response = postSecond("getLastRecipe","调阅历史处方接口",params,null,header,false,2);
|
|
|
|
|
@ -365,27 +383,63 @@ public class PrescriptionService extends ZysoftBaseService{
|
|
|
|
|
|
/**
|
|
|
* 7.4 挂号开处方接口
|
|
|
* @param json
|
|
|
* @param hospital
|
|
|
* @param licence
|
|
|
* @param prescriptionCode
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String saveRecipe(JSONObject json, String hospital, String licence) throws Exception
|
|
|
public String saveRecipe(String prescriptionCode) throws Exception
|
|
|
{
|
|
|
if(hospital==null){
|
|
|
String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
|
|
|
hospital = hospitalMapping[0];
|
|
|
licence = hospitalMapping[1];
|
|
|
}
|
|
|
Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
|
|
|
|
|
|
String[] hospitalMapping = getHospitalMapping(prescription.getHospital()); //获取机构映射
|
|
|
String hospital = hospitalMapping[0];
|
|
|
String licence = hospitalMapping[1];
|
|
|
|
|
|
Map<String,String> header = new HashMap<>();
|
|
|
header.put("ORGCODE",hospital);
|
|
|
header.put("LICENCE",licence);
|
|
|
|
|
|
//拼接开方参数
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("cardNo",prescription.getSsc());// "cardNo": "病人卡号",
|
|
|
// "saveDept": "开单科室编码",
|
|
|
// "REGISTER_TYPE": "挂号类型编码",
|
|
|
// "RATE_TYPE": "费别类型编码",
|
|
|
String jwdoctor = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(prescription.getDoctor(),hospital);
|
|
|
json.put("saveOperator",jwdoctor);// "saveOperator": "开单人员编码",
|
|
|
List<PrescriptionDiagnosis> prescriptionDiagnosisList = prescriptionDiagnosisDao.findByPrescriptionCode(prescriptionCode);
|
|
|
json.put("DIAGNOSE_CODE",prescriptionDiagnosisList.get(0).getCode());//"DIAGNOSE_CODE": "诊断编码",
|
|
|
|
|
|
List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(prescriptionCode);
|
|
|
JSONArray ja = new JSONArray();
|
|
|
for (PrescriptionInfo info : list){
|
|
|
JSONObject js = new JSONObject();
|
|
|
js.put("ITEM_CODE",info.getDrugCode());//"ITEM_CODE": "药品代码",
|
|
|
js.put("ITEM_NAME",info.getDrugName());//"ITEM_NAME": "药品名称",
|
|
|
js.put("SUBJECT_CLASS",info.getSubjectClass());//"SUBJECT_CLASS": "科目类别编码",
|
|
|
js.put("ITEM_QUANTITY",info.getNum());//"ITEM_QUANTITY": "药品数量",
|
|
|
js.put("ITEM_UNIT",info.getDrugNumUnit());// "ITEM_UNIT": " 数量单位编码 ",
|
|
|
js.put("ITEM_SPEC",info.getDrugFormat());// "ITEM_SPEC": "药品规格",
|
|
|
js.put("ITEM_PRICE",info.getPrice());// "ITEM_PRICE": "药品单价",
|
|
|
js.put("COST",info.getCode());// "COST": "药品金额",
|
|
|
js.put("BIND_FLAG",info.getBindFlag());// "BIND_FLAG": " 成组标志, 0.非成组,1.成组",
|
|
|
js.put("FREQUENCY",info.getDrugRate());// "FREQUENCY": "用药频次编码",
|
|
|
js.put("DAY_COUNT",info.getDayCount());// "DAY_COUNT": "用药天数",
|
|
|
js.put("USAGE",info.getDrugUsage());// "USAGE": "用药方法编码",
|
|
|
js.put("PHYSIC_DOSE",info.getPhysicDose());// "PHYSIC_DOSE": " 用药剂量",
|
|
|
js.put("PHYSIC_DOSE_UNIT",info.getPhysicDoseUnit());// "PHYSIC_DOSE_UNIT": " 剂量单位编码",
|
|
|
js.put("PHYSIC_AMOUNT",info.getPhysicAmount());// "PHYSIC_AMOUNT": " 用药总量",
|
|
|
js.put("PHYSIC_AMOUNT_UNIT",info.getPhysicAmountUnit());// "PHYSIC_AMOUNT_UNIT": " 总量单位编码",
|
|
|
js.put("PHYSIC_INJECT_PLACE",info.getPhysicInjectPlace());// "PHYSIC_INJECT_PLACE": " 注射地点编码",
|
|
|
js.put("PHYSIC_SKIN_TEST",info.getPhysicSkinTest());// "PHYSIC_SKIN_TEST": " 皮试类型编码",
|
|
|
js.put("REMARK",info.getRemark());// " REMARK ": " 备注"
|
|
|
ja.add(js);
|
|
|
}
|
|
|
json.put("recipeInfo",ja);
|
|
|
|
|
|
String response = postSecond("saveRecipe","挂号开处方接口",null,json,header,false,2);
|
|
|
|
|
|
return response;
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
/**
|