feat(mapping): 完成 PHIS 健康档案转换(T-212)
This commit is contained in:
@@ -108,10 +108,10 @@ func TestMapHealthRecordUsesMasterDataLookupWhenCodesMissing(t *testing.T) {
|
||||
t.Fatalf("master data not resolved: %#v", got)
|
||||
}
|
||||
}
|
||||
func TestGenerateCheckIDIsDeterministicAndVersionSensitive(t *testing.T) {
|
||||
first := GenerateCheckID("PHIS", "JKDA", "record-001", "20260707010101")
|
||||
second := GenerateCheckID("PHIS", "JKDA", "record-001", "20260707010101")
|
||||
third := GenerateCheckID("PHIS", "JKDA", "record-001", "20260708010101")
|
||||
func TestGenerateCheckIDIsDeterministicForStableSourceRecord(t *testing.T) {
|
||||
first := GenerateCheckID("PHIS", "JKDA", "record-001")
|
||||
second := GenerateCheckID("PHIS", "JKDA", "record-001")
|
||||
third := GenerateCheckID("PHIS", "JKDA", "record-002")
|
||||
if first != second {
|
||||
t.Fatalf("checkId not deterministic: %q != %q", first, second)
|
||||
}
|
||||
@@ -119,7 +119,7 @@ func TestGenerateCheckIDIsDeterministicAndVersionSensitive(t *testing.T) {
|
||||
t.Fatalf("checkId length = %d, want 20", len(first))
|
||||
}
|
||||
if first == third {
|
||||
t.Fatalf("version change did not affect checkId: %q", first)
|
||||
t.Fatalf("different source record reused checkId: %q", first)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +136,14 @@ func (fakeMasterDataLookup) DoctorIDByName(name string) (string, bool) {
|
||||
func (fakeMasterDataLookup) ManaUnitIDByName(name string) (string, bool) {
|
||||
return map[string]string{"测试机构": "123456789"}[name], name == "测试机构"
|
||||
}
|
||||
|
||||
func (fakeMasterDataLookup) DoctorIDExists(id string) bool {
|
||||
return id == "D001" || id == "doc-001" || id == "DOC001"
|
||||
}
|
||||
|
||||
func (fakeMasterDataLookup) ManaUnitIDExists(id string) bool {
|
||||
return id == "123456789"
|
||||
}
|
||||
func validPHISHealthRecord() PHISHealthRecord {
|
||||
return PHISHealthRecord{
|
||||
SourceSystem: "PHIS",
|
||||
|
||||
Reference in New Issue
Block a user