|
@ -2215,7 +2215,7 @@ public class YkyyEntranceService {
|
|
|
}
|
|
|
}
|
|
|
//查询组套项目
|
|
|
public JSONObject findYzztByGslb(String gslb) throws Exception {
|
|
|
public JSONArray findYzztByGslb(String gslb) throws Exception {
|
|
|
String sql = "select t.ztmc as\"ztmc\",t.ztid as\"ztid\"," +
|
|
|
"t.gslb as\"gslb\",t.gsdm as\"gsdm\"," +
|
|
|
"t.pydm as\"pydm\",t.Mzsy as\"Mzsy\"" +
|
|
@ -2223,6 +2223,7 @@ public class YkyyEntranceService {
|
|
|
if(StringUtils.isNotEmpty(gslb)){
|
|
|
sql+=" and t.gslb = "+Integer.valueOf(gslb);
|
|
|
}
|
|
|
System.out.println(sql);
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("findYzztByGslb:"+sql);
|
|
@ -2231,21 +2232,22 @@ public class YkyyEntranceService {
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status!=null&&status == 200){
|
|
|
return rs;
|
|
|
}else {
|
|
|
return null;
|
|
|
JSONArray array= new JSONArray();
|
|
|
if (status==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return array;
|
|
|
|
|
|
}
|
|
|
//根据组套项目id查询组套明细
|
|
|
public JSONObject findZtmxByid(String ztId) throws Exception{
|
|
|
public JSONArray findZtmxByid(String ztId) throws Exception{
|
|
|
String sql = "select t.ztid as \"ztid\",t.xmdm as \"xmdm\"," +
|
|
|
"t.xmmc as \"xmmc\",t.mrsl as \"mrsl\",t.zxks as \"zxks\"" +
|
|
|
"from portal_his.emr_ztmx@ykzxtest t where 1=1";
|
|
|
if (StringUtils.isNotEmpty(ztId)){
|
|
|
sql += " and t.ztid = '"+ztId+"'";
|
|
|
}
|
|
|
System.out.println(sql);
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("findZtmxByid:"+sql);
|
|
@ -2254,21 +2256,22 @@ public class YkyyEntranceService {
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status!=null&&status == 200){
|
|
|
return rs;
|
|
|
}else {
|
|
|
return null;
|
|
|
JSONArray array= new JSONArray();
|
|
|
if (status==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return array;
|
|
|
|
|
|
}
|
|
|
//查询诊疗项目视图
|
|
|
public JSONObject findZlxm(String itemName) throws Exception{
|
|
|
public JSONArray findZlxm(String itemName) throws Exception{
|
|
|
String sql = "select t.item_code as \"itemCode\",t.item_name as \"itemName\"," +
|
|
|
"t.price as \"price\",t.total_unit as \"totalUnit\"," +
|
|
|
"t. from VEMR_ORDER_ITEM t where 1=1";
|
|
|
"t.zxks as \"zxks\" from VEMR_ORDER_ITEM t where 1=1";
|
|
|
if (StringUtils.isNotEmpty(itemName)){
|
|
|
sql+=" and t.ITEM_NAME like '%"+itemName+"%'";
|
|
|
}
|
|
|
System.out.println(sql);
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("findZlxm:"+sql);
|
|
@ -2277,19 +2280,20 @@ public class YkyyEntranceService {
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status!=null&&status == 200){
|
|
|
return rs;
|
|
|
}else {
|
|
|
return null;
|
|
|
JSONArray array= new JSONArray();
|
|
|
if (status==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
//查询诊疗项目明细视图
|
|
|
public JSONObject findZlxmMx(String zlxmId) throws Exception{
|
|
|
public JSONArray findZlxmMx(String zlxmId) throws Exception{
|
|
|
String sql = "select t.zlxmid as \"zlxmid\",t.fyxh as \"fyxh\",t.fysl \"fysl\"" +
|
|
|
" from VEMR_ORDER_ITEM_MX t where 1=1";
|
|
|
if (StringUtils.isNotEmpty(zlxmId)){
|
|
|
sql+=" and t.item_name like '%"+zlxmId+"%'";
|
|
|
sql+=" and t.zlxmid = '"+zlxmId+"'";
|
|
|
}
|
|
|
System.out.println(sql);
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
logger.info("findZlxmMx:"+sql);
|
|
@ -2298,14 +2302,14 @@ public class YkyyEntranceService {
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status!=null&&status == 200){
|
|
|
return rs;
|
|
|
}else {
|
|
|
return null;
|
|
|
JSONArray array= new JSONArray();
|
|
|
if (status==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
//his.gy_ylsf明细查询
|
|
|
public JSONObject findGyYlsf(String fyxh) throws Exception{
|
|
|
public JSONArray findGyYlsf(String fyxh) throws Exception{
|
|
|
String sql = "select t.xmlx as \"xmlx\",t.fydj as \"fydj\",t.fygb as \"fygb\"" +
|
|
|
"from portal_his.GY_YLSF@ykzxtest t where 1=1";
|
|
|
if (StringUtils.isNotEmpty(fyxh)){
|
|
@ -2319,21 +2323,72 @@ public class YkyyEntranceService {
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status!=null&&status == 200){
|
|
|
return rs;
|
|
|
}else {
|
|
|
return null;
|
|
|
JSONArray array= new JSONArray();
|
|
|
if (status==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
//门诊开单操作
|
|
|
public String outPatientOrder(String jsonDate) throws Exception{
|
|
|
public String outPatientOrder(String jsonDate,Boolean demoFlag,String doctor,String patient) throws Exception{
|
|
|
List<YkEmrJcsqDO> surveys = EntityUtils.jsonToList(jsonDate, YkEmrJcsqDO.class);
|
|
|
DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
|
|
|
PatientMappingDO patientMappingDO =new PatientMappingDO();
|
|
|
if (StringUtils.isNotEmpty(doctor)){
|
|
|
doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
|
|
|
}
|
|
|
if(StringUtils.isNotEmpty(patient)){
|
|
|
patientMappingDO = patientMappingDao.findByPatient(patient);
|
|
|
|
|
|
}
|
|
|
BasePatientDO patientDO = basePatientDao.findById(patient);
|
|
|
PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
|
|
|
Integer brxb = 0;
|
|
|
String brxm = "";
|
|
|
Date csny =null;
|
|
|
Integer brnl =0;
|
|
|
String doctorHis="";
|
|
|
JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
|
|
|
if(jsonArray!=null&&jsonArray.size()>0){
|
|
|
//获取居民信息
|
|
|
JSONObject json = jsonArray.getJSONObject(0);
|
|
|
brxb = json.getInteger("brxb");
|
|
|
brxm = json.getString("brxm");
|
|
|
csny = json.getDate("csny");
|
|
|
brnl = this.getBrnl(csny);
|
|
|
}
|
|
|
//操作医生信息
|
|
|
JSONArray jsonArray1 = findHisDoctor(doctorMappingDO.getIdcard());
|
|
|
if(jsonArray1!=null&&jsonArray1.size()>0){
|
|
|
JSONObject json = jsonArray1.getJSONObject(0);
|
|
|
doctorHis=json.getString("code");
|
|
|
|
|
|
}
|
|
|
|
|
|
// 同一个医生同一个病人,一天一条挂号记录。
|
|
|
JSONArray ja = fingHlwGhmx(patientMappingDO.getMappingCode(),doctorMappingDO.getMappingCode());
|
|
|
|
|
|
if (surveys!=null){
|
|
|
for (YkEmrJcsqDO ykEmrJcsqDO:surveys){
|
|
|
ykEmrJcsqDO.setJjbc(0);
|
|
|
ykEmrJcsqDO.setJczt(1);
|
|
|
ykEmrJcsqDO.setZfpb(0);
|
|
|
ykEmrJcsqDO.setQxbz(0);
|
|
|
if (demoFlag){
|
|
|
ykEmrJcsqDO.setJjbz(0);
|
|
|
ykEmrJcsqDO.setJczt(1);
|
|
|
ykEmrJcsqDO.setZfbz(0);
|
|
|
ykEmrJcsqDO.setQxbz(0);
|
|
|
ykEmrJcsqDO.setBrxb(brxb);
|
|
|
ykEmrJcsqDO.setBrxm(brxm);
|
|
|
ykEmrJcsqDO.setBrnl(brnl);
|
|
|
ykEmrJcsqDO.setKdys(doctorHis);
|
|
|
}else {
|
|
|
ykEmrJcsqDO.setJjbz(0);
|
|
|
ykEmrJcsqDO.setJczt(1);
|
|
|
ykEmrJcsqDO.setZfbz(0);
|
|
|
ykEmrJcsqDO.setQxbz(0);
|
|
|
ykEmrJcsqDO.setBrxb(1);
|
|
|
ykEmrJcsqDO.setBrxm("测试病人");
|
|
|
ykEmrJcsqDO.setBrnl(18);
|
|
|
ykEmrJcsqDO.setKdys("测试医生");
|
|
|
}
|
|
|
}
|
|
|
String jsonString = JSONObject.toJSONString(surveys);
|
|
|
Map<String,Object> params = new HashedMap();
|
|
@ -2356,7 +2411,53 @@ public class YkyyEntranceService {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
/*//查询检查单
|
|
|
public JSONObject findOrderBy*/
|
|
|
//查询检查单
|
|
|
public JSONArray findOrder()throws Exception{
|
|
|
String sql = "select t.sqdh,t.brid," +
|
|
|
"t.jzlx,t.brxm,t.brks," +
|
|
|
"t.brnl,t.kdsj,t.zxks,t.jcxm,t.xmdj," +
|
|
|
"t.xmdw,t.xmid,t.sqsl from emr_jcsq@ykzxtest t where 1=1";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("sql",sql);
|
|
|
params.put("table","ykEmrJcsqDO");
|
|
|
logger.info("ykEmrJcsqDO:"+sql);
|
|
|
HttpResponse response = HttpUtils.doGet(jdbcUrl,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
JSONArray array= new JSONArray();
|
|
|
if (status==200){
|
|
|
array = rs.getJSONArray("detailModelList");
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
public Integer getBrnl(Date date){
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
if (cal.before(date)) {
|
|
|
throw new IllegalArgumentException(
|
|
|
"The birthDay is before Now.It's unbelievable!");
|
|
|
}
|
|
|
int yearNow = cal.get(Calendar.YEAR);
|
|
|
int monthNow = cal.get(Calendar.MONTH) + 1;
|
|
|
int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH);
|
|
|
cal.setTime(date);
|
|
|
int yearBirth = cal.get(Calendar.YEAR);
|
|
|
int monthBirth = cal.get(Calendar.MONTH) + 1;
|
|
|
int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
|
|
|
int age = yearNow - yearBirth;
|
|
|
if (monthNow <= monthBirth) {
|
|
|
if (monthNow == monthBirth) {
|
|
|
// monthNow==monthBirth
|
|
|
if (dayOfMonthNow < dayOfMonthBirth) {
|
|
|
age--;
|
|
|
}
|
|
|
} else {
|
|
|
// monthNow>monthBirth
|
|
|
age--;
|
|
|
}
|
|
|
}
|
|
|
return age;
|
|
|
}
|
|
|
|
|
|
}
|