feat(mapping): 完成 PHIS 健康档案转换(T-212)

This commit is contained in:
ila
2026-07-16 00:53:16 +08:00
parent d385d6dd3b
commit 8a5550057c
20 changed files with 1078 additions and 124 deletions
+7 -4
View File
@@ -1,6 +1,9 @@
package mapping
import "testing"
import (
"reflect"
"testing"
)
func TestDocxStyleHealthRecordMappingBaseline(t *testing.T) {
src := PHISHealthRecord{
@@ -29,7 +32,7 @@ func TestDocxStyleHealthRecordMappingBaseline(t *testing.T) {
t.Fatalf("errors = %#v", errs)
}
assertMappedBaseline(t, got, MappedHealthRecord{
CheckID: GenerateCheckID("PHIS", "JKDA", "docx-sample-001", "20260707100000"),
CheckID: GenerateCheckID("PHIS", "JKDA", "docx-sample-001"),
IDCard: "440000********0001",
PersonName: "文档样例",
SexCode: "2",
@@ -74,7 +77,7 @@ func TestJointDebugStyleHealthRecordMappingBaseline(t *testing.T) {
if len(errs) != 0 {
t.Fatalf("errors = %#v", errs)
}
if got.CheckID != GenerateCheckID("PHIS", "JKDA", "joint-debug-001", "20260707110000") {
if got.CheckID != GenerateCheckID("PHIS", "JKDA", "joint-debug-001") {
t.Fatalf("checkId = %q", got.CheckID)
}
if got.IDCard != "440000********1234" || got.PersonName != "联调样例" || got.NationCode != "01" || got.WorkCode != "Y" {
@@ -113,7 +116,7 @@ func TestHealthRecordMappingBaselineRejectsDirtySample(t *testing.T) {
func assertMappedBaseline(t *testing.T, got MappedHealthRecord, want MappedHealthRecord) {
t.Helper()
if got != want {
if !reflect.DeepEqual(got, want) {
t.Fatalf("mapped = %#v\nwant = %#v", got, want)
}
}