|
@ -8,6 +8,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
|
|
|
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
|
|
|
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalIcdDO;
|
|
|
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO;
|
|
|
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
|
|
@ -17,6 +18,8 @@ import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
|
|
|
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
|
|
|
import com.yihu.jw.entity.hospital.prescription.*;
|
|
|
import com.yihu.jw.entity.order.BusinessOrderDO;
|
|
|
import com.yihu.jw.hospital.dict.service.WlyyHospitalSysDictService;
|
|
|
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
|
|
|
import com.yihu.jw.hospital.healthCare.YlzMedicailIcdDao;
|
|
|
import com.yihu.jw.hospital.healthCare.YlzMedicailMxDao;
|
|
|
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
|
|
@ -46,6 +49,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
@ -61,6 +65,10 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
@Autowired
|
|
|
private BasePatientDao patientDao;
|
|
|
@Autowired
|
|
|
private BasePatientMedicareCardDao basePatientMedicareCardDao;
|
|
|
@Autowired
|
|
|
private WlyyPatientFamilyMemberDao familyMemberDao;
|
|
|
@Autowired
|
|
|
private BasePatientMedicareCardDao patientMedicareCardDao;
|
|
|
@Autowired
|
|
|
private PatientMappingDao patientMappingDao;
|
|
@ -100,6 +108,8 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
private PrescriptionLogDao prescriptionLogDao;
|
|
|
@Autowired
|
|
|
private YlzMedicailRelationInvoiceDao invoiceDao;
|
|
|
@Value("${spring.profiles}")
|
|
|
private String springProfiles;
|
|
|
//=============查询视图========================
|
|
|
|
|
|
/**
|
|
@ -120,8 +130,44 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
return dsyyEntranceService.selectOutpatientInfo(patient,conNo);
|
|
|
}
|
|
|
|
|
|
public WlyyOutpatientVO selectOutpatientInfoByHisId(String hisPid,String conNo) throws Exception {
|
|
|
if("mlwTest".equals(springProfiles)){
|
|
|
String url = "https://hlw.xmdsyy.cn/hlw/visitBehind/open/exportExcel/selectOutpatientInfoByHisId";
|
|
|
String object = "";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("hisPid",hisPid);
|
|
|
params.put("conNo",conNo);
|
|
|
HttpResponse response = HttpUtils.doGet(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
object = rs.getString("obj");
|
|
|
WlyyOutpatientVO vo = JSONObject.parseObject(object,WlyyOutpatientVO.class);
|
|
|
return vo;
|
|
|
}
|
|
|
}
|
|
|
return dsyyEntranceService.selectOutpatientInfoByHisId(hisPid,conNo);
|
|
|
}
|
|
|
|
|
|
//获取患者卡列表
|
|
|
public JSONArray findCardNo(String idcard) throws Exception{
|
|
|
if("mlwTest".equals(springProfiles)){
|
|
|
String url = "https://hlw.xmdsyy.cn/hlw/visitBehind/open/exportExcel/findCardNo";
|
|
|
String object = "";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("idcard",idcard);
|
|
|
HttpResponse response = HttpUtils.doPost(url,params);
|
|
|
String content = response.getContent();
|
|
|
logger.info("response:"+content);
|
|
|
JSONObject rs = JSON.parseObject(content);
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
object = rs.getString("detailModelList");
|
|
|
return JSONArray.parseArray(object);
|
|
|
}
|
|
|
}
|
|
|
return dsyyEntranceService.findCardNo(idcard);
|
|
|
}
|
|
|
|
|
@ -131,42 +177,29 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
* @param idcard
|
|
|
* @return
|
|
|
*/
|
|
|
public BasePatientDO addPaitentByIdcard(String idcard,String name) {
|
|
|
public BasePatientDO addPaitentByIdcard(JSONArray jsonArray,String idcard,String name) {
|
|
|
try {
|
|
|
JSONArray jsonArray = findCardNo(idcard);
|
|
|
if(jsonArray==null||jsonArray.size()==0){
|
|
|
return null;
|
|
|
}
|
|
|
String cardType = "";
|
|
|
Integer sex = 3;
|
|
|
String ssc = "";
|
|
|
String mobile = null;
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
JSONObject json = jsonArray.getJSONObject(i);
|
|
|
String CARD_TYPE = json.getString("CARD_TYPE");
|
|
|
if("".equals(CARD_TYPE)){
|
|
|
if("D".equals(CARD_TYPE)){
|
|
|
ssc = json.getString("CARD_NO");
|
|
|
}
|
|
|
sex = Integer.parseInt(json.getString("XB"));
|
|
|
String xb = json.getString("XB");//性别
|
|
|
sex = "女".equals(xb)?2:1;
|
|
|
}
|
|
|
// "\tPAT_NO AS \"PAT_NO\",\n" +
|
|
|
// "\tSICK_ID AS \"SICK_ID\",\n" +
|
|
|
// "\tCARD_NO AS \"CARD_NO\",\n" +
|
|
|
// "\tCARD_STAT AS \"CARD_STAT\",\n" +
|
|
|
// "\tOP_DATE AS \"OP_DATE\",\n" +
|
|
|
// "\tCARD_TYPE AS \"CARD_TYPE\",\n" +
|
|
|
// "\tXM AS \"XM\",\n" +
|
|
|
// "\tXB AS \"XB\",\n" +
|
|
|
// "\tLXDH AS \"LXDH\",\n" +
|
|
|
// "\tZJHM AS \"ZJHM\",\n" +
|
|
|
// "\tZHYE AS \"ZHYE\" \n" +
|
|
|
|
|
|
|
|
|
BasePatientDO patient = new BasePatientDO();
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
String pw = idcard.substring(idcard.length()-6);
|
|
|
patient.setIdcard(idcard);
|
|
|
patient.setCardType("01");
|
|
|
patient.setCardType("1");
|
|
|
patient.setName(name);
|
|
|
patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
patient.setSalt(salt);
|
|
@ -177,9 +210,32 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
patient.setCreateTime(new Date());
|
|
|
patient.setUpdateTime(new Date());
|
|
|
patient.setSsc(ssc);
|
|
|
patient.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
|
|
|
try {
|
|
|
patient.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
|
|
|
}catch (Exception e){
|
|
|
|
|
|
}
|
|
|
patient.setSex(sex);
|
|
|
patient = patientDao.save(patient);
|
|
|
|
|
|
PatientMedicareCardDO medicareCardDO = new PatientMedicareCardDO();
|
|
|
medicareCardDO.setDel("1");
|
|
|
medicareCardDO.setParentType("A");
|
|
|
medicareCardDO.setType("A_01");
|
|
|
medicareCardDO.setCode(ssc);
|
|
|
medicareCardDO.setPatientCode(patient.getId());
|
|
|
|
|
|
basePatientMedicareCardDao.save(medicareCardDO);
|
|
|
WlyyPatientFamilyMemberDO wlyyPatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
|
|
|
wlyyPatientFamilyMemberDO.setIsDel(1);
|
|
|
wlyyPatientFamilyMemberDO.setPatient(patient.getId());
|
|
|
wlyyPatientFamilyMemberDO.setFamilyMember(patient.getId());
|
|
|
wlyyPatientFamilyMemberDO.setFamilyRelation("7");
|
|
|
wlyyPatientFamilyMemberDO.setFamilyRelationName("本人");
|
|
|
if (StringUtils.isNoneBlank(idcard)) {
|
|
|
wlyyPatientFamilyMemberDO.setCardNo(idcard);
|
|
|
}
|
|
|
familyMemberDao.save(wlyyPatientFamilyMemberDO);
|
|
|
return patient;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@ -471,6 +527,9 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
return dsyyEntranceService.findDrugs(chargeCode,pydm);
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
private WlyyHospitalSysDictService sysDictService;
|
|
|
|
|
|
/**
|
|
|
* 获取频次字典
|
|
|
*
|
|
@ -478,7 +537,28 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getDrugFrequency() throws Exception {
|
|
|
return dsyyEntranceService.getDrugFrequency();
|
|
|
JSONArray array = dsyyEntranceService.getDrugFrequency();
|
|
|
if(array!=null&&array.size()>0){
|
|
|
Map<String,Integer> frequencyMap = sysDictService.getDictValueSortMap("kf_frequency");
|
|
|
array.sort((o1, o2) -> {
|
|
|
String FREQ_NAME1 = ((JSONObject)o1).getString("FREQ_NAME");
|
|
|
String FREQ_NAME2 = ((JSONObject)o2).getString("FREQ_NAME");
|
|
|
if(frequencyMap.containsKey(FREQ_NAME1)){
|
|
|
((JSONObject)o1).put("sort",frequencyMap.get(FREQ_NAME1));
|
|
|
}else {
|
|
|
((JSONObject)o1).put("sort",999);
|
|
|
}
|
|
|
if(frequencyMap.containsKey(FREQ_NAME2)){
|
|
|
((JSONObject)o2).put("sort",frequencyMap.get(FREQ_NAME2));
|
|
|
}else {
|
|
|
((JSONObject)o2).put("sort",999);
|
|
|
}
|
|
|
int age1 = ((JSONObject)o1).getIntValue("sort");
|
|
|
int age2 = ((JSONObject)o2).getIntValue("sort");
|
|
|
return age1 - age2;
|
|
|
});
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -488,7 +568,28 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getDrugUse(String pydm) throws Exception {
|
|
|
return dsyyEntranceService.getDrugUse(pydm);
|
|
|
JSONArray array = dsyyEntranceService.getDrugUse(pydm);
|
|
|
if(array!=null&&array.size()>0){
|
|
|
Map<String,Integer> frequencyMap = sysDictService.getDictValueSortMap("kf_administration_method");
|
|
|
array.sort((o1, o2) -> {
|
|
|
String supply_name1 = ((JSONObject)o1).getString("supply_name");
|
|
|
String supply_name2 = ((JSONObject)o2).getString("supply_name");
|
|
|
if(frequencyMap.containsKey(supply_name1)){
|
|
|
((JSONObject)o1).put("sort",frequencyMap.get(supply_name1));
|
|
|
}else {
|
|
|
((JSONObject)o1).put("sort",999);
|
|
|
}
|
|
|
if(frequencyMap.containsKey(supply_name2)){
|
|
|
((JSONObject)o2).put("sort",frequencyMap.get(supply_name2));
|
|
|
}else {
|
|
|
((JSONObject)o2).put("sort",999);
|
|
|
}
|
|
|
int age1 = ((JSONObject)o1).getIntValue("sort");
|
|
|
int age2 = ((JSONObject)o2).getIntValue("sort");
|
|
|
return age1 - age2;
|
|
|
});
|
|
|
}
|
|
|
return array;
|
|
|
}
|
|
|
|
|
|
|
|
@ -1510,14 +1611,17 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
|
|
|
/**
|
|
|
* 查询出院小结、门诊病历
|
|
|
* serverCode 门诊病历 :JHIDS-USD-HLWMZBL-014 出院小结:JHIDS-USD-HLWCYXJ-013
|
|
|
* serviceCode 门诊病历 :JHIDS-USD-HLWMZBL-014 出院小结:JHIDS-USD-HLWCYXJ-013
|
|
|
* @return
|
|
|
*/
|
|
|
public String selectReportInfo(String serverCode,String patientId,String visitNo,int page,int size) throws Exception {
|
|
|
public String selectReportInfo(String serviceCode,String patientId,String visitNo,int page,int size) throws Exception {
|
|
|
String url = entranceUrl +"selectReportInfo";
|
|
|
if("mlwTest".equals(springProfiles)){
|
|
|
url = "https://hlw.xmdsyy.cn/hlw/visitBehind/open/exportExcel/selectReportInfo";
|
|
|
}
|
|
|
String object = "";
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
params.put("serverCode",serverCode);
|
|
|
params.put("serviceCode",serviceCode);
|
|
|
params.put("patientId",patientId);
|
|
|
params.put("visitNo",visitNo);
|
|
|
params.put("page",page);
|
|
@ -1529,6 +1633,9 @@ public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
Integer status = rs.getInteger("status");
|
|
|
if (status==200){
|
|
|
object = rs.getString("detailModelList");
|
|
|
if("mlwTest".equals(springProfiles)){
|
|
|
object = rs.getString("obj");
|
|
|
}
|
|
|
}
|
|
|
return object;
|
|
|
}
|