医生站-患者列表
This commit is contained in:
@@ -52,4 +52,10 @@ public interface IDoctorStationEmrAppService {
|
||||
*/
|
||||
R<?> deleteEmrTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 获取病历详情
|
||||
* @param encounterId 就诊id
|
||||
* @return 病历详情
|
||||
*/
|
||||
R<?> getEmrDetail(Long encounterId);
|
||||
}
|
||||
|
||||
@@ -13,8 +13,11 @@ import org.springframework.stereotype.Service;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.common.enums.BindingType;
|
||||
import com.openhis.document.domain.Emr;
|
||||
import com.openhis.document.domain.EmrDetail;
|
||||
import com.openhis.document.domain.EmrDict;
|
||||
@@ -56,7 +59,16 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
Emr emr = new Emr();
|
||||
BeanUtils.copyProperties(patientEmrDto, emr);
|
||||
String contextStr = patientEmrDto.getContextJson().toString();
|
||||
boolean saveSuccess = emrService.save(emr.setContextJson(contextStr));
|
||||
Emr patientEmr = emrService.getOne(new LambdaQueryWrapper<Emr>().eq(Emr::getEncounterId, emr.getEncounterId()));
|
||||
boolean saveSuccess;
|
||||
// 如果已经保存病历,再次保存走更新
|
||||
if (patientEmr != null) {
|
||||
saveSuccess = emrService.update(new LambdaUpdateWrapper<Emr>().eq(Emr::getEncounterId, emr.getEncounterId())
|
||||
.set(Emr::getContextJson, contextStr));
|
||||
} else {
|
||||
saveSuccess =
|
||||
emrService.save(emr.setContextJson(contextStr).setRecordId(SecurityUtils.getLoginUser().getUserId()));
|
||||
}
|
||||
if (!saveSuccess) {
|
||||
return R.fail();
|
||||
}
|
||||
@@ -69,14 +81,18 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
// 遍历病历内容map
|
||||
for (Map.Entry<String, String> entry : emrContextMap.entrySet()) {
|
||||
EmrDetail emrDetail = new EmrDetail();
|
||||
emrDetail.setEmrId(emr.getId());
|
||||
if (!emrDictList.isEmpty() && emrDictList.contains(entry.getKey())) {
|
||||
emrDetail.setEmrId(emr.getId());
|
||||
emrDetail.setEmrKey(entry.getKey());
|
||||
emrDetail.setEmrValue(entry.getValue());
|
||||
}
|
||||
emrDetailList.add(emrDetail);
|
||||
}
|
||||
boolean save = emrDetailService.saveBatch(emrDetailList);
|
||||
boolean save = true;
|
||||
if (!emrDictList.isEmpty()) {
|
||||
save = emrDetailService.saveBatch(emrDetailList);
|
||||
}
|
||||
|
||||
return save ? R.ok() : R.fail();
|
||||
}
|
||||
|
||||
@@ -95,6 +111,18 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
return R.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取病历详情
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 病历详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEmrDetail(Long encounterId) {
|
||||
Emr emrDetail = emrService.getOne(new LambdaQueryWrapper<Emr>().eq(Emr::getEncounterId, encounterId));
|
||||
return R.ok(emrDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存病历模板
|
||||
*
|
||||
@@ -104,7 +132,11 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
@Override
|
||||
public R<?> addEmrTemplate(EmrTemplateDto emrTemplateDto) {
|
||||
EmrTemplate emrTemplate = new EmrTemplate();
|
||||
String contextStr = emrTemplateDto.getContextJson().toString();
|
||||
BeanUtils.copyProperties(emrTemplateDto, emrTemplate);
|
||||
// todo 获取当前登录用户的科室id
|
||||
emrTemplate.setUserId(SecurityUtils.getLoginUser().getUserId());
|
||||
emrTemplate.setContextJson(contextStr);
|
||||
return emrTemplateService.save(emrTemplate) ? R.ok() : R.fail();
|
||||
}
|
||||
|
||||
@@ -119,9 +151,14 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
@Override
|
||||
public R<?> getEmrTemplate(EmrTemplateDto emrTemplateDto, Integer pageNo, Integer pageSize) {
|
||||
LambdaQueryWrapper<EmrTemplate> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(EmrTemplate::getTemplateName, emrTemplateDto.getTemplateName())
|
||||
.eq(EmrTemplate::getUseScopeCode, emrTemplateDto.getUseScopeCode())
|
||||
.eq(EmrTemplate::getUserId, emrTemplateDto.getUserId());
|
||||
queryWrapper
|
||||
.eq(EmrTemplate::getUseScopeCode, emrTemplateDto.getUseScopeCode());
|
||||
if (emrTemplateDto.getTemplateName() != null){
|
||||
queryWrapper.like(EmrTemplate::getTemplateName, emrTemplateDto.getTemplateName());
|
||||
}
|
||||
if (BindingType.PERSONAL.getValue().toString().equals(emrTemplateDto.getUseScopeCode())) {
|
||||
queryWrapper.eq(EmrTemplate::getUserId, SecurityUtils.getLoginUser().getUserId());
|
||||
}
|
||||
Page<EmrTemplate> emrTemplatePage = emrTemplateService.page(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
return R.ok(emrTemplatePage);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,17 @@ public class DoctorStationEmrController {
|
||||
return iDoctorStationEmrAppService.getPatientEmrHistory(patientEmrDto, pageNo, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者病历详情
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 病历详情
|
||||
*/
|
||||
@GetMapping("/emr-detail")
|
||||
public R<?> getEmrDetail(@RequestParam(value = "encounterId") Long encounterId) {
|
||||
return iDoctorStationEmrAppService.getEmrDetail(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存病历模板
|
||||
*
|
||||
@@ -84,7 +95,7 @@ public class DoctorStationEmrController {
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("emr-template")
|
||||
public R<?> deleteEmrTemplate(@RequestParam Long id) {
|
||||
public R<?> deleteEmrTemplate(@RequestParam(value = "id") Long id) {
|
||||
return iDoctorStationEmrAppService.deleteEmrTemplate(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -26,7 +27,7 @@ public class EmrTemplateDto implements Serializable {
|
||||
private String templateName;
|
||||
|
||||
/** 模板类型 */
|
||||
private String templateTypeEnum;
|
||||
private String templateTypeCode;
|
||||
|
||||
/** 使用范围 */
|
||||
@NotBlank
|
||||
@@ -36,6 +37,6 @@ public class EmrTemplateDto implements Serializable {
|
||||
private Long userId;
|
||||
|
||||
/** 病历内容 */
|
||||
private String contextJson;
|
||||
private JSONObject contextJson;
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ public class PatientEmrDto implements Serializable {
|
||||
private String emrStatus;
|
||||
|
||||
/** 记录人 */
|
||||
@NotNull
|
||||
private Long recordId;
|
||||
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getUserPersonalList" resultType="com.openhis.web.doctorstation.dto.ConditionDefinitionMetadata">
|
||||
SELECT T1.ID,
|
||||
SELECT T2.ID,
|
||||
T1.source_enum,
|
||||
T1.condition_code,
|
||||
T1.NAME,
|
||||
@@ -86,7 +86,7 @@
|
||||
T1.yb_no,
|
||||
T1.yb_match_flag
|
||||
FROM cli_condition_definition AS T1
|
||||
JOIN (SELECT definition_id
|
||||
JOIN (SELECT id, definition_id
|
||||
FROM cli_diagnosis_belong_binding
|
||||
WHERE delete_flag = '0'
|
||||
AND binding_enum = #{bindingEnum}
|
||||
@@ -96,7 +96,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getOrganizationList" resultType="com.openhis.web.doctorstation.dto.ConditionDefinitionMetadata">
|
||||
SELECT T1.ID,
|
||||
SELECT T2.ID,
|
||||
T1.source_enum,
|
||||
T1.condition_code,
|
||||
T1.NAME,
|
||||
@@ -104,7 +104,7 @@
|
||||
T1.yb_no,
|
||||
T1.yb_match_flag
|
||||
FROM cli_condition_definition AS T1
|
||||
JOIN (SELECT definition_id
|
||||
JOIN (SELECT id, definition_id
|
||||
FROM cli_diagnosis_belong_binding
|
||||
WHERE delete_flag = '0'
|
||||
AND binding_enum = #{bindingEnum}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.openhis.document.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.core.common.core.domain.HisBaseEntity;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -26,12 +25,15 @@ public class Emr extends HisBaseEntity {
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 患者ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** 就诊ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 病历信息 */
|
||||
@@ -43,5 +45,4 @@ public class Emr extends HisBaseEntity {
|
||||
/** 记录人 */
|
||||
private Long recordId;
|
||||
|
||||
|
||||
}
|
||||
@@ -3,11 +3,14 @@ package com.openhis.document.domain;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.core.common.core.domain.HisBaseEntity;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -26,18 +29,20 @@ public class EmrTemplate extends HisBaseEntity {
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 模板名称 */
|
||||
private String templateName;
|
||||
|
||||
/** 模板类型 */
|
||||
private String templateCode;
|
||||
private String templateTypeCode;
|
||||
|
||||
/** 使用范围 */
|
||||
private String useScopeCode;
|
||||
|
||||
/** 个人/科室ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
/** 病历内容 */
|
||||
|
||||
Reference in New Issue
Block a user