|
@ -5,6 +5,7 @@ import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
@ -67,7 +68,6 @@ public class EhrService extends BaseService {
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 事件基本信息 (主表)
|
|
|
*/
|
|
@ -185,6 +185,14 @@ public class EhrService extends BaseService {
|
|
|
JSONObject catalog = new JSONObject();
|
|
|
catalog.put("0201","住院诊疗基本信息");
|
|
|
//catalog.put("0212","入院病历记录");
|
|
|
JSONObject master = getEventBaseInfo(profileId);
|
|
|
if(master.has("EHR_000155"))
|
|
|
{
|
|
|
catalog.put("0213","出院小结");
|
|
|
}
|
|
|
if(master.has("EHR_000255")) {
|
|
|
catalog.put("0217","死亡记录");
|
|
|
}
|
|
|
|
|
|
List<String> tables = containTables(profileId);
|
|
|
|
|
@ -193,9 +201,7 @@ public class EhrService extends BaseService {
|
|
|
catalog.put("0202","住院费用明细");
|
|
|
}
|
|
|
|
|
|
if(tables.contains("HDSC02_14")){
|
|
|
catalog.put("0213","出院小结");
|
|
|
}
|
|
|
|
|
|
|
|
|
if(tables.contains("HDSC02_12")){
|
|
|
catalog.put("0214","长期医嘱");
|
|
@ -209,9 +215,6 @@ public class EhrService extends BaseService {
|
|
|
catalog.put("0216","住院手术记录");
|
|
|
}
|
|
|
|
|
|
if(tables.contains("HDSC02_15")){
|
|
|
catalog.put("0217","死亡记录");
|
|
|
}
|
|
|
|
|
|
if(tables.contains("HDSD02_01")){
|
|
|
catalog.put("0221","住院检验报告");
|
|
@ -255,7 +258,7 @@ public class EhrService extends BaseService {
|
|
|
|
|
|
|
|
|
JSONObject item = new JSONObject();
|
|
|
item.put("END_TIME",jsonObject.has("EHR_000230")?jsonObject.optString("EHR_000230"):jsonObject.optString("event_date")); //入院时间
|
|
|
item.put("END_TIME",jsonObject.optString("event_date")); //创建时间
|
|
|
item.put("ORG_NAME",jsonObject.optString("org_name")); //机构名称
|
|
|
item.put("ORG_CODE",jsonObject.optString("org_code")); //机构代码
|
|
|
item.put("UNIONSSID",strSSID); //社保卡号
|
|
@ -302,16 +305,61 @@ public class EhrService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 用药记录
|
|
|
* 用药记录列表
|
|
|
*/
|
|
|
public String getDrugsList(String idcard) {
|
|
|
String url = ehrUrl + idcard +"/laboratory?demographic_id="+idcard;
|
|
|
return HttpClientUtil.get(url, "UTF-8");
|
|
|
}
|
|
|
public String getDrugsList(String strSSID) {
|
|
|
//通过ssid获取身份证
|
|
|
Patient patient = patientDao.findBySsc(strSSID);
|
|
|
if(patient!=null) {
|
|
|
String url = ehrUrl + patient.getIdcard() +"/profile/medical_events?demographic_id=" + patient.getIdcard();
|
|
|
String response = HttpClientUtil.get(url, "UTF-8");
|
|
|
JSONArray jsonArray = new JSONArray(response);
|
|
|
JSONArray resultArray = new JSONArray();
|
|
|
for (int i=0; i<jsonArray.length(); i++) {
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
|
|
|
|
|
|
JSONObject item = new JSONObject();
|
|
|
item.put("END_TIME",jsonObject.optString("event_date")); //创建时间
|
|
|
item.put("ORG_NAME",jsonObject.optString("org_name")); //机构名称
|
|
|
item.put("ORG_CODE",jsonObject.optString("org_code")); //机构代码
|
|
|
item.put("UNIONSSID",strSSID); //社保卡号
|
|
|
item.put("NAME",jsonObject.optString("EHR_000004")); //姓名
|
|
|
item.put("EVENT",jsonObject.optString("event_no")); //事件号
|
|
|
String profileId = jsonObject.optString("rowkey");
|
|
|
item.put("SERIAL",profileId); //rowkey
|
|
|
|
|
|
//包含模板
|
|
|
JSONObject catalog = new JSONObject();
|
|
|
List<String> tables = containTables(profileId);
|
|
|
//0门诊 1住院
|
|
|
String eventType = jsonObject.optString("event_type");
|
|
|
|
|
|
//判断是否有检查报告
|
|
|
if(tables.contains("HDSC01_09")){
|
|
|
if(eventType.equals("0")) {
|
|
|
catalog.put("0141", "门诊用药记录");
|
|
|
}
|
|
|
else{
|
|
|
catalog.put("0241","住院用药记录");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if(catalog.length()>0) {
|
|
|
item.put("CATALOG", catalog); //档案类别
|
|
|
resultArray.put(item);
|
|
|
}
|
|
|
}
|
|
|
return resultArray.toString();
|
|
|
}
|
|
|
else{
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/***************************************** 档案数据 ****************************************************************/
|
|
|
/**
|
|
|
* 获取档案数据
|
|
|
* @return
|
|
@ -328,6 +376,12 @@ public class EhrService extends BaseService {
|
|
|
else if (strCatalog.equals("0201")) { //住院诊疗基本信息
|
|
|
re = get0201(strSSID,strSerial);
|
|
|
}
|
|
|
else if (strCatalog.equals("0213")) { //出院小结
|
|
|
re = get0213(strSSID,strSerial);
|
|
|
}
|
|
|
else if (strCatalog.equals("0217")) { //死亡记录
|
|
|
re = get0217(strSSID,strSerial);
|
|
|
}
|
|
|
|
|
|
/******************************** 细表数据 ********************************************************/
|
|
|
else if (strCatalog.equals("0102")) { //门诊费用明细
|
|
@ -340,38 +394,31 @@ public class EhrService extends BaseService {
|
|
|
re = getLaboratory(strSSID,strSerial,"0121");
|
|
|
}
|
|
|
else if (strCatalog.equals("0141")) { //门诊用药记录
|
|
|
|
|
|
re = getDrug(strSSID,strSerial,"0141");
|
|
|
}
|
|
|
else if (strCatalog.equals("0116")) { //门诊手术记录
|
|
|
|
|
|
re = get0116(strSSID,strSerial);
|
|
|
}
|
|
|
else if (strCatalog.equals("0202")) { //住院费用明细
|
|
|
|
|
|
}
|
|
|
else if (strCatalog.equals("0213")) { //出院小结
|
|
|
|
|
|
re = get0202(strSSID,strSerial);
|
|
|
}
|
|
|
else if (strCatalog.equals("0214")) { //长期医嘱
|
|
|
|
|
|
re = get0214(strSSID,strSerial);
|
|
|
}
|
|
|
else if (strCatalog.equals("0215")) { //临时医嘱
|
|
|
|
|
|
re = get0215(strSSID,strSerial);
|
|
|
}
|
|
|
else if (strCatalog.equals("0216")) { //住院手术记录
|
|
|
|
|
|
}
|
|
|
else if (strCatalog.equals("0217")) { //死亡记录
|
|
|
|
|
|
re = get0216(strSSID,strSerial);
|
|
|
}
|
|
|
else if (strCatalog.equals("0221")) { //住院检验报告
|
|
|
re = getLaboratory(strSSID,strSerial,"0221");
|
|
|
|
|
|
}
|
|
|
else if (strCatalog.equals("0231")) { //住院检查报告
|
|
|
re = getExamination(strSSID,strSerial,"0231");
|
|
|
}
|
|
|
else if (strCatalog.equals("0241")) { //住院用药记录
|
|
|
|
|
|
re = getDrug(strSSID,strSerial,"0241");
|
|
|
}
|
|
|
|
|
|
}
|
|
@ -384,9 +431,6 @@ public class EhrService extends BaseService {
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//门诊基本诊疗信息
|
|
|
public String get0101(String ssid,String profileId)
|
|
|
{
|
|
@ -604,6 +648,223 @@ public class EhrService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//出院小结
|
|
|
public String get0213(String ssid,String profileId)
|
|
|
{
|
|
|
//事件主要信息
|
|
|
JSONObject info = getEventBaseInfo(profileId);
|
|
|
|
|
|
if(info!=null) {
|
|
|
|
|
|
String re = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
|
|
"<ClinicalDocument>\n" +
|
|
|
" <version code=\"2.0.0.0\" date=\"2009-12-01\">根据卫生部标准第一次修订</version>\n" +
|
|
|
" <ehr code=\"0213\" codeSystem=\"STD_EHR\">出院小结</ehr>\n" +
|
|
|
" <title>出院小结</title>\n" +
|
|
|
" <org code=\""+info.optString("org_code") +"\" codeSystem=\"STD_HEALTH_ORG\">"+info.optString("org_name") +"</org>\n" +
|
|
|
" <id extension=\"" + profileId + "\" eventno=\"" + info.optString("event_no") + "\"></id>\n" +
|
|
|
" <effectiveTime value=\"" + info.optString("create_date") + "\"/>\n" +
|
|
|
" <recordTarget>\n" +
|
|
|
" <patient>\n" +
|
|
|
" <id extension=\""+ssid+"\"></id>\n" +
|
|
|
" <name>"+info.optString("EHR_000004")+"</name>\n" +
|
|
|
" <sex code=\"" + info.optString("EHR_000019") + "\" codeSystem=\"GB/T2261.1-2003\">" + info.optString("EHR_000019_VALUE") + "</sex>\n" +
|
|
|
" <nation code=\""+ info.optString("EHR_000016") + "\" codeSystem=\"GB 3304-1991\">"+ info.optString("EHR_000016_VALUE") +"</nation>\n" +
|
|
|
" <work code=\""+ info.optString("EHR_000022") +"\" codeSystem=\"GB/T 6565-1999\">"+ info.optString("EHR_000022_VALUE") +"</work>\n" +
|
|
|
" <birthAdd>"+ info.optString("EHR_000015") +"</birthAdd>\n" +
|
|
|
" <birthDate>" + info.optString("EHR_000007") + "</birthDate>\n" +
|
|
|
" <age>"+ IdCardUtil.getAgeForIdcard(info.optString("demographic_id") )+"</age>\n" +
|
|
|
" <marriage code=\"" + info.optString("EHR_000014") + "\" codeSystem=\"GB/T 2261.2-2003\">" + info.optString("EHR_000014_VALUE") + "</marriage>\n" +
|
|
|
" <address>【现住址】</address>\n" +
|
|
|
" <organization>"+ info.optString("EHR_000009") +"</organization>\n" +
|
|
|
" </patient>\n" +
|
|
|
" </recordTarget>\n" +
|
|
|
" <residentDoctor>\n" +
|
|
|
" <time value=\""+ info.optString("EHR_000173") +"\"/>\n" +
|
|
|
" <id extension=\""+ info.optString("EHR_000171") +"\"/>\n" +
|
|
|
" <name>"+ info.optString("EHR_000172") +"</name>\n" +
|
|
|
" </residentDoctor>\n" +
|
|
|
" <inChargeDoctor>\n" +
|
|
|
" <time value=\""+ info.optString("EHR_000169") +"\"/>\n" +
|
|
|
" <id extension=\""+ info.optString("EHR_000167") +"\"/>\n" +
|
|
|
" <name>"+ info.optString("EHR_000168") +"</name>\n" +
|
|
|
" </inChargeDoctor>\n" +
|
|
|
" <component>\n" +
|
|
|
" <section>\n" +
|
|
|
" <code code=\"common\" codeSystem=\"\" displayName=\"出院小结\"/>\n" +
|
|
|
" <entry>\n" +
|
|
|
" <residence>\n" +
|
|
|
" <serial>"+ info.optString("EHR_000234") +"</serial>\n" +
|
|
|
" <code>"+ info.optString("EHR_000236") +"</code>\n" +
|
|
|
" </residence>\n" +
|
|
|
" <inTime value=\""+ info.optString("EHR_000162") +"\"/>\n" +
|
|
|
" <outTime value=\""+ info.optString("EHR_000155") +"\"/>\n" +
|
|
|
" <inDept code=\""+ info.optString("EHR_000228") +"\" codeSystem=\"GB/T 2261.2-2003\">"+ info.optString("EHR_000229") +"</inDept>\n" +
|
|
|
" <bed>"+ info.optString("EHR_000227") +"</bed>\n" +
|
|
|
" <inHospitalDay>"+ info.optString("EHR_000170") +"</inHospitalDay>\n" +
|
|
|
" <inDiagnosis code=\""+ info.optString("EHR_000163") +"\" codeSystem=\"ICD-10\">"+ info.optString("EHR_000164") +"</inDiagnosis>\n" +
|
|
|
" <inCondition>"+ info.optString("EHR_000161") +"</inCondition>\n" +
|
|
|
" <remedialCourse>"+ info.optString("EHR_000165") +"</remedialCourse>\n" +
|
|
|
" <outCondition>"+ info.optString("EHR_000161") +"</outCondition>\n" +
|
|
|
" <outDiagnosis code=\""+ info.optString("EHR_000158") +"\" codeSystem=\"ICD-10\">"+ info.optString("EHR_000159") +"\n" +
|
|
|
" <outOrder>"+ info.optString("EHR_000157") +"</outOrder>\n" +
|
|
|
" <remedialResult>"+ info.optString("EHR_000166") +"</remedialResult>\n" +
|
|
|
" </entry>\n" +
|
|
|
" </section>\n" +
|
|
|
" </component>\n" +
|
|
|
"</ClinicalDocument>";
|
|
|
|
|
|
return re;
|
|
|
|
|
|
}
|
|
|
else{
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//死亡记录
|
|
|
public String get0217(String ssid,String profileId)
|
|
|
{
|
|
|
//事件主要信息
|
|
|
JSONObject info = getEventBaseInfo(profileId);
|
|
|
|
|
|
if(info!=null) {
|
|
|
//死亡链(业务对接不上)
|
|
|
|
|
|
String re = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
|
|
"<ClinicalDocument>\n" +
|
|
|
" <version code=\"2.0.0.0\" date=\"2009-12-01\">根据卫生部标准第一次修订</version>\n" +
|
|
|
" <ehr code=\"0217\" codeSystem=\"STD_EHR\">死亡医学证明</ehr>\n" +
|
|
|
" <title>死亡医学证明</title>\n" +
|
|
|
" <org code=\""+info.optString("org_code") +"\" codeSystem=\"STD_HEALTH_ORG\">"+info.optString("org_name") +"</org>\n" +
|
|
|
" <id extension=\"" + profileId + "\" eventno=\"" + info.optString("event_no") + "\"></id>\n" +
|
|
|
" <effectiveTime value=\"" + info.optString("create_date") + "\"/>\n" +
|
|
|
" <recordTarget>\n" +
|
|
|
" <patient>\n" +
|
|
|
" <id extension=\""+ssid+"\"></id>\n" +
|
|
|
" <name>"+info.optString("EHR_000004")+"</name>\n" +
|
|
|
" <sex code=\"" + info.optString("EHR_000019") + "\" codeSystem=\"GB/T2261.1-2003\">" + info.optString("EHR_000019_VALUE") + "</sex>\n" +
|
|
|
" <nation code=\""+ info.optString("EHR_000016") + "\" codeSystem=\"GB 3304-1991\">"+ info.optString("EHR_000016_VALUE") +"</nation>\n" +
|
|
|
" <work code=\""+ info.optString("EHR_000022") +"\" codeSystem=\"GB/T 6565-1999\">"+ info.optString("EHR_000022_VALUE") +"</work>\n" +
|
|
|
" <birthAdd>"+ info.optString("EHR_000015") +"</birthAdd>\n" +
|
|
|
" <birthDate>" + info.optString("EHR_000007") + "</birthDate>\n" +
|
|
|
" <age>"+ IdCardUtil.getAgeForIdcard(info.optString("demographic_id") )+"</age>\n" +
|
|
|
" <marriage code=\"" + info.optString("EHR_000014") + "\" codeSystem=\"GB/T 2261.2-2003\">" + info.optString("EHR_000014_VALUE") + "</marriage>\n" +
|
|
|
" <degree code=\""+ info.optString("EHR_000020") + "\" codeSystem=\"GB/T 4658-1984\">"+ info.optString("EHR_000020_VALUE") + "</degree>\n" +
|
|
|
" <country code=\""+ info.optString("EHR_000010") + "\" codeSystem=\"GB/T 2659-2000\">"+ info.optString("EHR_000010_VALUE") + "</country>\n" +
|
|
|
" <idno>"+ info.optString("demographic_id") + "</idno>\n" +
|
|
|
" <!--现住址-->\n" +
|
|
|
" <address>\n" +
|
|
|
" <type code=\"09\" codeSystem=\"CV0300.01\">现住址</type>\n" +
|
|
|
" <adminDivision code=\"【行政区划代码(字典STD_ADMIN_DIVISION)】\" codeSystem=\"GB/T 2260-2007\">【行政区划名称】</adminDivision>\n" +
|
|
|
" <country code=\"【国籍代码(字典STD_COUNTRY)】\" codeSystem=\"GB/T 2659-2000\">【国家名称】</country>\n" +
|
|
|
" <state>【省份】</state>\n" +
|
|
|
" <city>【市】</city>\n" +
|
|
|
" <county>【区、县】</county>\n" +
|
|
|
" <street>【街道、镇】</street>\n" +
|
|
|
" <village>【村、街、路、弄】</village>\n" +
|
|
|
" <houseNo>【门牌号】</houseNo>\n" +
|
|
|
" <streetAddressLine>"+ info.optString("EHR_000241") +"</streetAddressLine>\n" +
|
|
|
" <postalCode>【邮政编码】</postalCode>\n" +
|
|
|
" </address>\n" +
|
|
|
" <!--户口地址-->\n" +
|
|
|
" <registeredAddress>\n" +
|
|
|
" <type code=\"01\" codeSystem=\"CV0300.01\">户口地址</type>\n" +
|
|
|
" <adminDivision code=\"【行政区划代码(字典STD_ADMIN_DIVISION)】\" codeSystem=\"GB/T 2260-2007\">【行政区划名称】</adminDivision>\n" +
|
|
|
" <country code=\""+ info.optString("EHR_000010") +"\" codeSystem=\"GB/T 2659-2000\">"+ info.optString("EHR_000010_VALUE") +"</country>\n" +
|
|
|
" <state>【省份】</state>\n" +
|
|
|
" <city>【市】</city>\n" +
|
|
|
" <county>【区、县】</county>\n" +
|
|
|
" <street>【街道、镇】</street>\n" +
|
|
|
" <village>【村、街、路、弄】</village>\n" +
|
|
|
" <houseNo>【门牌号】</houseNo>\n" +
|
|
|
" <streetAddressLine>"+ info.optString("EHR_000013") +"</streetAddressLine>\n" +
|
|
|
" <postalCode>"+ info.optString("EHR_000012") +"</postalCode>\n" +
|
|
|
" </registeredAddress>\n" +
|
|
|
" <organization telephone=\"【联系电话】\" postalCode=\"【邮政编码】\" address=\"【地址】\">"+ info.optString("EHR_000009") +"</organization>\n" +
|
|
|
" </patient>\n" +
|
|
|
" </recordTarget>\n" +
|
|
|
" <contactPerson>\n" +
|
|
|
" <type>"+ info.optString("EHR_000252") +"</type>\n" +
|
|
|
" <name>"+ info.optString("EHR_000253") +"</name>\n" +
|
|
|
" <telephone>【联系人:电话】</telephone>\n" +
|
|
|
" <address>"+ info.optString("EHR_000251") +"</address>\n" +
|
|
|
" </contactPerson>\n" +
|
|
|
" <author>\n" +
|
|
|
" <time>"+info.optString("EHR_000262")+"</time>\n" +
|
|
|
" <id extension=\""+info.optString("EHR_000263")+"\"/>\n" +
|
|
|
" <name>"+info.optString("EHR_000264")+"</name>\n" +
|
|
|
" </author>\n" +
|
|
|
" <component>\n" +
|
|
|
" <section>\n" +
|
|
|
" <!--档案子类别,用于类别的扩展,code子类别编码;displayName名称。当前为固定值-->\n" +
|
|
|
" <code code=\"common\" codeSystem=\"\" displayName=\"死亡医学证明\"/>\n" +
|
|
|
" <entry>\n" +
|
|
|
" <inTime>"+info.optString("EHR_000250")+"</inTime>\n" +
|
|
|
" <deathTime>"+info.optString("EHR_000255")+"</deathTime>\n" +
|
|
|
" <placeType code=\""+info.optString("EHR_000254")+"\" codeSystem=\"CV8500.01\">"+info.optString("EHR_000254_VALUE")+"</placeType>\n" +
|
|
|
" <causeOfDeath>\n" +
|
|
|
/* " <causeOfDeathA>\n" +
|
|
|
" <type code=\"死因链代码(字典STD_DEATH_CAUSE_CHAIN):固定值1\" codeSystem=\"CV8500.05\">死因链名称</type>\n" +
|
|
|
" <icd10 code=\"疾病ICD10编码(字典STD_ICD)\" codeSystem=\"ICD-10\">疾病名称</icd10>\n" +
|
|
|
" <interval code=\"时间间隔单位类别(字典STD_TIME_INTERVAL_UNIT):固定值4\">发病到死亡的大概时间间隔(单位:日)</interval>\n" +
|
|
|
" <detail>直接死亡原因A(导致死亡的最后疾病或情况)</detail>\n" +
|
|
|
" </causeOfDeathA>\n" +
|
|
|
" <causeOfDeathB>\n" +
|
|
|
" <type code=\"死因链代码(字典STD_DEATH_CAUSE_CHAIN):固定值2\" codeSystem=\"CV8500.05\">死因链名称</type>\n" +
|
|
|
" <icd10 code=\"疾病ICD10编码(字典STD_ICD)\" codeSystem=\"ICD-10\">疾病名称</icd10>\n" +
|
|
|
" <interval code=\"时间间隔单位类别(字典STD_TIME_INTERVAL_UNIT):固定值4\">发病到死亡的大概时间间隔(单位:日)</interval>\n" +
|
|
|
" <detail>直接死亡原因B(引起A的最后疾病或情况)</detail>\n" +
|
|
|
" </causeOfDeathB>\n" +
|
|
|
" <causeOfDeathC>\n" +
|
|
|
" <type code=\"死因链代码(字典STD_DEATH_CAUSE_CHAIN):固定值3\" codeSystem=\"CV8500.05\">死因链名称</type>\n" +
|
|
|
" <icd10 code=\"疾病ICD10编码(字典STD_ICD)\" codeSystem=\"ICD-10\">疾病名称</icd10>\n" +
|
|
|
" <interval code=\"时间间隔单位类别(字典STD_TIME_INTERVAL_UNIT):固定值4\">发病到死亡的大概时间间隔(单位:日)</interval>\n" +
|
|
|
" <detail>直接死亡原因C(引起B的最后疾病或情况)</detail>\n" +
|
|
|
" </causeOfDeathC>\n" +
|
|
|
" <causeOfDeathD>\n" +
|
|
|
" <type code=\"死因链代码(字典STD_DEATH_CAUSE_CHAIN):固定值4\" codeSystem=\"CV8500.05\">死因链名称</type>\n" +
|
|
|
" <icd10 code=\"疾病ICD10编码(字典STD_ICD)\" codeSystem=\"ICD-10\">疾病名称</icd10>\n" +
|
|
|
" <interval code=\"时间间隔单位类别(字典STD_TIME_INTERVAL_UNIT):固定值4\">发病到死亡的大概时间间隔(单位:日)</interval>\n" +
|
|
|
" <detail>直接死亡原因D(引起C的最后疾病或情况)</detail>\n" +
|
|
|
" </causeOfDeathD>\n" +
|
|
|
" <causeOfDeathOther1>\n" +
|
|
|
" <type code=\"死因链代码(字典STD_DEATH_CAUSE_CHAIN):固定值9\" codeSystem=\"CV8500.05\">死因链名称</type>\n" +
|
|
|
" <interval code=\"时间间隔单位类别(字典STD_TIME_INTERVAL_UNIT):固定值4\">发病到死亡的大概时间间隔(单位:日)</interval>\n" +
|
|
|
" <detail>促进死亡,但与导致死亡的疾病或情况无关的其他重要情况1</detail>\n" +
|
|
|
" </causeOfDeathOther1>\n" +
|
|
|
" <causeOfDeathOther2>\n" +
|
|
|
" <type code=\"死因链代码(字典STD_DEATH_CAUSE_CHAIN):固定值9\" codeSystem=\"CV8500.05\">死因链名称</type>\n" +
|
|
|
" <interval code=\"时间间隔单位类别(字典STD_TIME_INTERVAL_UNIT):固定值4\">发病到死亡的大概时间间隔(单位:日)</interval>\n" +
|
|
|
" <detail>促进死亡,但与导致死亡的疾病或情况无关的其他重要情况2</detail>\n" +
|
|
|
" </causeOfDeathOther2>\n" +
|
|
|
" <causeOfDeathOther3>\n" +
|
|
|
" <type code=\"死因链代码(字典STD_DEATH_CAUSE_CHAIN):固定值9\" codeSystem=\"CV8500.05\">死因链名称</type>\n" +
|
|
|
" <interval code=\"时间间隔单位类别(字典STD_TIME_INTERVAL_UNIT):固定值4\">发病到死亡的大概时间间隔(单位:日)</interval>\n" +
|
|
|
" <detail>促进死亡,但与导致死亡的疾病或情况无关的其他重要情况3</detail>\n" +
|
|
|
" </causeOfDeathOther3>\n" +*/
|
|
|
" </causeOfDeath>\n" +
|
|
|
" <deathOrg code=\""+info.optString("EHR_000256")+"\" codeSystem=\"STD_HEALTH_ORG\">"+info.optString("EHR_000257")+"</deathOrg>\n" +
|
|
|
" <deathcatalog code=\""+info.optString("EHR_000258")+"\" codeSystem=\"STD_DEAD_CATALOG\">"+info.optString("EHR_000258_VALUE")+"</deathcatalog>\n" +
|
|
|
" <highestDiagnosis>\n" +
|
|
|
" <level code=\""+info.optString("EHR_000260")+"\" codeSystem=\"CV8500.03\">"+info.optString("EHR_000260_VALUE")+"</level>\n" +
|
|
|
" <org code=\""+info.optString("EHR_000259")+"\" codeSystem=\"STD_HEALTH_ORG\">"+info.optString("EHR_000259")+"</org>\n" +
|
|
|
" <diagnosisGist code=\""+info.optString("EHR_000261")+"\" codeSystem=\"CV8500.02\">"+info.optString("EHR_000261")+"</diagnosisGist>\n" +
|
|
|
" </highestDiagnosis>\n" +
|
|
|
" <remedialCourse>"+info.optString("EHR_000266")+"</remedialCourse>\n" +
|
|
|
" </entry>\n" +
|
|
|
" </section>\n" +
|
|
|
" </component>\n" +
|
|
|
"</ClinicalDocument>";
|
|
|
|
|
|
return re;
|
|
|
|
|
|
}
|
|
|
else{
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//检查报告单(取第一条)
|
|
|
public String getExamination(String ssid,String profileId,String catalog)
|
|
|
{
|
|
@ -831,6 +1092,292 @@ public class EhrService extends BaseService {
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
//长期医嘱
|
|
|
public String get0214(String ssid,String profileId)
|
|
|
{
|
|
|
//事件主要信息
|
|
|
JSONObject info = getEventBaseInfo(profileId);
|
|
|
|
|
|
if(info!=null) {
|
|
|
String orderString = "";
|
|
|
|
|
|
//获取长期医嘱
|
|
|
String url = ehrUrl + URLEncoder.encode("{demographic_id}")+"/hospitalized/orders/longtime?profile_id=" + profileId;
|
|
|
String response = HttpClientUtil.get(url, "UTF-8");
|
|
|
JSONObject obj = new JSONObject(response);
|
|
|
if (obj.getBoolean("successFlg") && obj.getInt("totalCount") > 0) {
|
|
|
JSONArray array = obj.getJSONArray("detailModelList");
|
|
|
if (array != null && array.length() > 0) {
|
|
|
for (int i = 0; i < array.length(); i++) {
|
|
|
JSONObject item = array.getJSONObject(i);
|
|
|
orderString += "<item>\n" +
|
|
|
" <orderTime>"+item.optString("EHR_000279") +"</orderTime>\n" +
|
|
|
" <orderDoctor>"+item.optString("EHR_000280") +"</orderDoctor>\n" +
|
|
|
" <checkNurse>"+item.optString("EHR_000281") +"</checkNurse>\n" +
|
|
|
" <stopTime>"+item.optString("EHR_000277") +"</stopTime>\n" +
|
|
|
" <stopDoctor>"+item.optString("EHR_000278") +"</stopDoctor>\n" +
|
|
|
" <stopNurse>"+item.optString("EHR_000276") +"</stopNurse>\n" +
|
|
|
" <orderCode>"+item.optString("EHR_000282") +"</orderCode>\n" +
|
|
|
" <stdCode>"+item.optString("EHR_000283") +"</stdCode>\n" +
|
|
|
" <orderName>"+item.optString("EHR_000285") +"</orderName>\n" +
|
|
|
" <freq>"+item.optString("EHR_000275") +"</freq>\n" +
|
|
|
"</item>\n";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
String re = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
|
|
"<ClinicalDocument>\n" +
|
|
|
" <version code=\"2.0.0.0\" date=\"2009-12-01\">根据卫生部标准第一次修订</version>\n" +
|
|
|
" <ehr code=\"0214\" codeSystem=\"STD_EHR\">长期医嘱</ehr>\n" +
|
|
|
" <title>长期医嘱</title>\n" +
|
|
|
" <org code=\""+info.optString("org_code") +"\" codeSystem=\"STD_HEALTH_ORG\">"+info.optString("org_name") +"</org>\n" +
|
|
|
" <id extension=\"" + profileId + "\" eventno=\"" + info.optString("event_no") + "\"></id>\n" +
|
|
|
" <effectiveTime value=\"" + info.optString("create_date") + "\"/>\n" +
|
|
|
" <recordTarget>\n" +
|
|
|
" <patient>\n" +
|
|
|
" <id extension=\""+ssid+"\"></id>\n" +
|
|
|
" <name>"+info.optString("EHR_000004")+"</name>\n" +
|
|
|
" </patient>\n" +
|
|
|
" </recordTarget>\n" +
|
|
|
" <component>\n" +
|
|
|
" <section>\n" +
|
|
|
" <code code=\"common\" codeSystem=\"\" displayName=\"长期医嘱\"/>\n" +
|
|
|
" <entry>\n" +
|
|
|
" <order>\n" +
|
|
|
orderString +
|
|
|
" </order>\n" +
|
|
|
" </entry>\n" +
|
|
|
" </section>\n" +
|
|
|
" </component>\n" +
|
|
|
"</ClinicalDocument>";
|
|
|
|
|
|
return re;
|
|
|
|
|
|
}
|
|
|
else{
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//临时医嘱
|
|
|
public String get0215(String ssid,String profileId)
|
|
|
{
|
|
|
//事件主要信息
|
|
|
JSONObject info = getEventBaseInfo(profileId);
|
|
|
|
|
|
if(info!=null) {
|
|
|
String orderString = "";
|
|
|
|
|
|
//获取长期医嘱
|
|
|
String url = ehrUrl + URLEncoder.encode("{demographic_id}")+"/hospitalized/orders/longtime?profile_id=" + profileId;
|
|
|
String response = HttpClientUtil.get(url, "UTF-8");
|
|
|
JSONObject obj = new JSONObject(response);
|
|
|
if (obj.getBoolean("successFlg") && obj.getInt("totalCount") > 0) {
|
|
|
JSONArray array = obj.getJSONArray("detailModelList");
|
|
|
if (array != null && array.length() > 0) {
|
|
|
for (int i = 0; i < array.length(); i++) {
|
|
|
JSONObject item = array.getJSONObject(i);
|
|
|
orderString += " <item>\n" +
|
|
|
" <orderTime>"+item.optString("EHR_000207") +"</orderTime>\n" +
|
|
|
" <orderDoctor>"+item.optString("EHR_000208") +"</orderDoctor>\n" +
|
|
|
" <checkNurse>"+item.optString("EHR_000209") +"</checkNurse>\n" +
|
|
|
" <execNurse>"+item.optString("EHR_000218") +"</execNurse>\n" +
|
|
|
" <execTime>"+item.optString("EHR_000219") +"</execTime>\n" +
|
|
|
" <orderCode>"+item.optString("EHR_000210") +"</orderCode>\n" +
|
|
|
" <stdCode>"+item.optString("EHR_000211") +"</stdCode>\n" +
|
|
|
" <orderName>"+item.optString("EHR_000213") +"</orderName>\n" +
|
|
|
" </item>\n";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String re = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
|
|
"<ClinicalDocument>\n" +
|
|
|
" <version code=\"2.0.0.0\" date=\"2009-12-01\">根据卫生部标准第一次修订</version>\n" +
|
|
|
" <ehr code=\"0215\" codeSystem=\"STD_EHR\">临时医嘱</ehr>\n" +
|
|
|
" <title>临时医嘱</title>\n" +
|
|
|
" <org code=\""+info.optString("org_code") +"\" codeSystem=\"STD_HEALTH_ORG\">"+info.optString("org_name") +"</org>\n" +
|
|
|
" <id extension=\"" + profileId + "\" eventno=\"" + info.optString("event_no") + "\"></id>\n" +
|
|
|
" <effectiveTime value=\"" + info.optString("create_date") + "\"/>\n" +
|
|
|
" <recordTarget>\n" +
|
|
|
" <patient>\n" +
|
|
|
" <id extension=\""+ssid+"\"></id>\n" +
|
|
|
" <name>"+info.optString("EHR_000004")+"</name>\n" +
|
|
|
" </patient>\n" +
|
|
|
" </recordTarget>\n" +
|
|
|
" <component>\n" +
|
|
|
" <section>\n" +
|
|
|
" <code code=\"common\" codeSystem=\"\" displayName=\"临时医嘱\"/>\n" +
|
|
|
" <entry>\n" +
|
|
|
" <order>\n" +
|
|
|
orderString +
|
|
|
" </order>\n" +
|
|
|
" </entry>\n" +
|
|
|
" </section>\n" +
|
|
|
" </component>\n" +
|
|
|
"</ClinicalDocument>";
|
|
|
|
|
|
return re;
|
|
|
|
|
|
}
|
|
|
else{
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//门诊手术记录 (取第一条)
|
|
|
public String get0116(String ssid,String profileId)
|
|
|
{
|
|
|
String re = "";
|
|
|
//事件主要信息
|
|
|
JSONObject info = getEventBaseInfo(profileId);
|
|
|
|
|
|
if(info!=null) {
|
|
|
//获取手术记录
|
|
|
String url = ehrUrl + URLEncoder.encode("{demographic_id}")+"/laboratory?profile_id=" + profileId;
|
|
|
String response = HttpClientUtil.get(url, "UTF-8");
|
|
|
JSONObject json = new JSONObject(response);
|
|
|
if (json.getBoolean("successFlg") && json.getInt("totalCount") > 0) {
|
|
|
JSONArray array = json.getJSONArray("detailModelList");
|
|
|
if (array != null && array.length() > 0) {
|
|
|
JSONObject obj = array.getJSONObject(0);
|
|
|
re = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
|
|
"<ClinicalDocument>\n" +
|
|
|
" <version code=\"2.0.0.0\" date=\"2009-12-01\">根据卫生部标准第一次修订</version>\n" +
|
|
|
" <ehr code=\"0116\" codeSystem=\"STD_EHR\">门诊手术记录</ehr>\n" +
|
|
|
" <title>门诊手术记录</title>\n" +
|
|
|
" <org code=\""+info.optString("org_code") +"\" codeSystem=\"STD_HEALTH_ORG\">"+info.optString("org_name") +"</org>\n" +
|
|
|
" <id extension=\"" + profileId + "\" eventno=\"" + info.optString("event_no") + "\"></id>\n" +
|
|
|
" <effectiveTime value=\"" + info.optString("create_date") + "\"/>\n" +
|
|
|
" <recordTarget>\n" +
|
|
|
" <patient>\n" +
|
|
|
" <id extension=\""+ssid+"\"></id>\n" +
|
|
|
" <name>"+info.optString("EHR_000004")+"</name>\n" +
|
|
|
" </patient>\n" +
|
|
|
" </recordTarget>\n" +
|
|
|
" <author>\n" +
|
|
|
" <time>"+obj.optString("EHR_000408")+"</time>\n" +
|
|
|
" <id extension=\""+obj.optString("EHR_000409")+"\"/>\n" +
|
|
|
" <name>"+obj.optString("EHR_000410")+"</name>\n" +
|
|
|
" </author>\n" +
|
|
|
" <surgeon>\n" +
|
|
|
" <id extension=\""+obj.optString("EHR_000424")+"\"/>\n" +
|
|
|
" <name>"+obj.optString("EHR_000425")+"</name>\n" +
|
|
|
" </surgeon>\n" +
|
|
|
" <assistant1>\n" +
|
|
|
" <id extension=\""+obj.optString("EHR_000404")+"\"/>\n" +
|
|
|
" <name>"+obj.optString("EHR_000405")+"</name>\n" +
|
|
|
" </assistant1>\n" +
|
|
|
" <assistant2>\n" +
|
|
|
" <id extension=\""+obj.optString("EHR_000406")+"\"/>\n" +
|
|
|
" <name>"+obj.optString("EHR_000407")+"</name>\n" +
|
|
|
" </assistant2>\n" +
|
|
|
" <anesthesiologist>\n" +
|
|
|
" <id extension=\""+obj.optString("EHR_000412")+"\"/>\n" +
|
|
|
" <name>"+obj.optString("EHR_000413")+"</name>\n" +
|
|
|
" </anesthesiologist>\n" +
|
|
|
" <component>\n" +
|
|
|
" <section>\n" +
|
|
|
" <!--档案子类别,用于类别的扩展,code子类别编码;displayName名称。当前为固定值-->\n" +
|
|
|
" <code code=\"common\" codeSystem=\"\" displayName=\"门诊手术记录\"/>\n" +
|
|
|
" <entry>\n" +
|
|
|
" <time>"+obj.optString("EHR_000417")+"</time>\n" +
|
|
|
" <preDiagnosis code=\""+obj.optString("EHR_000426")+"\" codeSystem=\"ICD-10\">"+obj.optString("EHR_000426_VALUE")+"</preDiagnosis>\n" +
|
|
|
" <midDiagnosis code=\""+obj.optString("EHR_000427")+"\" codeSystem=\"ICD-10\">"+obj.optString("EHR_000427_VALUE")+"</midDiagnosis>\n" +
|
|
|
" <operation code=\""+obj.optString("EHR_000416")+"\" codeSystem=\"ICD-9-CM\">"+obj.optString("EHR_000418")+"</operation>\n" +
|
|
|
" <part code=\""+obj.optString("EHR_000419")+"\" codeSystem=\"CV5201.23\">"+obj.optString("EHR_000420")+"</part>\n" +
|
|
|
" <anesthesia>"+obj.optString("EHR_000411")+"</anesthesia>\n" +
|
|
|
" <operationCourse>"+obj.optString("EHR_000422")+"</operationCourse>\n" +
|
|
|
" </entry>\n" +
|
|
|
" </section>\n" +
|
|
|
" </component>\n" +
|
|
|
"</ClinicalDocument>";
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
//住院手术记录 (取第一条)
|
|
|
public String get0216(String ssid,String profileId)
|
|
|
{
|
|
|
String re = "";
|
|
|
//事件主要信息
|
|
|
JSONObject info = getEventBaseInfo(profileId);
|
|
|
|
|
|
if(info!=null) {
|
|
|
//获取手术记录
|
|
|
String url = ehrUrl + URLEncoder.encode("{demographic_id}")+"/laboratory?profile_id=" + profileId;
|
|
|
String response = HttpClientUtil.get(url, "UTF-8");
|
|
|
JSONObject json = new JSONObject(response);
|
|
|
if (json.getBoolean("successFlg") && json.getInt("totalCount") > 0) {
|
|
|
JSONArray array = json.getJSONArray("detailModelList");
|
|
|
if (array != null && array.length() > 0) {
|
|
|
JSONObject obj = array.getJSONObject(0);
|
|
|
re = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
|
|
"<ClinicalDocument>\n" +
|
|
|
" <version code=\"2.0.0.0\" date=\"2009-12-01\">根据卫生部标准第一次修订</version>\n" +
|
|
|
" <ehr code=\"0216\" codeSystem=\"STD_EHR\">住院手术记录</ehr>\n" +
|
|
|
" <title>住院手术记录</title>\n" +
|
|
|
" <org code=\""+info.optString("org_code") +"\" codeSystem=\"STD_HEALTH_ORG\">"+info.optString("org_name") +"</org>\n" +
|
|
|
" <id extension=\"" + profileId + "\" eventno=\"" + info.optString("event_no") + "\"></id>\n" +
|
|
|
" <effectiveTime value=\"" + info.optString("create_date") + "\"/>\n" +
|
|
|
" <recordTarget>\n" +
|
|
|
" <patient>\n" +
|
|
|
" <id extension=\""+ssid+"\"></id>\n" +
|
|
|
" <name>"+info.optString("EHR_000004")+"</name>\n" +
|
|
|
" </patient>\n" +
|
|
|
" </recordTarget>\n" +
|
|
|
" <author>\n" +
|
|
|
" <time>"+obj.optString("EHR_000408")+"</time>\n" +
|
|
|
" <id extension=\""+obj.optString("EHR_000409")+"\"/>\n" +
|
|
|
" <name>"+obj.optString("EHR_000410")+"</name>\n" +
|
|
|
" </author>\n" +
|
|
|
" <surgeon>\n" +
|
|
|
" <id extension=\""+obj.optString("EHR_000424")+"\"/>\n" +
|
|
|
" <name>"+obj.optString("EHR_000425")+"</name>\n" +
|
|
|
" </surgeon>\n" +
|
|
|
" <assistant1>\n" +
|
|
|
" <id extension=\""+obj.optString("EHR_000404")+"\"/>\n" +
|
|
|
" <name>"+obj.optString("EHR_000405")+"</name>\n" +
|
|
|
" </assistant1>\n" +
|
|
|
" <assistant2>\n" +
|
|
|
" <id extension=\""+obj.optString("EHR_000406")+"\"/>\n" +
|
|
|
" <name>"+obj.optString("EHR_000407")+"</name>\n" +
|
|
|
" </assistant2>\n" +
|
|
|
" <anesthesiologist>\n" +
|
|
|
" <id extension=\""+obj.optString("EHR_000412")+"\"/>\n" +
|
|
|
" <name>"+obj.optString("EHR_000413")+"</name>\n" +
|
|
|
" </anesthesiologist>\n" +
|
|
|
" <component>\n" +
|
|
|
" <section>\n" +
|
|
|
" <!--档案子类别,用于类别的扩展,code子类别编码;displayName名称。当前为固定值-->\n" +
|
|
|
" <code code=\"common\" codeSystem=\"\" displayName=\"住院手术记录\"/>\n" +
|
|
|
" <entry>\n" +
|
|
|
" <time>"+obj.optString("EHR_000417")+"</time>\n" +
|
|
|
" <preDiagnosis code=\""+obj.optString("EHR_000426")+"\" codeSystem=\"ICD-10\">"+obj.optString("EHR_000426_VALUE")+"</preDiagnosis>\n" +
|
|
|
" <midDiagnosis code=\""+obj.optString("EHR_000427")+"\" codeSystem=\"ICD-10\">"+obj.optString("EHR_000427_VALUE")+"</midDiagnosis>\n" +
|
|
|
" <operation code=\""+obj.optString("EHR_000416")+"\" codeSystem=\"ICD-9-CM\">"+obj.optString("EHR_000418")+"</operation>\n" +
|
|
|
" <part code=\""+obj.optString("EHR_000419")+"\" codeSystem=\"CV5201.23\">"+obj.optString("EHR_000420")+"</part>\n" +
|
|
|
" <anesthesia>"+obj.optString("EHR_000411")+"</anesthesia>\n" +
|
|
|
" <operationCourse>"+obj.optString("EHR_000422")+"</operationCourse>\n" +
|
|
|
" </entry>\n" +
|
|
|
" </section>\n" +
|
|
|
" </component>\n" +
|
|
|
"</ClinicalDocument>";
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
//门诊费用明细
|
|
|
public String get0102(String ssid,String profileId)
|
|
@ -839,34 +1386,139 @@ public class EhrService extends BaseService {
|
|
|
JSONObject info = getEventBaseInfo(profileId);
|
|
|
|
|
|
if(info!=null) {
|
|
|
//住院症状
|
|
|
String symptomUrl = ehrUrl + URLEncoder.encode("{demographic_id}")+"/hospitalized/symptom?profile_id=" + profileId;
|
|
|
String symptomResponse = HttpClientUtil.get(symptomUrl, "UTF-8");
|
|
|
JSONObject symptomObj = new JSONObject(symptomResponse);
|
|
|
String symptomString = "";
|
|
|
if (symptomObj.getBoolean("successFlg") && symptomObj.getInt("totalCount") > 0) {
|
|
|
JSONArray array = symptomObj.getJSONArray("detailModelList");
|
|
|
String costString = "";
|
|
|
//门诊费用汇总
|
|
|
String url = ehrUrl + URLEncoder.encode("{demographic_id}")+"/outpatient/cost/master?profile_id=" + profileId;
|
|
|
String response = HttpClientUtil.get(url, "UTF-8");
|
|
|
JSONObject json = new JSONObject(response);
|
|
|
if (json.getBoolean("successFlg") && json.getInt("totalCount") > 0) {
|
|
|
JSONArray array = json.getJSONArray("detailModelList");
|
|
|
if (array != null && array.length() > 0) {
|
|
|
for (int i = 0; i < array.length(); i++) {
|
|
|
for(int i=0;i<array.length();i++)
|
|
|
{
|
|
|
JSONObject item = array.getJSONObject(i);
|
|
|
symptomString += "<item code=\"" + item.optString("EHR_000301") + "\" codeSystem=\"CV5101.27\">" + item.optString("EHR_000302") + "</item>\n";
|
|
|
String type = item.optString("EHR_000044");
|
|
|
costString += "<group>\n" +
|
|
|
" <type code=\""+item.optString("EHR_000044")+"\" codeSystem=\"CV5600.01\">"+item.optString("EHR_000044_VALUE")+"</type>\n" +
|
|
|
" <payway code=\"【门诊费用支付方式代码(字典STD_OUTPATIENT_PAY_WAY)】\" codeSystem=\"CV5600.02\">【门诊费用支付方式】</payway>\n" +
|
|
|
" <fee>"+item.optString("EHR_000045")+"</fee>\n";
|
|
|
|
|
|
//获取门诊费用详细
|
|
|
String urlDetail = ehrUrl + URLEncoder.encode("{demographic_id}")+"/outpatient/cost/detail?profile_id=" + profileId;
|
|
|
String responseDetail = HttpClientUtil.get(urlDetail, "UTF-8");
|
|
|
JSONObject jsonDetail = new JSONObject(responseDetail);
|
|
|
if (jsonDetail.getBoolean("successFlg") && jsonDetail.getInt("totalCount") > 0) {
|
|
|
JSONArray arrayDetail = jsonDetail.getJSONArray("detailModelList");
|
|
|
if (arrayDetail != null && arrayDetail.length() > 0) {
|
|
|
for(int j=0;j<arrayDetail.length();j++)
|
|
|
{
|
|
|
JSONObject itemDetail = arrayDetail.getJSONObject(i);
|
|
|
if(itemDetail.optString("EHR_000050").equals(type)) {
|
|
|
costString += "<item>\n" +
|
|
|
" <time>" + itemDetail.optString("EHR_000054") + "</time>\n" +
|
|
|
" <value code=\"【市标准扣费代码(以医保为蓝本的厦门编码)】\" >【标准项目名称】</value>\n" +
|
|
|
" <custome code=\"" + itemDetail.optString("EHR_000056") + "\">" + itemDetail.optString("EHR_000057") + "</custome>\n" +
|
|
|
" <quantity>" + itemDetail.optString("EHR_000055") + "</quantity>\n" +
|
|
|
" <unit>" + itemDetail.optString("EHR_000048") + "</unit>\n" +
|
|
|
" <price>" + itemDetail.optString("EHR_000047") + "</price>\n" +
|
|
|
" <total>" + itemDetail.optString("EHR_000049") + "</total>\n" +
|
|
|
" <notes>" + itemDetail.optString("EHR_000046") + "</notes>\n" +
|
|
|
"</item>\n";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
costString += " </group>\n";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//住院诊断
|
|
|
String diagnosisUrl = ehrUrl + URLEncoder.encode("{demographic_id}")+"/hospitalized/diagnosis?profile_id=" + profileId;
|
|
|
String diagnosisResponse = HttpClientUtil.get(diagnosisUrl, "UTF-8");
|
|
|
JSONObject diagnosisObj = new JSONObject(diagnosisResponse);
|
|
|
String diagnosisString = "";
|
|
|
if (diagnosisObj.getBoolean("successFlg") && diagnosisObj.getInt("totalCount") > 0) {
|
|
|
JSONArray array = diagnosisObj.getJSONArray("detailModelList");
|
|
|
|
|
|
|
|
|
String re = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
|
|
"<ClinicalDocument>\n" +
|
|
|
" <version code=\"2.0.0.1\" date=\"2011-06-01\">根据卫生部标准第2次修订</version>\n" +
|
|
|
" <ehr code=\"0102\" codeSystem=\"STD_EHR\"></ehr>\n" +
|
|
|
" <title>门诊费用明细</title>\n" +
|
|
|
" <org code=\""+info.optString("org_code") +"\" codeSystem=\"STD_HEALTH_ORG\">"+info.optString("org_name") +"</org>\n" +
|
|
|
" <id extension=\"" + profileId + "\" eventno=\"" + info.optString("event_no") + "\"></id>\n" +
|
|
|
" <effectiveTime value=\"" + info.optString("create_date") + "\"/>\n" +
|
|
|
" <recordTarget>\n" +
|
|
|
" <patient>\n" +
|
|
|
" <id extension=\""+ssid+"\"></id>\n" +
|
|
|
" <name>"+info.optString("EHR_000004")+"</name>\n" +
|
|
|
" </patient>\n" +
|
|
|
" </recordTarget>\n" +
|
|
|
" <component>\n" +
|
|
|
" <section>\n" +
|
|
|
" <code code=\"common\" codeSystem=\"\" displayName=\"门诊费用明细\"/>\n" +
|
|
|
" <entry>\n" +
|
|
|
costString +
|
|
|
" </entry>\n" +
|
|
|
" </section>\n" +
|
|
|
" </component>\n" +
|
|
|
"</ClinicalDocument>";;
|
|
|
|
|
|
return re;
|
|
|
|
|
|
}
|
|
|
else{
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//住院费用明细
|
|
|
public String get0202(String ssid,String profileId)
|
|
|
{
|
|
|
//事件主要信息
|
|
|
JSONObject info = getEventBaseInfo(profileId);
|
|
|
|
|
|
if(info!=null) {
|
|
|
String costString = "";
|
|
|
//住院费用汇总
|
|
|
String url = ehrUrl + URLEncoder.encode("{demographic_id}")+"/hospitalized/cost/master?profile_id=" + profileId;
|
|
|
String response = HttpClientUtil.get(url, "UTF-8");
|
|
|
JSONObject json = new JSONObject(response);
|
|
|
if (json.getBoolean("successFlg") && json.getInt("totalCount") > 0) {
|
|
|
JSONArray array = json.getJSONArray("detailModelList");
|
|
|
if (array != null && array.length() > 0) {
|
|
|
for (int i = 0; i < array.length(); i++) {
|
|
|
for(int i=0;i<array.length();i++)
|
|
|
{
|
|
|
JSONObject item = array.getJSONObject(i);
|
|
|
diagnosisString +="<item>\n" +
|
|
|
" <icd code=\""+item.optString("EHR_000293")+"\" codeSystem=\"ICD-10\">"+item.optString("EHR_000295")+"</icd>\n" +
|
|
|
"</item>\n";
|
|
|
String type = item.optString("EHR_000174");
|
|
|
costString += "<group>\n" +
|
|
|
" <type code=\""+item.optString("EHR_000174")+"\" codeSystem=\"CV5600.01\">"+item.optString("EHR_000174_VALUE")+"</type>\n" +
|
|
|
" <payway code=\"【医疗付款方式代码】\" codeSystem=\"CV5600.02\">【医疗付款方式代码】</payway>\n" +
|
|
|
" <fee>"+item.optString("EHR_000175")+"</fee>\n";
|
|
|
|
|
|
//获取住院费用详细
|
|
|
String urlDetail = ehrUrl + URLEncoder.encode("{demographic_id}")+"/hospitalized/cost/detail?profile_id=" + profileId;
|
|
|
String responseDetail = HttpClientUtil.get(urlDetail, "UTF-8");
|
|
|
JSONObject jsonDetail = new JSONObject(responseDetail);
|
|
|
if (jsonDetail.getBoolean("successFlg") && jsonDetail.getInt("totalCount") > 0) {
|
|
|
JSONArray arrayDetail = jsonDetail.getJSONArray("detailModelList");
|
|
|
if (arrayDetail != null && arrayDetail.length() > 0) {
|
|
|
for(int j=0;j<arrayDetail.length();j++)
|
|
|
{
|
|
|
JSONObject itemDetail = arrayDetail.getJSONObject(i);
|
|
|
if(itemDetail.optString("EHR_000187").equals(type)) {
|
|
|
costString += "<item>\n" +
|
|
|
" <time>" + itemDetail.optString("EHR_000054") + "</time>\n" +
|
|
|
" <value code=\"【市标准扣费代码(以医保为蓝本的厦门编码)】\" >【标准项目名称】</value>\n" +
|
|
|
" <custome code=\"" + itemDetail.optString("EHR_000185") + "\">" + itemDetail.optString("EHR_000186") + "</custome>\n" +
|
|
|
" <quantity>" + itemDetail.optString("EHR_000184") + "</quantity>\n" +
|
|
|
" <unit>" + itemDetail.optString("EHR_000178") + "</unit>\n" +
|
|
|
" <price>" + itemDetail.optString("EHR_000177") + "</price>\n" +
|
|
|
" <total>" + itemDetail.optString("EHR_000179") + "</total>\n" +
|
|
|
" <notes>" + itemDetail.optString("EHR_000176") + "</notes>\n" +
|
|
|
"</item>\n";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
costString += " </group>\n";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -874,8 +1526,8 @@ public class EhrService extends BaseService {
|
|
|
String re = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
|
|
"<ClinicalDocument>\n" +
|
|
|
" <version code=\"2.0.0.1\" date=\"2011-06-01\">根据卫生部标准第2次修订</version>\n" +
|
|
|
" <ehr code=\"0201\" codeSystem=\"STD_EHR\">住院诊疗基本信息</ehr>\n" +
|
|
|
" <title>住院诊疗基本信息</title>\n" +
|
|
|
" <ehr code=\"0202\" codeSystem=\"STD_EHR\">住院费用明细</ehr>\n" +
|
|
|
" <title>住院费用明细</title>\n" +
|
|
|
" <org code=\""+info.optString("org_code") +"\" codeSystem=\"STD_HEALTH_ORG\">"+info.optString("org_name") +"</org>\n" +
|
|
|
" <id extension=\"" + profileId + "\" eventno=\"" + info.optString("event_no") + "\"></id>\n" +
|
|
|
" <effectiveTime value=\"" + info.optString("create_date") + "\"/>\n" +
|
|
@ -883,61 +1535,13 @@ public class EhrService extends BaseService {
|
|
|
" <patient>\n" +
|
|
|
" <id extension=\""+ssid+"\"></id>\n" +
|
|
|
" <name>"+info.optString("EHR_000004")+"</name>\n" +
|
|
|
" <sex code=\"" + info.optString("EHR_000019") + "\" codeSystem=\"GB/T2261.1-2003\">" + info.optString("EHR_000019_VALUE") + "</sex>\n" +
|
|
|
" <birthDate>" + info.optString("EHR_000007") + "</birthDate>\n" +
|
|
|
" <marriage code=\"" + info.optString("EHR_000014") + "\" codeSystem=\"GB/T 2261.2-2003\">" + info.optString("EHR_000014_VALUE") + "</marriage>\n" +
|
|
|
" </patient>\n" +
|
|
|
" </recordTarget>\n" +
|
|
|
" <component>\n" +
|
|
|
" <section>\n" +
|
|
|
" <code code=\"common\" codeSystem=\"\" displayName=\"住院诊疗基本信息\"/>\n" +
|
|
|
" <code code=\"common\" codeSystem=\"\" displayName=\"住院费用明细\"/>\n" +
|
|
|
" <entry>\n" +
|
|
|
" <residence>\n" +
|
|
|
" <serial>"+info.optString("EHR_000234") +"</serial>\n" +
|
|
|
" <code>"+info.optString("EHR_000236")+"</code>\n" +
|
|
|
" </residence>\n" +
|
|
|
" <sec>\n" +
|
|
|
" <type code=\"【保险类别(字典STD_SEC_TYPE)】\" codeSystem=\"STD_SEC_TYPE\">【保险类别名称】</type>\n" +
|
|
|
" <value>"+info.optString("EHR_000232")+"</value>\n" +
|
|
|
" </sec>\n" +
|
|
|
" <in>\n" +
|
|
|
" <time>"+info.optString("EHR_000230")+"</time>\n" +
|
|
|
" <dept code=\""+info.optString("EHR_000228")+"\" codeSystem=\"GB/T 17538-1998\">"+info.optString("EHR_000229")+"</dept>\n" +
|
|
|
" <bed>"+info.optString("EHR_000227")+"</bed>\n" +
|
|
|
" </in>\n" +
|
|
|
" <move>\n" +
|
|
|
//EHR转诊业务有问题
|
|
|
/*" <item>\n" +
|
|
|
" <time>转科时间</time>\n" +
|
|
|
" <dept code=\"转科科室代码(字典STD_DEPT)\" codeSystem=\"GB/T 17538-1998\">转科后科室名称</dept>\n" +
|
|
|
" <bed>转科后床号</bed>\n" +
|
|
|
" </item>\n" +*/
|
|
|
" </move>\n" +
|
|
|
" <out>\n" +
|
|
|
" <time>"+info.optString("EHR_000224")+"</time>\n" +
|
|
|
" <dept code=\""+info.optString("EHR_000222")+"\" codeSystem=\"GB/T 17538-1998\">"+info.optString("EHR_000223")+"</dept>\n" +
|
|
|
" <bed>"+info.optString("EHR_000221")+"</bed>\n" +
|
|
|
" </out>\n" +
|
|
|
" <onsetTime>"+info.optString("EHR_000230")+"</onsetTime>\n" +
|
|
|
" <diagnosisDate>"+info.optString("EHR_000230")+"</diagnosisDate>\n" +
|
|
|
" <cause code=\""+info.optString("EHR_000237")+"\" codeSystem=\"CV5401.04\">"+info.optString("EHR_000237_VALUE")+"</cause>\n" +
|
|
|
" <symptom>\n" +
|
|
|
symptomString +
|
|
|
" </symptom>\n" +
|
|
|
" <illStatus code=\""+info.optString("EHR_000239")+"\" codeSystem=\"CV5502.18\">"+info.optString("EHR_000239_VALUE")+"</illStatus>\n" +
|
|
|
" <infectiousStatus code=\""+info.optString("EHR_000238")+"\" codeSystem=\"STD_JUDGE\">"+info.optString("EHR_000238_VALUE")+"</infectiousStatus>\n" +
|
|
|
" <inDiagnosis>\n" +
|
|
|
diagnosisString+
|
|
|
" </inDiagnosis>\n" +
|
|
|
" <outDiagnosis>\n" +
|
|
|
" <item>\n" +
|
|
|
" <icd code=\""+info.optString("EHR_000158")+"\" codeSystem=\"ICD-10\">"+info.optString("EHR_000159")+"</icd>\n" +
|
|
|
" <result code=\""+info.optString("EHR_000166")+"\" codeSystem=\"CV5501.11\">"+info.optString("EHR_000166_VALUE")+"</result>\n" +
|
|
|
" <prop code=\"【诊断性质代码(字典STD_DIAGNOSIS_PROP)】\" codeSystem=\"STD_DIAGNOSIS_PROP\">【诊断性质名称】</prop>\n" +
|
|
|
" </item>\n" +
|
|
|
" </outDiagnosis>\n" +
|
|
|
" <deathTime>"+info.optString("EHR_000255")+"</deathTime>\n" +
|
|
|
" <causeOfDeath code=\""+info.optString("EHR_000258")+"\" codeSystem=\"ICD-10\">"+info.optString("EHR_000258_VALUE")+"</causeOfDeath>\n" +
|
|
|
costString +
|
|
|
" </entry>\n" +
|
|
|
" </section>\n" +
|
|
|
" </component>\n" +
|
|
@ -950,4 +1554,129 @@ public class EhrService extends BaseService {
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
/************************************ 未完成 ******************************************************************/
|
|
|
|
|
|
//获取药品
|
|
|
public String getDrug(String ssid,String profileId,String catalog)
|
|
|
{
|
|
|
String re = "";
|
|
|
//事件主要信息
|
|
|
JSONObject info = getEventBaseInfo(profileId);
|
|
|
String catalogName = "";
|
|
|
if(catalog.equals("0141"))
|
|
|
{
|
|
|
catalogName = "门诊用药记录";
|
|
|
}
|
|
|
else if(catalog.equals("0241"))
|
|
|
{
|
|
|
catalogName = "住院用药记录";
|
|
|
}
|
|
|
|
|
|
if(info!=null) {
|
|
|
String medicineString = "";
|
|
|
//处方主表
|
|
|
String url = ehrUrl + URLEncoder.encode("{demographic_id}")+"/profile/medication/master?profile_id=" + profileId;
|
|
|
String response = HttpClientUtil.get(url, "UTF-8");
|
|
|
JSONObject json = new JSONObject(response);
|
|
|
if (json.getBoolean("successFlg") && json.getInt("totalCount") > 0) {
|
|
|
JSONArray array = json.getJSONArray("detailModelList");
|
|
|
if (array != null && array.length() > 0) {
|
|
|
for (int i = 0; i < array.length(); i++) {
|
|
|
JSONObject item = array.getJSONObject(i);
|
|
|
String prescriptionNo = item.optString("EHR_000086");
|
|
|
String type = item.optString("EHR_001203");
|
|
|
medicineString += "<group>\n" +
|
|
|
" <method code=\"【用药途径代码(字典STD_MEDICINE_ROUTE)】\" codeSystem=\"CV5201.22\">【用药使用方法和途径名称】</method>\n" +
|
|
|
" <freq>【用药频率】</freq>\n" +
|
|
|
" <startDate>【用药开始日期时间】</startDate>\n" +
|
|
|
" <endDate>【用药停止日期时间】</endDate>\n" +
|
|
|
" <days>【用药天数】</days>\n";
|
|
|
|
|
|
|
|
|
//处方细表
|
|
|
String urlDetail = ehrUrl + "profile/medication/detail/"+prescriptionNo+"?prescription_no=" + prescriptionNo+"&type="+type;
|
|
|
String responseDetail = HttpClientUtil.get(urlDetail, "UTF-8");
|
|
|
JSONObject jsonDetail = new JSONObject(responseDetail);
|
|
|
if (jsonDetail.getBoolean("successFlg") && jsonDetail.getInt("totalCount") > 0) {
|
|
|
JSONArray arrayDetail = jsonDetail.getJSONArray("detailModelList");
|
|
|
if (arrayDetail != null && arrayDetail.length() > 0) {
|
|
|
for (int j = 0; j < arrayDetail.length(); j++) {
|
|
|
JSONObject itemDetail = arrayDetail.getJSONObject(j);
|
|
|
|
|
|
//中药
|
|
|
if(type.equals("1"))
|
|
|
{
|
|
|
medicineString += "<medicine>\n" +
|
|
|
" <offerTime>【发药日期时间】</offerTime>\n" +
|
|
|
" <value code=\"【市药品标准编码(以医保为蓝本的厦门编码)】\" >【市药品标准名称】</value>\n" +
|
|
|
" <DiaCode>【诊疗代码】</DiaCode>\n" +
|
|
|
" <custome code=\"【院内药品编码】\">"+itemDetail.optString("EHR_000131")+"</custome>\n" +
|
|
|
" <cnType code=\"【中药类别代码(字典STD_CN_MEDICINE)】\" codeSystem=\"CV5301.05\">【中药类别名称】</cnType>\n" +
|
|
|
" <type code=\"【药物类型代码(字典STD_MEDICINE_TYPE)】\" codeSystem=\"CV5301.06\">【药物类型名称】</type>\n" +
|
|
|
" <form code=\""+itemDetail.optString("EHR_000130")+"\" codeSystem=\"CV5301.01\">"+itemDetail.optString("EHR_000130_VALUE")+"</form>\n" +
|
|
|
" <spec>"+itemDetail.optString("EHR_000129")+"</spec>\n" +
|
|
|
" <doseQuantity>"+itemDetail.optString("EHR_000132")+"</doseQuantity>\n" +
|
|
|
" <doseUnit>"+itemDetail.optString("EHR_000133")+"</doseUnit>\n" +
|
|
|
" <totalQuantity>"+itemDetail.optString("EHR_000135")+"</totalQuantity>\n" +
|
|
|
" <totalUnit>"+itemDetail.optString("EHR_000133")+"</totalUnit>\n" +
|
|
|
" <notes>"+itemDetail.optString("EHR_000141")+"</notes>\n" +
|
|
|
"</medicine>\n";
|
|
|
}
|
|
|
//西药
|
|
|
{
|
|
|
medicineString += "<medicine>\n" +
|
|
|
" <offerTime>【发药日期时间】</offerTime>\n" +
|
|
|
" <value code=\"【市药品标准编码(以医保为蓝本的厦门编码)】\" >【市药品标准名称】</value>\n" +
|
|
|
" <DiaCode>【诊疗代码】</DiaCode>\n" +
|
|
|
" <custome code=\"【院内药品编码】\">"+itemDetail.optString("EHR_000100")+"</custome>\n" +
|
|
|
" <cnType code=\"【中药类别代码(字典STD_CN_MEDICINE)】\" codeSystem=\"CV5301.05\">【中药类别名称】</cnType>\n" +
|
|
|
" <type code=\"【药物类型代码(字典STD_MEDICINE_TYPE)】\" codeSystem=\"CV5301.06\">【药物类型名称】</type>\n" +
|
|
|
" <form code=\""+itemDetail.optString("EHR_000099")+"\" codeSystem=\"CV5301.01\">"+itemDetail.optString("EHR_000099_VALUE")+"</form>\n" +
|
|
|
" <spec>"+itemDetail.optString("EHR_000098")+"</spec>\n" +
|
|
|
" <doseQuantity>"+itemDetail.optString("EHR_000101")+"</doseQuantity>\n" +
|
|
|
" <doseUnit>"+itemDetail.optString("EHR_000102")+"</doseUnit>\n" +
|
|
|
" <totalQuantity>"+itemDetail.optString("EHR_000104")+"</totalQuantity>\n" +
|
|
|
" <totalUnit>"+itemDetail.optString("EHR_000102")+"</totalUnit>\n" +
|
|
|
" <notes>【备注】</notes>\n" +
|
|
|
"</medicine>\n";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
medicineString += "</group>\n";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
re = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
|
|
"<ClinicalDocument>\n" +
|
|
|
" <version code=\"2.0.0.1\" date=\"2011-06-01\">根据卫生部标准第2次修订</version>\n" +
|
|
|
" <ehr code=\""+catalog+"\" codeSystem=\"STD_EHR\">"+catalogName+"</ehr>\n" +
|
|
|
" <title>"+catalogName+"</title>\n" +
|
|
|
" <org code=\""+info.optString("org_code") +"\" codeSystem=\"STD_HEALTH_ORG\">"+info.optString("org_name") +"</org>\n" +
|
|
|
" <id extension=\"" + profileId + "\" eventno=\"" + info.optString("event_no") + "\"></id>\n" +
|
|
|
" <effectiveTime value=\"" + info.optString("create_date") + "\"/>\n" +
|
|
|
" <recordTarget>\n" +
|
|
|
" <patient>\n" +
|
|
|
" <id extension=\""+ssid+"\"></id>\n" +
|
|
|
" <name>"+info.optString("EHR_000004")+"</name>\n" +
|
|
|
" </patient>\n" +
|
|
|
" </recordTarget>\n" +
|
|
|
" <component>\n" +
|
|
|
" <section>\n" +
|
|
|
" <code code=\"common\" codeSystem=\"\" displayName=\""+catalogName+"\"/>\n" +
|
|
|
" <entry>\n" +
|
|
|
medicineString +
|
|
|
" </entry>\n" +
|
|
|
" </section>\n" +
|
|
|
" </component>\n" +
|
|
|
"</ClinicalDocument>";
|
|
|
}
|
|
|
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|