심사 상병 4종을 옮긴다 — 59종 → 63종. 워크플로가 조사한 new 는 이제 상병·수술·심사까지 끝났다
Bkd_상병쿼리(bzDataInterface.vb:14625-14811)의 이식. DiagnosisStore 와 구조가 같고 표만 B_OkdInf(심사분)다. SQL 52줄 원문 기계 추출(블록1 UNION 블록2, 주/부 필터는 각 블록의 RN 접기 앞). 병원 분기는 KIMEYE 하나 — 그 병원만 미이식 안내. 태그 4종(본문 확인): 심사_주상병명/코드는 첫 행, 심사_부상병명/코드는 줄바꿈 결합 (가로형이 없다). ## 게이트 - dotnet test 338/338 · --edit-smoke 실패 0(이름 검사 63종) - --db-patient 전건 통과 (B_OkdInf 도 이 시험 DB 에 없을 수 있어 수술과 같은 취급 — 런타임에서 해석기가 예외를 사유로 바꾼다) - --db-render P062 md5 불변 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
460f6c4a91
commit
ef4f36419f
@@ -109,6 +109,16 @@ public static class PatientIdentity
|
||||
: new DiagnosisStore(connection).Diagnoses(context.ComNum, scope);
|
||||
}
|
||||
|
||||
/// <summary>심사 상병(B_OkdInf) 공급자 — 상병과 같은 정책</summary>
|
||||
public static Func<DiagnosisStore.Scope, IReadOnlyList<Dictionary<string, string>>>
|
||||
ReviewDiagnosisSourceFor(PatientContext context)
|
||||
{
|
||||
var connection = ConfigService.Current.ConnectionString;
|
||||
return scope => connection.Length == 0
|
||||
? new List<Dictionary<string, string>>()
|
||||
: new ReviewDiagnosisStore(connection).Diagnoses(context.ComNum, scope);
|
||||
}
|
||||
|
||||
/// <summary>수술 행 공급자 — 상병과 같은 정책(필요할 때 1회, 실패는 던져 사유로)</summary>
|
||||
public static Func<IReadOnlyList<Dictionary<string, string>>> SurgerySourceFor(PatientContext context)
|
||||
{
|
||||
|
||||
@@ -69,7 +69,8 @@ public static class PatientSession
|
||||
PatientIdentity.DoctorOf(picked), PatientIdentity.DepartmentOf(picked),
|
||||
PatientIdentity.HospitalNameOf(picked),
|
||||
PatientIdentity.DiagnosisSourceFor(picked),
|
||||
PatientIdentity.SurgerySourceFor(picked))
|
||||
PatientIdentity.SurgerySourceFor(picked),
|
||||
PatientIdentity.ReviewDiagnosisSourceFor(picked))
|
||||
: session;
|
||||
return (tags, new MDataTableRunner(document, Variables()));
|
||||
}
|
||||
|
||||
@@ -179,12 +179,18 @@ public sealed class PatientTagResolver : ITagValueResolver
|
||||
|
||||
private IReadOnlyList<Dictionary<string, string>>? surgeryCache;
|
||||
|
||||
/// <summary>심사 상병(B_OkdInf) 공급자 — 상병과 같은 정책</summary>
|
||||
private readonly Func<DiagnosisStore.Scope, IReadOnlyList<Dictionary<string, string>>>? reviewSource;
|
||||
|
||||
private readonly Dictionary<DiagnosisStore.Scope, IReadOnlyList<Dictionary<string, string>>> reviewCache = new();
|
||||
|
||||
public PatientTagResolver(PatientContext context, ITagValueResolver next,
|
||||
string residentNumber = "", IReadOnlyDictionary<string, string>? address = null,
|
||||
IReadOnlyDictionary<string, string>? doctor = null,
|
||||
IReadOnlyDictionary<string, string>? department = null, string hospitalName = "",
|
||||
Func<DiagnosisStore.Scope, IReadOnlyList<Dictionary<string, string>>>? diagnosisSource = null,
|
||||
Func<IReadOnlyList<Dictionary<string, string>>>? surgerySource = null)
|
||||
Func<IReadOnlyList<Dictionary<string, string>>>? surgerySource = null,
|
||||
Func<DiagnosisStore.Scope, IReadOnlyList<Dictionary<string, string>>>? reviewSource = null)
|
||||
{
|
||||
this.context = context;
|
||||
this.next = next;
|
||||
@@ -195,6 +201,7 @@ public sealed class PatientTagResolver : ITagValueResolver
|
||||
this.hospitalName = hospitalName;
|
||||
this.diagnosisSource = diagnosisSource;
|
||||
this.surgerySource = surgerySource;
|
||||
this.reviewSource = reviewSource;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -226,6 +233,10 @@ public sealed class PatientTagResolver : ITagValueResolver
|
||||
{
|
||||
return surgeryValue;
|
||||
}
|
||||
if (FromReviewDiagnosis(tag) is { } reviewValue)
|
||||
{
|
||||
return reviewValue;
|
||||
}
|
||||
if (Computed.TryGetValue(tag, out var compute))
|
||||
{
|
||||
var made = compute(context);
|
||||
@@ -562,6 +573,60 @@ public sealed class PatientTagResolver : ITagValueResolver
|
||||
: new TagValue(false, $"수술 행은 있는데 {column} 값이 비어 있습니다");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 심사 상병 4종 — B_OkdInf(심사분). 결합 규칙(본문 확인):
|
||||
/// 주상병명/코드는 첫 행, 부상병명/코드는 <b>줄바꿈</b> 결합(가로형이 없다).
|
||||
/// 병원 분기는 KIMEYE 하나뿐이다(Bkd_상병쿼리:14631).
|
||||
/// </summary>
|
||||
private TagValue? FromReviewDiagnosis(string tag)
|
||||
{
|
||||
var scope = tag switch
|
||||
{
|
||||
"OCM_심사_주상병명" or "OCM_심사_주상병코드" => DiagnosisStore.Scope.Main,
|
||||
"OCM_심사_부상병명" or "OCM_심사_부상병코드" => DiagnosisStore.Scope.Sub,
|
||||
_ => (DiagnosisStore.Scope?)null,
|
||||
} is { } s ? s : (DiagnosisStore.Scope?)null;
|
||||
if (scope is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (UserSession.Current.HspCod == "KIMEYE")
|
||||
{
|
||||
return new TagValue(false, "이 병원(KIMEYE)의 심사 상병 분기는 아직 옮기지 않았습니다");
|
||||
}
|
||||
if (reviewSource is null)
|
||||
{
|
||||
return new TagValue(false, "심사 상병 조회가 연결되지 않았습니다");
|
||||
}
|
||||
if (!reviewCache.TryGetValue(scope.Value, out var rows))
|
||||
{
|
||||
try
|
||||
{
|
||||
rows = reviewSource(scope.Value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new TagValue(false, $"심사 상병 조회에 실패했습니다: {ex.GetType().Name}");
|
||||
}
|
||||
reviewCache[scope.Value] = rows;
|
||||
}
|
||||
if (rows.Count == 0)
|
||||
{
|
||||
return new TagValue(false, "이 내원에 심사 상병이 없습니다");
|
||||
}
|
||||
static string Cell(Dictionary<string, string> r, string c) => r.TryGetValue(c, out var v) ? v.Trim() : string.Empty;
|
||||
var value = tag switch
|
||||
{
|
||||
"OCM_심사_주상병명" => Cell(rows[0], "KcdKorNam"),
|
||||
"OCM_심사_주상병코드" => Cell(rows[0], "KcdElcCod"),
|
||||
"OCM_심사_부상병명" => string.Join(Environment.NewLine, rows.Select(r => Cell(r, "KcdKorNam"))),
|
||||
_ => string.Join(Environment.NewLine, rows.Select(r => Cell(r, "KcdElcCod"))),
|
||||
};
|
||||
return value.Trim().Length > 0
|
||||
? new TagValue(true, value)
|
||||
: new TagValue(false, "심사 상병 행은 있는데 그 값이 비어 있습니다");
|
||||
}
|
||||
|
||||
/// <summary>주민번호에서 나온 값 — 비면 <b>왜</b> 비었는지 말한다</summary>
|
||||
private TagValue Wrap(string value) => value.Length > 0
|
||||
? new TagValue(true, value)
|
||||
@@ -584,6 +649,7 @@ public sealed class PatientTagResolver : ITagValueResolver
|
||||
"OCM_주상병명", "OCM_주상병코드", "OCM_주상병POA",
|
||||
"OCM_OPNAME", "OCM_OPRCODNAM", "OCM_DX", "OCM_수술상병", "OCM_수술부위",
|
||||
"OCM_수술_OprPatETC", "OCM_수술집도의", "OCM_수술마취의사",
|
||||
"OCM_심사_주상병명", "OCM_심사_주상병코드", "OCM_심사_부상병명", "OCM_심사_부상병코드",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user