张保健 3 years ago
parent
commit
46cb57e269
7 changed files with 1990 additions and 1475 deletions
  1. 2 2
      conf/app.conf
  2. 212 1010
      controllers/sync.go
  3. 97 4
      models/src_data.go
  4. 248 130
      models/sz/target_data.go
  5. 929 157
      service/city/auto_create_week_schedules_service.go
  6. 494 165
      service/city_data_uoload_service.go
  7. 8 7
      service/db.go

+ 2 - 2
conf/app.conf View File

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9550
2
+httpport = 9555
3 3
 runmode = prod
4 4
 
5 5
 copyrequestbody = true
@@ -111,7 +111,7 @@ writeuseruser = root
111 111
 writeuserpass = 1Q2W3e4r!@#$
112 112
 writeusername = sgj_users
113 113
 
114
-redishost = 120.77.235.13
114
+redishost = 112.74.16.180
115 115
 redisport = 6379
116 116
 redispasswrod = syh@#$%123456!
117 117
 redisdb = 0

File diff suppressed because it is too large
+ 212 - 1010
controllers/sync.go


+ 97 - 4
models/src_data.go View File

@@ -151,13 +151,27 @@ type Patients struct {
151 151
 	Nation                       string            `gorm:"column:nation" json:"nation"`
152 152
 	NativePlace                  string            `gorm:"column:native_place" json:"native_place"`
153 153
 	Age                          int64             `gorm:"column:age" json:"age"`
154
-	PatientLapseto               []*PatientLapseto `gorm:"ForeignKey:PatientId,LapsetoType;AssociationForeignKey:ID,Lapseto" json:"lapseto"`
154
+	PatientLapseto               PatientLapseto	   `gorm:"ForeignKey:PatientId,LapsetoType;AssociationForeignKey:ID,Lapseto" json:"patient_lapseto"`
155
+	InfectiousDiseases			 []*InfectiousDiseases   `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"infectious_diseases"`
155 156
 }
156 157
 
157 158
 func (Patients) TableName() string {
158 159
 	return "xt_patients"
159 160
 }
160 161
 
162
+type InfectiousDiseases struct {
163
+	ID          int64 `gorm:"column:id" json:"id" form:"id"`
164
+	PatientId   int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
165
+	DiseaseId   int64 `gorm:"column:disease_id" json:"disease_id" form:"disease_id"`
166
+	Status      int64 `gorm:"column:status" json:"status" form:"status"`
167
+	CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
168
+	UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
169
+}
170
+
171
+func (InfectiousDiseases) TableName() string {
172
+	return "xt_patients_infectious_diseases"
173
+}
174
+
161 175
 type Device struct {
162 176
 	ID             int64  `gorm:"column:id" json:"id"`
163 177
 	OrgId          int64  `gorm:"column:org_id" json:"org_id"`
@@ -351,6 +365,36 @@ func (DoctorAdvice) TableName() string {
351 365
 	return "xt_doctor_advice"
352 366
 }
353 367
 
368
+type DoctorAdviceTemplate struct {
369
+	ID                      int64                   `gorm:"column:id" json:"id" form:"id"`
370
+	OrgId                   int64                   `gorm:"column:org_id" json:"org_id" form:"org_id"`
371
+	AdviceName              string                  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
372
+	AdviceDesc              string                  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
373
+	SingleDose              float64                 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
374
+	SingleDoseUnit          string                  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
375
+	PrescribingNumber       float64                 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
376
+	PrescribingNumberUnit   string                  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
377
+	DeliveryWay             string                  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
378
+	ExecutionFrequency      string                  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
379
+	AdviceDoctor            int64                   `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
380
+	Status                  int64                   `gorm:"column:status" json:"status" form:"status"`
381
+	CreatedTime             int64                   `gorm:"column:created_time" json:"created_time" form:"created_time"`
382
+	UpdatedTime             int64                   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
383
+	TemplateId              int64                   `gorm:"column:template_id" json:"template_id"`
384
+	DrugSpec                string                  `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
385
+	DrugSpecUnit            string                  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
386
+	ParentId                int64                   `gorm:"column:parent_id" json:"parent_id"`
387
+	AdviceType              int64                   `gorm:"column:advice_type" json:"advice_type"`
388
+	DayCount                int64                   `gorm:"column:day_count" json:"day_count"`
389
+	WeekDays                string                  `gorm:"column:week_days" json:"week_days"`
390
+	FrequencyType           int64                   `gorm:"column:frequency_type" json:"frequency_type"`
391
+	SubDoctorAdviceTemplate []*DoctorAdviceTemplate `gorm:"ForeignKey:ParentId;AssociationForeignKey:ID" json:"child"`
392
+}
393
+
394
+func (DoctorAdviceTemplate) TableName() string {
395
+	return "xt_doctor_advice_template"
396
+}
397
+
354 398
 type AssessmentAfterDislysis struct {
355 399
 	ID                              int64   `gorm:"column:id" json:"id"`
356 400
 	UserOrgId                       int64   `gorm:"column:user_org_id" json:"user_org_id"`
@@ -454,7 +498,7 @@ type AssessmentBeforeDislysis struct {
454 498
 	CreatedTime                    int64   `gorm:"column:created_time" json:"created_time"`
455 499
 	UpdatedTime                    int64   `gorm:"column:updated_time" json:"updated_time"`
456 500
 	Modifier                       int64   `gorm:"column:modifier" json:"modifier"`
457
-	BloodAccessPartId              int64   `gorm:"column:blood_access_part_id" json:"blood_access_part_id"`
501
+	BloodAccessPartId              string   `gorm:"column:blood_access_part_id" json:"blood_access_part_id"`
458 502
 	BloodAccessPartOperaId         int64   `gorm:"column:blood_access_part_opera_id" json:"blood_access_part_opera_id"`
459 503
 	IsHemorrhage                   int64   `gorm:"column:is_hemorrhage" json:"is_hemorrhage"`
460 504
 	Hemorrhage                     string  `gorm:"column:hemorrhage" json:"hemorrhage"`
@@ -463,7 +507,7 @@ type AssessmentBeforeDislysis struct {
463 507
 	BloodAccessInternalFistula     string  `gorm:"column:blood_access_internal_fistula" json:"blood_access_internal_fistula"`
464 508
 	InternalFistulaOther           string  `gorm:"column:internal_fistula_other" json:"internal_fistula_other"`
465 509
 	BloodAccessNoise               int64   `gorm:"column:blood_access_noise" json:"blood_access_noise"`
466
-	PunctureWay                    int64   `gorm:"column:puncture_way" json:"puncture_way"`
510
+	PunctureWay                    string   `gorm:"column:puncture_way" json:"puncture_way"`
467 511
 	VenousCatheterization          int64   `gorm:"column:venous_catheterization" json:"venous_catheterization"`
468 512
 	VenousCatheterizationPart      int64   `gorm:"column:venous_catheterization_part" json:"venous_catheterization_part"`
469 513
 	VenousCatheterizationPartOther string  `gorm:"column:venous_catheterization_part_other" json:"venous_catheterization_part_other"`
@@ -476,7 +520,7 @@ type AssessmentBeforeDislysis struct {
476 520
 	MachineType                    string  `gorm:"column:machine_type" json:"machine_type"`
477 521
 	IsInfect                       int64   `gorm:"column:is_infect" json:"is_infect"`
478 522
 	Exposed                        float64 `gorm:"column:exposed" json:"exposed"`
479
-	Skin                           int64   `gorm:"column:skin" json:"skin"`
523
+	Skin                           string   `gorm:"column:skin" json:"skin"`
480 524
 	SkinOther                      string  `gorm:"column:skin_other" json:"skin_other"`
481 525
 	InfectOther                    string  `gorm:"column:infect_other" json:"infect_other"`
482 526
 	DuctusArantiiOther             string  `gorm:"column:ductus_arantii_other" json:"ductus_arantii_other"`
@@ -772,3 +816,52 @@ type DeviceRepair struct {
772 816
 func (DeviceRepair) TableName() string {
773 817
 	return "xt_device_repair"
774 818
 }
819
+
820
+type XtInspectionReference struct {
821
+	ID               int64  `gorm:"column:id" json:"id" form:"id"`
822
+	OrgId            int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
823
+	ProjectName      string `gorm:"column:project_name" json:"project_name" form:"project_name"`
824
+	Project          string `gorm:"column:project" json:"project" form:"project"`
825
+	ProjectId        int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
826
+	ItemName         string `gorm:"column:item_name" json:"item_name" form:"item_name"`
827
+	ItemNameAddition string `gorm:"column:item_name_addition" json:"item_name_addition" form:"item_name_addition"`
828
+	ItemId           int64  `gorm:"column:item_id" json:"item_id" form:"item_id"`
829
+	Item             string `gorm:"column:item" json:"item" form:"item"`
830
+	RangeType        int64  `gorm:"column:range_type" json:"range_type" form:"range_type"`
831
+	RangeMin         string `gorm:"column:range_min" json:"range_min" form:"range_min"`
832
+	RangeMax         string `gorm:"column:range_max" json:"range_max" form:"range_max"`
833
+	RangeValue       string `gorm:"column:range_value" json:"range_value" form:"range_value"`
834
+	RangeOptions     string `gorm:"column:range_options" json:"range_options" form:"range_options"`
835
+	Unit             string `gorm:"column:unit" json:"unit" form:"unit"`
836
+	Status           int64  `gorm:"column:status" json:"status" form:"status"`
837
+	CreatedTime      int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
838
+	UpdatedTime      int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
839
+}
840
+
841
+func (XtInspectionReference) TableName() string {
842
+
843
+	return "xt_inspection_reference"
844
+}
845
+
846
+type XtInspection struct {
847
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
848
+	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
849
+	OrgId        int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
850
+	ProjectId    int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
851
+	ItemId       int64  `gorm:"column:item_id" json:"item_id" form:"item_id"`
852
+	ItemName     string `gorm:"column:item_name" json:"item_name" form:"item_name"`
853
+	ProjectName  string `gorm:"column:project_name" json:"project_name" form:"project_name"`
854
+	InspectType  int64  `gorm:"column:inspect_type" json:"inspect_type" form:"inspect_type"`
855
+	InspectValue string `gorm:"column:inspect_value" json:"inspect_value" form:"inspect_value"`
856
+	InspectDate  int64  `gorm:"column:inspect_date" json:"inspect_date" form:"inspect_date"`
857
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
858
+	CreatedTime  int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
859
+	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
860
+	Patients 	 Patients `gorm:"ForeignKey:ID;AssociationForeignKey:PatientId"`
861
+	XtInspectionReference XtInspectionReference `gorm:"ForeignKey:ProjectId,ItemId;AssociationForeignKey:ProjectId,ItemId;"`
862
+}
863
+
864
+func (XtInspection) TableName() string {
865
+
866
+	return "xt_inspection"
867
+}

+ 248 - 130
models/sz/target_data.go View File

@@ -3,7 +3,6 @@ package sz
3 3
 import "time"
4 4
 
5 5
 type TempHdHospital struct {
6
-	ID             int64     `gorm:"column:id" json:"id" form:"id"`
7 6
 	HospitalId     string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
8 7
 	InstType       string    `gorm:"column:inst_type" json:"inst_type" form:"inst_type"`
9 8
 	DepartmentName string    `gorm:"column:department_name" json:"department_name" form:"department_name"`
@@ -84,30 +83,51 @@ func (TempHdLayout) TableName() string {
84 83
 	return "t_hd_layout"
85 84
 }
86 85
 
86
+type TempHdDivision struct{
87
+	ID             int64     `gorm:"column:id" json:"id"`
88
+	DivisionId     string    `gorm:"column:division_id" json:"division_id"`
89
+	HospitalId     string    `gorm:"column:hospital_id" json:"hospital_id"`
90
+	DivisionName   string    `gorm:"column:division_name" json:"division_name"`
91
+	Xgbz           string    `gorm:"column:xgbz" json:"xgbz"`
92
+	DivisionType   string    `gorm:"column:division_type" json:"division_type"`
93
+	CreateTime     time.Time `gorm:"column:create_time" json:"create_time"`
94
+	UpdateTime     time.Time `gorm:"column:update_time" json:"update_time"`
95
+	Sjscsj         time.Time `gorm:"column:sjscsj" json:"sjscsj"`
96
+	Mj             string    `gorm:"column:mj" json:"mj"`
97
+	Ylyl1          string    `gorm:"column:ylyl1" json:"ylyl1"`
98
+	Ylyl2          string    `gorm:"column:ylyl2" json:"ylyl2"`
99
+}
100
+
101
+func (TempHdDivision) TableName() string {
102
+	return "t_hd_division"
103
+}
104
+
105
+
87 106
 type TempHdDm struct {
88 107
 	ID             int64     `gorm:"column:id" json:"id"`
89
-	HospitalId     string    `gorm:"column:HOSPITAL_ID" json:"HOSPITAL_ID"`
90
-	EquipmentId    string    `gorm:"column:EQUIPMENT_ID" json:"EQUIPMENT_ID"`
91
-	SickbedNo      string    `gorm:"column:SICKBED_NO" json:"SICKBED_NO"`
92
-	EquipmentBrand string    `gorm:"column:EQUIPMENT_BRAND" json:"EQUIPMENT_BRAND"`
93
-	EquipmentModel string    `gorm:"column:EQUIPMENT_MODEL" json:"EQUIPMENT_MODEL"`
94
-	EnableTime     time.Time `gorm:"column:ENABLE_TIME" json:"ENABLE_TIME"`
95
-	DiscardedTime  time.Time `gorm:"column:DISCARDED_TIME" json:"DISCARDED_TIME"`
96
-	Status         string    `gorm:"column:STATUS" json:"STATUS"`
97
-	EquipmentType  string    `gorm:"column:EQUIPMENT_TYPE" json:"EQUIPMENT_TYPE"`
98
-	Temperature    string    `gorm:"column:TEMPERATURE" json:"TEMPERATURE"`
99
-	Humidity       string    `gorm:"column:HUMIDITY" json:"HUMIDITY"`
100
-	Pressure       string    `gorm:"column:PRESSURE" json:"PRESSURE"`
101
-	PressureUnit   string    `gorm:"column:PRESSURE_UNIT" json:"PRESSURE_UNIT"`
102
-	WorkingVoltage string    `gorm:"column:WORKING_VOLTAGE" json:"WORKING_VOLTAGE"`
103
-	Xgbz           string    `gorm:"column:XGBZ" json:"XGBZ"`
104
-	Bbp            string    `gorm:"column:BBP" json:"BBP"`
105
-	CreateTime     time.Time `gorm:"column:CREATE_TIME" json:"CREATE_TIME"`
106
-	UpdateTime     time.Time `gorm:"column:UPDATE_TIME" json:"UPDATE_TIME"`
107
-	Sjscsj         time.Time `gorm:"column:SJSCSJ" json:"SJSCSJ"`
108
-	Mj             string    `gorm:"column:MJ" json:"MJ"`
109
-	Ylyl1          string    `gorm:"column:YLYL1" json:"YLYL1"`
110
-	Ylyl2          string    `gorm:"column:YLYL2" json:"YLYL2"`
108
+	HospitalId     string    `gorm:"column:hospital_id" json:"hospital_id"`
109
+	EquipmentId    string    `gorm:"column:equipment_id" json:"equipment_id"`
110
+	SickbedNo      string    `gorm:"column:sickbed_no" json:"sickbed_no"`
111
+	SickbedType    string    `gorm:"column:sickbed_type" json:"sickbed_type"`
112
+	EquipmentBrand string    `gorm:"column:equipment_brand" json:"equipment_brand"`
113
+	EquipmentModel string    `gorm:"column:equipment_model" json:"equipment_model"`
114
+	EnableTime     time.Time `gorm:"column:enable_time" json:"enable_time"`
115
+	DiscardedTime  time.Time `gorm:"column:discarded_time" json:"discarded_time"`
116
+	Status         string    `gorm:"column:status" json:"status"`
117
+	EquipmentType  string    `gorm:"column:equipment_type" json:"equipment_type"`
118
+	Temperature    string    `gorm:"column:temperature" json:"temperature"`
119
+	Humidity       string    `gorm:"column:humidity" json:"humidity"`
120
+	Pressure       string    `gorm:"column:pressure" json:"pressure"`
121
+	PressureUnit   string    `gorm:"column:pressure_unit" json:"pressure_unit"`
122
+	WorkingVoltage string    `gorm:"column:working_voltage" json:"working_voltage"`
123
+	Xgbz           string    `gorm:"column:xgbz" json:"xgbz"`
124
+	Bbp            string    `gorm:"column:bbp" json:"bbp"`
125
+	CreateTime     time.Time `gorm:"column:create_time" json:"create_time"`
126
+	UpdateTime     time.Time `gorm:"column:update_time" json:"update_time"`
127
+	Sjscsj         time.Time `gorm:"column:sjscsj" json:"sjscsj"`
128
+	Mj             string    `gorm:"column:mj" json:"mj"`
129
+	Ylyl1          string    `gorm:"column:ylyl1" json:"ylyl1"`
130
+	Ylyl2          string    `gorm:"column:ylyl2" json:"ylyl2"`
111 131
 }
112 132
 
113 133
 func (TempHdDm) TableName() string {
@@ -193,6 +213,7 @@ type TempHdOtherMachine struct {
193 213
 	EnableTime     time.Time `gorm:"column:enable_time" json:"enable_time" form:"enable_time"`
194 214
 	DiscardedTime  time.Time `gorm:"column:discarded_time" json:"discarded_time" form:"discarded_time"`
195 215
 	Status         int64     `gorm:"column:status" json:"status" form:"status"`
216
+	EquipmentType  int64     `gorm:"column:equipment_type" json:"equipment_type" form:"equipment_type"`
196 217
 	Xgbz           string    `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
197 218
 	CreateTime     time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
198 219
 	UpdateTime     time.Time `gorm:"column:update_time" json:"update_time" form:"update_time"`
@@ -200,7 +221,7 @@ type TempHdOtherMachine struct {
200 221
 	Mj             int64     `gorm:"column:mj" json:"mj" form:"mj"`
201 222
 	Ylyl1          string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
202 223
 	Ylyl2          string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
203
-	EquipmentType  int64     `gorm:"column:equipment_type" json:"equipment_type" form:"equipment_type"`
224
+	
204 225
 }
205 226
 
206 227
 func (TempHdOtherMachine) TableName() string {
@@ -218,34 +239,23 @@ type TempHdPatient struct {
218 239
 	PatientName        string    `gorm:"column:patient_name" json:"patient_name" form:"patient_name"`
219 240
 	Gender             string    `gorm:"column:gender" json:"gender" form:"gender"`
220 241
 	BornDate           time.Time `gorm:"column:born_date" json:"born_date" form:"born_date"`
221
-	OutpatientNo       string    `gorm:"column:outpatient_no" json:"outpatient_no" form:"outpatient_no"`
222 242
 	DiagnosisSummary   string    `gorm:"column:diagnosis_summary" json:"diagnosis_summary" form:"diagnosis_summary"`
223 243
 	IsCrf              string    `gorm:"column:is_crf" json:"is_crf" form:"is_crf"`
224 244
 	AllergyHistory     string    `gorm:"column:allergy_history" json:"allergy_history" form:"allergy_history"`
225 245
 	PayMethod          string    `gorm:"column:pay_method" json:"pay_method" form:"pay_method"`
226
-	RrtStartTime       time.Time `gorm:"column:rrt_start_time" json:"rrt_start_time" form:"rrt_start_time"`
246
+	LocalInsurance     int64     `gorm:"column:local_insurance" json:"local_insurance" form:"local_insurance"`
227 247
 	DialysisStartTime  time.Time `gorm:"column:dialysis_start_time" json:"dialysis_start_time" form:"dialysis_start_time"`
228 248
 	LocalStartTime     time.Time `gorm:"column:local_start_time" json:"local_start_time" form:"local_start_time"`
249
+	OutpatientNo       string    `gorm:"column:outpatient_no" json:"outpatient_no" form:"outpatient_no"`
250
+	HospitalizedNo     string    `gorm:"column:hospitalized_no" json:"hospitalized_no" form:"hospitalized_no"`
251
+	Height      	   int64     `gorm:"column:height" json:"height" form:"height"`
252
+	Xgbz               int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
229 253
 	CreateTime         time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
230 254
 	UpdateTime         time.Time `gorm:"column:update_time" json:"update_time" form:"update_time"`
231 255
 	Sjscsj             time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
232 256
 	Mj                 int64     `gorm:"column:mj" json:"mj" form:"mj"`
233 257
 	Ylyl1              int64     `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
234
-	Ylyl2              int64     `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
235
-	PatientPhoneNo     string    `gorm:"column:patient_phone_no" json:"patient_phone_no" form:"patient_phone_no"`
236
-	FolkPhoneNo        string    `gorm:"column:folk_phone_no" json:"folk_phone_no" form:"folk_phone_no"`
237
-	PatientNationality int64     `gorm:"column:patient_nationality" json:"patient_nationality" form:"patient_nationality"`
238
-	Province           int64     `gorm:"column:province" json:"province" form:"province"`
239
-	City               int64     `gorm:"column:city" json:"city" form:"city"`
240
-	District           int64     `gorm:"column:district" json:"district" form:"district"`
241
-	Subdistrict        int64     `gorm:"column:subdistrict" json:"subdistrict" form:"subdistrict"`
242
-	DetailAddress      string    `gorm:"column:detail_address" json:"detail_address" form:"detail_address"`
243
-	PatientHeight      int64     `gorm:"column:patient_height" json:"patient_height" form:"patient_height"`
244
-	HospitalizedNo     string    `gorm:"column:hospitalized_no" json:"hospitalized_no" form:"hospitalized_no"`
245
-	IsTerminated       int64     `gorm:"column:is_terminated" json:"is_terminated" form:"is_terminated"`
246
-	InCrrtDate         time.Time `gorm:"column:in_crrt_date" json:"in_crrt_date" form:"in_crrt_date"`
247
-	Xgbz               int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
248
-	LocalInsurance     int64     `gorm:"column:local_insurance" json:"local_insurance" form:"local_insurance"`
258
+	Ylyl2              int64     `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`	
249 259
 }
250 260
 
251 261
 func (TempHdPatient) TableName() string {
@@ -260,8 +270,9 @@ type TempHdPatientOut struct {
260 270
 	SequelaeDate    time.Time `gorm:"column:sequelae_date" json:"sequelae_date" form:"sequelae_date"`
261 271
 	SequelaeType    string    `gorm:"column:sequelae_type" json:"sequelae_type" form:"sequelae_type"`
262 272
 	SequelaeSubType string    `gorm:"column:sequelae_sub_type" json:"sequelae_sub_type" form:"sequelae_sub_type"`
263
-	ExtReason       string    `gorm:"column:ext_reason" json:"ext_reason" form:"ext_reason"`
264 273
 	CreateTime      time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
274
+	DeathReason     string    `gorm:"column:death_reason" json:"death_reason" form:"death_reason"`
275
+	ExtReason       string    `gorm:"column:ext_reason" json:"ext_reason" form:"ext_reason"`
265 276
 	Sjscsj          time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
266 277
 	Mj              string    `gorm:"column:mj" json:"mj" form:"mj"`
267 278
 	Xgbz            int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
@@ -274,50 +285,22 @@ func (TempHdPatientOut) TableName() string {
274 285
 }
275 286
 
276 287
 type TempHdPs struct {
277
-	ID                   int64     `gorm:"column:id" json:"id" form:"id"`
278
-	HospitalId           string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
279 288
 	PrescribeId          string    `gorm:"column:prescribe_id" json:"prescribe_id" form:"prescribe_id"`
289
+	HospitalId           string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
280 290
 	PatientNk            string    `gorm:"column:patient_nk" json:"patient_nk" form:"patient_nk"`
281 291
 	MedicalId            string    `gorm:"column:medical_id" json:"medical_id" form:"medical_id"`
282 292
 	DrId                 int64     `gorm:"column:dr_id" json:"dr_id" form:"dr_id"`
283
-	Sn                   string    `gorm:"column:sn" json:"sn" form:"sn"`
293
+	RrtType              int64     `gorm:"column:rrt_type" json:"rrt_type" form:"rrt_type"`
294
+	RrtTypeName           string    `gorm:"column:rrt_type_name" json:"rrt_type_name" form:"rrt_type_name"`
284 295
 	DialysisFrequency    int64     `gorm:"column:dialysis_frequency" json:"dialysis_frequency" form:"dialysis_frequency"`
285 296
 	FrequencyUnit        int64     `gorm:"column:frequency_unit" json:"frequency_unit" form:"frequency_unit"`
286
-	DialysisDuration     float64   `gorm:"column:dialysis_duration" json:"dialysis_duration" form:"dialysis_duration"`
287
-	Hdf                  string    `gorm:"column:hdf" json:"hdf" form:"hdf"`
288
-	HdfFrequencyUnit     int64     `gorm:"column:hdf_frequency_unit" json:"hdf_frequency_unit" form:"hdf_frequency_unit"`
289
-	HdfFrequency         int64     `gorm:"column:hdf_frequency" json:"hdf_frequency" form:"hdf_frequency"`
290
-	HdfDuration          float64   `gorm:"column:hdf_duration" json:"hdf_duration" form:"hdf_duration"`
291
-	Hp                   string    `gorm:"column:hp" json:"hp" form:"hp"`
292
-	HpFrequency          int64     `gorm:"column:hp_frequency" json:"hp_frequency" form:"hp_frequency"`
293
-	HpFrequencyUnit      int64     `gorm:"column:hp_frequency_unit" json:"hp_frequency_unit" form:"hp_frequency_unit"`
294
-	HpDuration           float64   `gorm:"column:hp_duration" json:"hp_duration" form:"hp_duration"`
295
-	K                    float64   `gorm:"column:k" json:"k" form:"k"`
296
-	DialysisId           int64     `gorm:"column:dialysis_id" json:"dialysis_id" form:"dialysis_id"`
297
-	MedicineTypeId       int64     `gorm:"column:medicine_type_id" json:"medicine_type_id" form:"medicine_type_id"`
298
-	Ca                   float64   `gorm:"column:ca" json:"ca" form:"ca"`
299
-	Na                   float64   `gorm:"column:na" json:"na" form:"na"`
300
-	Glucose              int64     `gorm:"column:glucose" json:"glucose" form:"glucose"`
301
-	FluxLevel            int64     `gorm:"column:flux_level" json:"flux_level" form:"flux_level"`
302
-	FluxValue            string    `gorm:"column:flux_value" json:"flux_value" form:"flux_value"`
303
-	UseType              int64     `gorm:"column:use_type" json:"use_type" form:"use_type"`
304 297
 	PrescribeTime        time.Time `gorm:"column:prescribe_time" json:"prescribe_time" form:"prescribe_time"`
305
-	DialysisMembrane     int64     `gorm:"column:dialysis_membrane" json:"dialysis_membrane" form:"dialysis_membrane"`
306 298
 	CreateTime           time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
307
-	PatientNo            int64     `gorm:"column:patient_no" json:"patient_no" form:"patient_no"`
308 299
 	Sjscsj               time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
309 300
 	Mj                   int64     `gorm:"column:mj" json:"mj" form:"mj"`
310 301
 	Xgbz                 int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
311
-	AType                int64     `gorm:"column:a_type" json:"a_type" form:"a_type"`
312 302
 	Ylyl1                string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
313 303
 	Ylyl2                string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
314
-	RrtType              int64     `gorm:"column:rrt_type" json:"rrt_type" form:"rrt_type"`
315
-	MedicineId           int64     `gorm:"column:medicine_id" json:"medicine_id" form:"medicine_id"`
316
-	ABSource             int64     `gorm:"column:a_b_source" json:"a_b_source" form:"a_b_source"`
317
-	B                    int64     `gorm:"column:b" json:"b" form:"b"`
318
-	EquipmentType        int64     `gorm:"column:equipment_type" json:"equipment_type" form:"equipment_type"`
319
-	DialysisMembraneSize int64     `gorm:"column:dialysis_membrane_size" json:"dialysis_membrane_size" form:"dialysis_membrane_size"`
320
-	UpdateTime           time.Time `gorm:"column:update_time" json:"update_time" form:"update_time"`
321 304
 }
322 305
 
323 306
 func (TempHdPs) TableName() string {
@@ -326,8 +309,7 @@ func (TempHdPs) TableName() string {
326 309
 
327 310
 type TempHdPsMedicine struct {
328 311
 	ID             int64     `gorm:"column:id" json:"id" form:"id"`
329
-	Sn             string    `gorm:"column:sn" json:"sn" form:"sn"`
330
-	PrescribeId    string    `gorm:"column:prescribe_id" json:"prescribe_id" form:"prescribe_id"`
312
+	Sn             int64    `gorm:"column:sn" json:"sn" form:"sn"`
331 313
 	HospitalId     string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
332 314
 	MedicineTypeId string    `gorm:"column:medicine_type_id" json:"medicine_type_id" form:"medicine_type_id"`
333 315
 	MedicineId     string    `gorm:"column:medicine_id" json:"medicine_id" form:"medicine_id"`
@@ -336,7 +318,7 @@ type TempHdPsMedicine struct {
336 318
 	Mj             string    `gorm:"column:mj" json:"mj" form:"mj"`
337 319
 	Xgbz           int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
338 320
 	Ylyl1          string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
339
-	Ylyl2          string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
321
+	Ylyl2          string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`	
340 322
 }
341 323
 
342 324
 func (TempHdPsMedicine) TableName() string {
@@ -344,29 +326,26 @@ func (TempHdPsMedicine) TableName() string {
344 326
 }
345 327
 
346 328
 type TempHdInfection struct {
347
-	ID         int64     `gorm:"column:id" json:"id" form:"id"`
348 329
 	Sn         string    `gorm:"column:sn" json:"sn" form:"sn"`
349 330
 	HospitalId string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
350 331
 	PatientNk  string    `gorm:"column:patient_nk" json:"patient_nk" form:"patient_nk"`
351
-	Hbv        string    `gorm:"column:hbv" json:"hbv" form:"hbv"`
352
-	Hcv        string    `gorm:"column:hcv" json:"hcv" form:"hcv"`
353
-	Rpr        string    `gorm:"column:rpr" json:"rpr" form:"rpr"`
354
-	Hiv        string    `gorm:"column:hiv" json:"hiv" form:"hiv"`
355
-	Hbsag      string    `gorm:"column:hbsag" json:"hbsag" form:"hbsag"`
356
-	Hbs        string    `gorm:"column:hbs" json:"hbs" form:"hbs"`
357
-	Hbeag      string    `gorm:"column:hbeag" json:"hbeag" form:"hbeag"`
358
-	Hbe        string    `gorm:"column:hbe" json:"hbe" form:"hbe"`
359
-	Hbc        string    `gorm:"column:hbc" json:"hbc" form:"hbc"`
332
+	Hbv        int64     `gorm:"column:hbv" json:"hbv" form:"hbv"`
333
+	Hcv        int64     `gorm:"column:hcv" json:"hcv" form:"hcv"`
334
+	Rpr        int64     `gorm:"column:rpr" json:"rpr" form:"rpr"`
335
+	Hiv        int64     `gorm:"column:hiv" json:"hiv" form:"hiv"`
336
+	Hbsag      int64     `gorm:"column:hbsag" json:"hbsag" form:"hbsag"`
337
+	Hbsab      int64     `gorm:"column:hbsab" json:"hbsab" form:"hbsab"`
338
+	Hbeag      int64     `gorm:"column:hbeag" json:"hbeag" form:"hbeag"`
339
+	Hbeab      int64     `gorm:"column:hbeab" json:"hbeab" form:"hbeab"`
340
+	Hbcab      int64     `gorm:"column:hbcab" json:"hbcab" form:"hbcab"`
360 341
 	CheckDate  time.Time `gorm:"column:check_date" json:"check_date" form:"check_date"`
361 342
 	CreateTime time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
343
+	DoctorId   string    `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
362 344
 	Sjscsj     time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
363 345
 	Mj         string    `gorm:"column:mj" json:"mj" form:"mj"`
364 346
 	Xgbz       int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
365 347
 	Ylyl1      string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
366 348
 	Ylyl2      string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
367
-	Hbsab      string    `gorm:"column:hbsab" json:"hbsab" form:"hbsab"`
368
-	Hbeab      string    `gorm:"column:hbeab" json:"hbeab" form:"hbeab"`
369
-	Hbcab      string    `gorm:"column:hbcab" json:"hbcab" form:"hbcab"`
370 349
 }
371 350
 
372 351
 func (TempHdInfection) TableName() string {
@@ -462,7 +441,7 @@ type TempHdShift struct {
462 441
 	PatientNk      string    `gorm:"column:patient_nk" json:"patient_nk" form:"patient_nk"`
463 442
 	ScheduleDate   time.Time `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
464 443
 	ShiftType      string    `gorm:"column:shift_type" json:"shift_type" form:"shift_type"`
465
-	SickbedNo      string    `gorm:"column:sickbed_no" json:"sickbed_no" form:"sickbed_no"`
444
+	SickbedNo      int64    `gorm:"column:sickbed_no" json:"sickbed_no" form:"sickbed_no"`
466 445
 	ScheduleStatus string    `gorm:"column:schedule_status" json:"schedule_status" form:"schedule_status"`
467 446
 	CreateTime     time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
468 447
 	Sjscsj         time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
@@ -483,19 +462,11 @@ type TempHdDoctorsAdvice struct {
483 462
 	DialysisId            string    `gorm:"column:dialysis_id" json:"dialysis_id" form:"dialysis_id"`
484 463
 	OrderType             string    `gorm:"column:order_type" json:"order_type" form:"order_type"`
485 464
 	RrtType               int64     `gorm:"column:rrt_type" json:"rrt_type" form:"rrt_type"`
465
+	RrtTypeName           string    `gorm:"column:rrt_type_name" json:"rrt_type_name" form:"rrt_type_name"`
486 466
 	PatientNk             string    `gorm:"column:patient_nk" json:"patient_nk" form:"patient_nk"`
487 467
 	DialysisDuration      int64     `gorm:"column:dialysis_duration" json:"dialysis_duration" form:"dialysis_duration"`
488 468
 	BloodVol              int64     `gorm:"column:blood_vol" json:"blood_vol" form:"blood_vol"`
489 469
 	DryWeight             float64   `gorm:"column:dry_weight" json:"dry_weight" form:"dry_weight"`
490
-	CreateTime            time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
491
-	Sjscsj                time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
492
-	Mj                    string    `gorm:"column:mj" json:"mj" form:"mj"`
493
-	Xgbz                  int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
494
-	Ylyl1                 string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
495
-	Ylyl2                 string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
496
-	HospitalizationNo     string    `gorm:"column:hospitalization_no" json:"hospitalization_no" form:"hospitalization_no"`
497
-	OutpatientNo          string    `gorm:"column:outpatient_no" json:"outpatient_no" form:"outpatient_no"`
498
-	RrtTypeName           string    `gorm:"column:rrt_type_name" json:"rrt_type_name" form:"rrt_type_name"`
499 470
 	Txq                   int64     `gorm:"column:txq" json:"txq" form:"txq"`
500 471
 	FluxLevel             int64     `gorm:"column:flux_level" json:"flux_level" form:"flux_level"`
501 472
 	ReuseFlag             int64     `gorm:"column:reuse_flag" json:"reuse_flag" form:"reuse_flag"`
@@ -515,7 +486,13 @@ type TempHdDoctorsAdvice struct {
515 486
 	Conductivity          int64     `gorm:"column:conductivity" json:"conductivity" form:"conductivity"`
516 487
 	DlCalcium             int64     `gorm:"column:dl_calcium" json:"dl_calcium" form:"dl_calcium"`
517 488
 	ExecuteOrder          int64     `gorm:"column:execute_order" json:"execute_order" form:"execute_order"`
518
-	UpdateTime            time.Time `gorm:"column:update_time" json:"update_time" form:"update_time"`
489
+	CreateTime            time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
490
+	Sjscsj                time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
491
+	Mj                    string    `gorm:"column:mj" json:"mj" form:"mj"`
492
+	Xgbz                  int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
493
+	Ylyl1                 string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
494
+	Ylyl2                 string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
495
+	
519 496
 }
520 497
 
521 498
 func (TempHdDoctorsAdvice) TableName() string {
@@ -550,6 +527,15 @@ type TempHdDialysis struct {
550 527
 	AccessId              string    `gorm:"column:access_id" json:"access_id" form:"access_id"`
551 528
 	DialyzerId            string    `gorm:"column:dialyzer_id" json:"dialyzer_id" form:"dialyzer_id"`
552 529
 	Ktv                   float64   `gorm:"column:ktv" json:"ktv" form:"ktv"`
530
+	Urr					  float64   `gorm:"column:urr" json:"urr" form:"urr"`
531
+	BeforeBun			  float64   `gorm:"column:before_bun" json:"before_bun" form:"before_bun"`
532
+	AfterBun			  float64   `gorm:"column:after_bun" json:"after_bun" form:"after_bun"`
533
+	ChargeDoctorId        string    `gorm:"column:charge_doctor_id" json:"charge_doctor_id" form:"charge_doctor_id"`
534
+	ChargeNurseId         string    `gorm:"column:charge_nurse_id" json:"charge_nurse_id" form:"charge_nurse_id"`
535
+	UpNurseId             string    `gorm:"column:up_nurse_id" json:"up_nurse_id" form:"up_nurse_id"`
536
+	DownNurseId           string    `gorm:"column:down_nurse_id" json:"down_nurse_id" form:"down_nurse_id"`
537
+	CheckNurseId          string    `gorm:"column:check_nurse_id" json:"check_nurse_id" form:"check_nurse_id"`
538
+	PunctureNurseId       string    `gorm:"column:puncture_nurse_id" json:"puncture_nurse_id" form:"puncture_nurse_id"`
553 539
 	StartTime             time.Time `gorm:"column:start_time" json:"start_time" form:"start_time"`
554 540
 	EndTime               time.Time `gorm:"column:end_time" json:"end_time" form:"end_time"`
555 541
 	CreateTime            time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
@@ -558,13 +544,6 @@ type TempHdDialysis struct {
558 544
 	Xgbz                  int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
559 545
 	Ylyl1                 string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
560 546
 	Ylyl2                 string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
561
-	UpdateTime            time.Time `gorm:"column:update_time" json:"update_time" form:"update_time"`
562
-	ChargeDoctorId        string    `gorm:"column:charge_doctor_id" json:"charge_doctor_id" form:"charge_doctor_id"`
563
-	ChargeNurseId         string    `gorm:"column:charge_nurse_id" json:"charge_nurse_id" form:"charge_nurse_id"`
564
-	UpNurseId             string    `gorm:"column:up_nurse_id" json:"up_nurse_id" form:"up_nurse_id"`
565
-	DownNurseId           string    `gorm:"column:down_nurse_id" json:"down_nurse_id" form:"down_nurse_id"`
566
-	CheckNurseId          string    `gorm:"column:check_nurse_id" json:"check_nurse_id" form:"check_nurse_id"`
567
-	PunctureNurseId       string    `gorm:"column:puncture_nurse_id" json:"puncture_nurse_id" form:"puncture_nurse_id"`
568 547
 }
569 548
 
570 549
 func (TempHdDialysis) TableName() string {
@@ -573,7 +552,7 @@ func (TempHdDialysis) TableName() string {
573 552
 
574 553
 type TempHdMiddle struct {
575 554
 	ID             int64     `gorm:"column:id" json:"id" form:"id"`
576
-	Sn             string    `gorm:"column:sn" json:"sn" form:"sn"`
555
+	Sn             int64    `gorm:"column:sn" json:"sn" form:"sn"`
577 556
 	HospitalId     string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
578 557
 	PatientNk      string    `gorm:"column:patient_nk" json:"patient_nk" form:"patient_nk"`
579 558
 	DialysisId     string    `gorm:"column:dialysis_id" json:"dialysis_id" form:"dialysis_id"`
@@ -590,7 +569,7 @@ type TempHdMiddle struct {
590 569
 	Ufv            int64     `gorm:"column:ufv" json:"ufv" form:"ufv"`
591 570
 	OnLine         int64     `gorm:"column:on_line" json:"on_line" form:"on_line"`
592 571
 	Spo2           float64   `gorm:"column:spo2" json:"spo2" form:"spo2"`
593
-	R              int64     `gorm:"column:r" json:"r" form:"r"`
572
+	RespiratorySystem              int64     `gorm:"column:respiratory_system" json:"respiratory_system" form:"respiratory_system"`
594 573
 	OtherSituation string    `gorm:"column:other_situation" json:"other_situation" form:"other_situation"`
595 574
 	Nurse          string    `gorm:"column:nurse" json:"nurse" form:"nurse"`
596 575
 	CreateTime     time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
@@ -599,30 +578,169 @@ type TempHdMiddle struct {
599 578
 	Xgbz           int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
600 579
 	Ylyl1          string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
601 580
 	Ylyl2          string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
602
-	UpdateBy       int64     `gorm:"column:update_by" json:"update_by" form:"update_by"`
603
-	UpdateTime     time.Time `gorm:"column:update_time" json:"update_time" form:"update_time"`
604 581
 }
605 582
 
606 583
 func (TempHdMiddle) TableName() string {
607 584
 	return "t_hd_middle"
608 585
 }
609 586
 
610
-type TempHdDivision struct {
611
-	ID           int64     `gorm:"column:id" json:"id" form:"id"`
612
-	DivisionId   int64     `gorm:"column:division_id" json:"division_id" form:"division_id"`
613
-	HospitalId   string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
614
-	DivisionName string    `gorm:"column:division_name" json:"division_name" form:"division_name"`
615
-	UpdateFlag   int64     `gorm:"column:update_flag" json:"update_flag" form:"update_flag"`
616
-	UpdateTime   time.Time `gorm:"column:update_time" json:"update_time" form:"update_time"`
617
-	CreateTime   time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
618
-	Sjscsj       time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
619
-	Mj           string    `gorm:"column:mj" json:"mj" form:"mj"`
620
-	Xgbz         int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
621
-	Ylyl1        string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
622
-	Ylyl2        string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
623
-	DivisionType int64     `gorm:"column:division_type" json:"division_type" form:"division_type"`
624
-}
625
-
626
-func (TempHdDivision) TableName() string {
627
-	return "t_hd_division"
628
-}
587
+type TempHdAccess struct {
588
+	AccessId       		int64     `gorm:"column:access_id" json:"access_id" form:"access_id"`
589
+	HospitalId     		string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
590
+	PatientNk      		string    `gorm:"column:patient_nk" json:"patient_nk" form:"patient_nk"`
591
+	AccessType			int64     `gorm:"column:access_type" json:"access_type" form:"access_type"`
592
+	AccessTypeName		string    `gorm:"column:access_type_name" json:"access_type_name" form:"access_type_name"`
593
+	AccessStatus		int64     `gorm:"column:access_status" json:"access_status" form:"access_status"`
594
+	ChannelPosition		int64     `gorm:"column:channel_position" json:"channel_position" form:"channel_position"`
595
+	CatheterSite		int64     `gorm:"column:catheter_site" json:"catheter_site" form:"catheter_site"`
596
+	RemoveTime			time.Time `gorm:"column:remove_time" json:"remove_time" form:"remove_time"`
597
+	RemoveReason		int64     `gorm:"column:remove_reason" json:"remove_reason" form:"remove_reason"`
598
+	RemoveReasonDesc	string     `gorm:"column:remove_reason_desc" json:"remove_reason_desc" form:"remove_reason_desc"`
599
+	SetupDate			time.Time     `gorm:"column:setup_date" json:"setup_date" form:"setup_date"`
600
+	FirstUseTime		time.Time     `gorm:"column:first_use_time" json:"first_use_time" form:"first_use_time"`
601
+	CreateTime     		time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
602
+	UpdateTime     		time.Time `gorm:"column:update_time" json:"update_time" form:"update_time"`
603
+	Sjscsj         		time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
604
+	Mj             		string    `gorm:"column:mj" json:"mj" form:"mj"`
605
+	Xgbz           		int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
606
+	Ylyl1          		string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
607
+	Ylyl2          		string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
608
+}
609
+
610
+func (TempHdAccess) TableName() string {
611
+	return "t_hd_access"
612
+}
613
+
614
+type TempHdSickbed struct {
615
+	SickbedNo       	int64     `gorm:"column:sickbed_no" json:"sickbed_no" form:"sickbed_no"`
616
+	HospitalId     		string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
617
+	DivisionId     		string    `gorm:"column:division_id" json:"division_id" form:"division_id"`
618
+	SickbedCode     	string    `gorm:"column:sickbed_code" json:"sickbed_code" form:"sickbed_code"`
619
+	SickbedType     	string    `gorm:"column:sickbed_type" json:"sickbed_type" form:"sickbed_type"`
620
+	CreateTime     		time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
621
+	UpdateTime     		time.Time `gorm:"column:update_time" json:"update_time" form:"update_time"`
622
+	Sjscsj         		time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
623
+	Mj             		string    `gorm:"column:mj" json:"mj" form:"mj"`
624
+	Xgbz           		int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
625
+	Ylyl1          		string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
626
+	Ylyl2          		string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
627
+}
628
+
629
+func (TempHdSickbed) TableName() string {
630
+	return "t_hd_sickbed"
631
+}
632
+
633
+type TempHdDiagnosis struct {
634
+	DiagnosisId       		int64     `gorm:"column:diagnosis_id" json:"diagnosis_id" form:"diagnosis_id"`
635
+	HospitalId     			string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
636
+	PatientNk      			string    `gorm:"column:patient_nk" json:"patient_nk" form:"patient_nk"`
637
+	DiagnosisTime     		time.Time `gorm:"column:diagnosis_time" json:"diagnosis_time" form:"diagnosis_time"`
638
+	DiagnosisType     		string    `gorm:"column:diagnosis_type" json:"diagnosis_type" form:"diagnosis_type"`
639
+	DiagnosisTypeItem    	string    `gorm:"column:diagnosis_type_item" json:"diagnosis_type_item" form:"diagnosis_type_item"`
640
+	DiagnosisTypeDetail		string    `gorm:"column:diagnosis_type_detail" json:"diagnosis_type_detail" form:"diagnosis_type_detail"`
641
+	CreateTime     			time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
642
+	UpdateTime     			time.Time `gorm:"column:update_time" json:"update_time" form:"update_time"`
643
+	Sjscsj         			time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
644
+	Mj             			string    `gorm:"column:mj" json:"mj" form:"mj"`
645
+	Xgbz           			int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
646
+	Ylyl1          			string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
647
+	Ylyl2          			string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
648
+}
649
+
650
+func (TempHdDiagnosis) TableName() string {
651
+	return "t_hd_diagnosis"
652
+}
653
+
654
+type TempHdComplication struct {
655
+	Sn       		string     `gorm:"column:sn" json:"sn" form:"sn"`
656
+	HospitalId		string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
657
+	PatientNk		string    `gorm:"column:patient_nk" json:"patient_nk" form:"patient_nk"`
658
+	DialysisId		int64     `gorm:"column:dialysis_id" json:"dialysis_id" form:"dialysis_id"`
659
+	MonitorId		int64     `gorm:"column:monitor_id" json:"monitor_id" form:"monitor_id"`
660
+	NeopathyTime	int64     `gorm:"column:neopathy_time" json:"neopathy_time" form:"neopathy_time"`
661
+	NeopathyType	string    `gorm:"column:neopathy_type" json:"neopathy_type" form:"neopathy_type"`
662
+	NeopathyDesc	string 	  `gorm:"column:neopathy_desc" json:"neopathy_desc" form:"neopathy_desc"`
663
+	CreateTime		time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
664
+	Sjscsj			time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
665
+	Mj				string    `gorm:"column:mj" json:"mj" form:"mj"`
666
+	Xgbz			int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
667
+	Ylyl1			string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
668
+	Ylyl2			string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
669
+}
670
+
671
+func (TempHdComplication) TableName() string {
672
+	return "t_hd_complication"
673
+}
674
+
675
+type TempHdLisReport struct {
676
+	LabSno			string    `gorm:"column:lab_sno" json:"lab_sno" form:"lab_sno"`
677
+	HospitalId		string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
678
+	PatientNk		string    `gorm:"column:patient_nk" json:"patient_nk" form:"patient_nk"`
679
+	ReportDate		time.Time `gorm:"column:report_date" json:"report_date" form:"report_date"`
680
+	CheckDate		string    `gorm:"column:check_date" json:"check_date" form:"check_date"`
681
+	JzNo			string    `gorm:"column:jz_no" json:"jz_no" form:"jz_no"`
682
+	MzFlag			string    `gorm:"column:mz_flag" json:"mz_flag" form:"mz_flag"`
683
+	ZyNo			string    `gorm:"column:zy_no" json:"zy_no" form:"zy_no"`
684
+	MzNo			string    `gorm:"column:mz_no" json:"mz_no" form:"mz_no"`
685
+	DepartmentCode	string    `gorm:"column:department_code" json:"department_code" form:"department_code"`
686
+	DepartmentName	string    `gorm:"column:department_name" json:"department_name" form:"department_name"`
687
+	CardNo			string    `gorm:"column:card_no" json:"card_no" form:"card_no"`
688
+	CardType		string    `gorm:"column:card_type" json:"card_type" form:"card_type"`
689
+	PatientName		string    `gorm:"column:patient_name" json:"patient_name" form:"patient_name"`
690
+	DepCode			string    `gorm:"column:dep_code" json:"dep_code" form:"dep_code"`
691
+	DepName			string    `gorm:"column:dep_name" json:"dep_name" form:"dep_name"`
692
+	InspectedType	string    `gorm:"column:inspected_type" json:"inspected_type" form:"inspected_type"`
693
+	ReportCategry	string    `gorm:"column:report_categry" json:"report_categry" form:"report_categry"`
694
+	ApplicationName	string    `gorm:"column:application_name" json:"application_name" form:"application_name"`
695
+	ApplicationType	string    `gorm:"column:application_type" json:"application_type" form:"application_type"`
696
+	CheckName		string    `gorm:"column:check_name" json:"check_name" form:"check_name"`
697
+	CheckItemName	string    `gorm:"column:check_item_name" json:"check_item_name" form:"check_item_name"`
698
+	CheckItemCode	string    `gorm:"column:check_item_code" json:"check_item_code" form:"check_item_code"`
699
+	RecordCcount	int64    `gorm:"column:record_ccount" json:"record_ccount" form:"record_ccount"`
700
+	CheckResult		string    `gorm:"column:check_result" json:"check_result" form:"check_result"`
701
+	DiagnoseCode	string    `gorm:"column:diagnose_code" json:"diagnose_code" form:"diagnose_code"`
702
+	DiagnoseName	string    `gorm:"column:diagnose_name" json:"diagnose_name" form:"diagnose_name"`
703
+	CreateTime		time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
704
+	Sjscsj			time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
705
+	Mj				string    `gorm:"column:mj" json:"mj" form:"mj"`
706
+	Xgbz			int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
707
+	Ylyl1			string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
708
+	Ylyl2			string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
709
+}
710
+
711
+func (TempHdLisReport) TableName() string {
712
+	return "t_hd_lis_report"
713
+}
714
+
715
+type TempHdLisIndicators struct {
716
+	InspectedResultNo		string    `gorm:"column:inspected_result_no" json:"inspected_result_no" form:"inspected_result_no"`
717
+	HospitalId				string    `gorm:"column:hospital_id" json:"hospital_id" form:"hospital_id"`
718
+	LabSno					string    `gorm:"column:lab_sno" json:"lab_sno" form:"lab_sno"`
719
+	ReportDate				time.Time `gorm:"column:report_date" json:"report_date" form:"report_date"`
720
+	CheckDate				time.Time `gorm:"column:check_date" json:"check_date" form:"check_date"`
721
+	InspectedIndicate		string    `gorm:"column:inspected_indicate" json:"inspected_indicate" form:"inspected_indicate"`
722
+	InspectedItemEnName		string    `gorm:"column:inspected_item_en_name" json:"inspected_item_en_name" form:"inspected_item_en_name"`
723
+	Method					string    `gorm:"column:method" json:"method" form:"method"`
724
+	InspectedItemCnName		string    `gorm:"column:inspected_item_cn_name" json:"inspected_item_cn_name" form:"inspected_item_cn_name"`
725
+	InspectedResultDesc		string    `gorm:"column:inspected_result_desc" json:"inspected_result_desc" form:"inspected_result_desc"`
726
+	InspectedResultValue	string    `gorm:"column:inspected_result_value" json:"inspected_result_value" form:"inspected_result_value"`
727
+	InspectedResultUnit		string    `gorm:"column:inspected_result_unit" json:"inspected_result_unit" form:"inspected_result_unit"`
728
+	Loinc					string    `gorm:"column:loinc" json:"loinc" form:"loinc"`
729
+	RefRange				string    `gorm:"column:ref_range" json:"ref_range" form:"ref_range"`
730
+	UnitType				string    `gorm:"column:unit_type" json:"unit_type" form:"unit_type"`
731
+	InspectedResult			int64     `gorm:"column:inspected_result" json:"inspected_result" form:"inspected_result"`
732
+	Yctssm					string    `gorm:"column:yctssm" json:"yctssm" form:"yctssm"`
733
+	Sfwjz					string    `gorm:"column:sfwjz" json:"sfwjz" form:"sfwjz"`
734
+	Sorting					int64     `gorm:"column:sorting" json:"sorting" form:"sorting"`
735
+	PrintGroup				int64     `gorm:"column:print_group" json:"print_group" form:"print_group"`
736
+	CreateTime				time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
737
+	Sjscsj					time.Time `gorm:"column:sjscsj" json:"sjscsj" form:"sjscsj"`
738
+	Mj						string    `gorm:"column:mj" json:"mj" form:"mj"`
739
+	Xgbz					int64     `gorm:"column:xgbz" json:"xgbz" form:"xgbz"`
740
+	Ylyl1					string    `gorm:"column:ylyl1" json:"ylyl1" form:"ylyl1"`
741
+	Ylyl2					string    `gorm:"column:ylyl2" json:"ylyl2" form:"ylyl2"`
742
+}
743
+
744
+func (TempHdLisIndicators) TableName() string {
745
+	return "t_hd_lis_indicators"
746
+}

File diff suppressed because it is too large
+ 929 - 157
service/city/auto_create_week_schedules_service.go


+ 494 - 165
service/city_data_uoload_service.go View File

@@ -45,6 +45,21 @@ func FindOrgPatientData(org_id int64, lastUploadTime int64, nowTime int64) (pati
45 45
 	return
46 46
 }
47 47
 
48
+func FindOrgPatientInfectious(org_id int64, lastUploadTime int64, nowTime int64) (patient []*models.Patients, err error) {
49
+	db := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? AND lapseto = 2 ", org_id).Preload("InfectiousDiseases", "status = 1")
50
+	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
51
+	err = db.Find(&patient).Error
52
+	return
53
+}
54
+
55
+func FindOrgDeviceNumber(org_id int64, lastUploadTime int64, nowTime int64) (devices []*models.DeviceNumber, err error) {
56
+	db := readDb.Model(&models.DeviceNumber{}).Where("status = 1 AND org_id = ?", org_id)
57
+	db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
58
+	err = db.Find(&devices).Error
59
+
60
+	return
61
+}
62
+
48 63
 func FindOrgPatientOutData(org_id int64, lastUploadTime int64, nowTime int64) (patient []*models.Patients, err error) {
49 64
 	db := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? AND lapseto = 2 ", org_id).Preload("PatientLapseto", "status = 1")
50 65
 	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
@@ -63,18 +78,50 @@ func FindOrgScheduleData(org_id int64, lastUploadTime int64, nowTime int64) (sch
63 78
 }
64 79
 
65 80
 func FindOrgDialysisPrescriptionData(org_id int64, lastUploadTime int64, nowTime int64) (ps []*models.DialysisPrescription, err error) {
66
-	db := readDb.Model(&models.DialysisPrescription{}).Where("status = 1 AND user_org_id = ?", org_id).Preload("AssessmentBeforeDislysis", "status = 1").Preload("DialysisOrder", "status = 1")
81
+	db := readDb.Model(&models.DialysisPrescription{}).Where("status = 1 AND user_org_id = ?", org_id).Preload("DialysisOrder", "status = 1")
67 82
 	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
68 83
 	err = db.Find(&ps).Error
69 84
 	return
70 85
 }
71 86
 
87
+func FindOrgDoctorAdviceTemplateData(org_id int64, lastUploadTime int64, nowTime int64) (advice []*models.DoctorAdviceTemplate, err error) {
88
+	db := readDb.Model(&models.DoctorAdviceTemplate{}).Where("status = 1 AND org_id = ? and advice_type = 0 ", org_id)
89
+	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
90
+	err = db.Find(&advice).Error
91
+	return
92
+}
93
+
94
+func FindAssessmentBeforeDislysis(org_id int64, patient_id int64) (before models.AssessmentBeforeDislysis, err error) {
95
+	db := readDb.Model(&models.AssessmentBeforeDislysis{}).Where("status = 1 AND user_org_id = ? and patient_id = ? ", org_id,patient_id)
96
+	err = db.Last(&before).Error
97
+	return
98
+}
99
+
72 100
 func FindOrgMonitorRecordData(org_id int64, lastUploadTime int64, nowTime int64) (monitor []*models.MonitoringRecord, err error) {
73
-	db := readDb.Model(&models.MonitoringRecord{}).Where("status = 1 AND user_org_id = ?", org_id)
101
+	db := readDb.Model(&models.MonitoringRecord{}).Where("status = 1 AND user_org_id = ?", org_id).Preload("DialysisOrder", "status = 1")
102
+	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
103
+	err = db.Find(&monitor).Error
104
+	return
105
+}
74 106
 
107
+func FindOrgMonitorRecordByLike(org_id int64, keyword string, lastUploadTime int64, nowTime int64) (monitor []*models.MonitoringRecord, err error) {
108
+	db := readDb.Model(&models.MonitoringRecord{}).Where("status = 1 AND user_org_id = ? AND symptom like ?", org_id,keyword)
75 109
 	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
76 110
 	err = db.Find(&monitor).Error
111
+	return
112
+}
113
+
114
+func FindOrgInspection(org_id int64,  lastUploadTime int64, nowTime int64) (inspection []*models.XtInspection, err error) {
115
+	db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? ", org_id).Preload("Patients", "status = 1")
116
+	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
117
+	err = db.Find(&inspection).Error
118
+	return
119
+}
77 120
 
121
+func FindOrgInspectionReference(org_id int64,  lastUploadTime int64, nowTime int64) (inspection []*models.XtInspection, err error) {
122
+	db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? ", org_id).Preload("XtInspectionReference", "status = 1")
123
+	db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
124
+	err = db.Find(&inspection).Error
78 125
 	return
79 126
 }
80 127
 
@@ -126,7 +173,7 @@ func FindOrgWaterMachineData(org_id int64, lastUploadTime int64, nowTime int64)
126 173
 
127 174
 func BatchCreateWMsRecord(wms []*sz.TempHdWm, rdb *gorm.DB) (err error) {
128 175
 	if len(wms) > 0 {
129
-		utx := rdb.Begin()
176
+		utx := rdb
130 177
 		if len(wms) > 0 {
131 178
 			thisSQL := "INSERT INTO t_hd_wm (hospital_id, equipment_id, equipment_brand, equipment_model, enable_time,discarded_time,equipment_type,xgbz,create_time,update_time,sjscsj) VALUES "
132 179
 			insertParams := make([]string, 0)
@@ -147,11 +194,12 @@ func BatchCreateWMsRecord(wms []*sz.TempHdWm, rdb *gorm.DB) (err error) {
147 194
 
148 195
 			}
149 196
 			thisSQL += strings.Join(insertParams, ", ")
150
-			err = utx.Exec(thisSQL, insertData...).Error
151
-			if err != nil {
152
-				utx.Rollback()
153
-				return
154
-			}
197
+			// err = utx.Exec(thisSQL, insertData...).Error
198
+			// if err != nil {
199
+			// 	utx.Rollback()
200
+			// 	return
201
+			// }
202
+			utx.Exec(thisSQL, insertData...)
155 203
 		}
156 204
 		utx.Commit()
157 205
 	}
@@ -160,44 +208,50 @@ func BatchCreateWMsRecord(wms []*sz.TempHdWm, rdb *gorm.DB) (err error) {
160 208
 
161 209
 func BatchCreateStaffRecord(staffs []*sz.TempHdStaff, rdb *gorm.DB) (err error) {
162 210
 	if len(staffs) > 0 {
163
-		utx := rdb.Begin()
211
+		utx := rdb
164 212
 		if len(staffs) > 0 {
165
-			thisSQL := "INSERT INTO t_hd_staff (hospital_id, staff_id, staff_name, position, permanent_type,create_time,update_time,sjscsj,mj) VALUES "
166
-			insertParams := make([]string, 0)
167
-			insertData := make([]interface{}, 0)
213
+			id_no := 429001198701091670
168 214
 			for _, info := range staffs {
169
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?)")
215
+				thisSQL := "INSERT INTO t_hd_staff (hospital_id,staff_id, id_no,id_type,staff_name,  position,  staff_status, staff_no, permanent_type, in_date ,create_time, update_time, sjscsj, xgbz) VALUES "
216
+				insertParams := make([]string, 0)
217
+				insertData := make([]interface{}, 0)
218
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
219
+
170 220
 				insertData = append(insertData, info.HospitalId)
171 221
 				insertData = append(insertData, info.StaffId)
222
+				insertData = append(insertData, id_no)
223
+				insertData = append(insertData, "01")
172 224
 				insertData = append(insertData, info.StaffName)
173 225
 				insertData = append(insertData, info.Position)
226
+				insertData = append(insertData, "0")
227
+				insertData = append(insertData, info.StaffId)
174 228
 				insertData = append(insertData, info.PermanentType)
229
+				insertData = append(insertData, "2019-09-01")
175 230
 				insertData = append(insertData, info.CreateTime)
176 231
 				insertData = append(insertData, info.UpdateTime)
177 232
 				insertData = append(insertData, info.Sjscsj)
178 233
 				insertData = append(insertData, info.Xgbz)
234
+				thisSQL += strings.Join(insertParams, ", ")
235
+				utx.Exec(thisSQL, insertData...)
236
+				id_no++
179 237
 			}
180
-			thisSQL += strings.Join(insertParams, ", ")
181
-			err = utx.Exec(thisSQL, insertData...).Error
182
-			if err != nil {
183
-				utx.Rollback()
184
-				return
185
-			}
238
+			
186 239
 		}
187
-		utx.Commit()
240
+		// utx.Commit()
188 241
 	}
189 242
 	return
190 243
 }
191 244
 
192 245
 func BatchCreatePatinet(patients []*sz.TempHdPatient, rdb *gorm.DB) (err error) {
193 246
 	if len(patients) > 0 {
194
-		utx := rdb.Begin()
247
+		utx := rdb
195 248
 		if len(patients) > 0 {
196
-			thisSQL := "INSERT INTO t_hd_patient (hospital_id, patient_nk, card_no, card_type, id_no,id_type,patient_name,gender,born_date,diagnosis_summary,is_crf,create_time,update_time,sjscsj,xgbz) VALUES "
197
-			insertParams := make([]string, 0)
198
-			insertData := make([]interface{}, 0)
249
+			
199 250
 			for _, info := range patients {
200
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
251
+				thisSQL := "INSERT INTO t_hd_patient ( hospital_id, patient_nk,  card_no,  card_type,  id_no, id_type, patient_name, gender, born_date, diagnosis_summary, is_crf, pay_method, local_insurance, dialysis_start_time, local_start_time, outpatient_no, hospitalized_no, xgbz, create_time, update_time, sjscsj) VALUES "
252
+				insertParams := make([]string, 0)
253
+				insertData := make([]interface{}, 0)
254
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
201 255
 				insertData = append(insertData, info.HospitalId)
202 256
 				insertData = append(insertData, info.PatientNk)
203 257
 				insertData = append(insertData, info.CardNo)
@@ -209,32 +263,36 @@ func BatchCreatePatinet(patients []*sz.TempHdPatient, rdb *gorm.DB) (err error)
209 263
 				insertData = append(insertData, info.BornDate)
210 264
 				insertData = append(insertData, info.DiagnosisSummary)
211 265
 				insertData = append(insertData, info.IsCrf)
266
+				insertData = append(insertData, "02")
267
+				insertData = append(insertData, "1")
268
+				insertData = append(insertData, info.DialysisStartTime)
269
+				insertData = append(insertData, info.LocalStartTime)
270
+				insertData = append(insertData, info.OutpatientNo)
271
+				insertData = append(insertData, info.HospitalizedNo)
272
+				insertData = append(insertData, info.Xgbz)
212 273
 				insertData = append(insertData, info.CreateTime)
213 274
 				insertData = append(insertData, info.UpdateTime)
214 275
 				insertData = append(insertData, info.Sjscsj)
215
-				insertData = append(insertData, info.Xgbz)
216
-
217
-			}
218
-			thisSQL += strings.Join(insertParams, ", ")
219
-			err = utx.Exec(thisSQL, insertData...).Error
220
-			if err != nil {
221
-				utx.Rollback()
222
-				return
276
+				thisSQL += strings.Join(insertParams, ", ")
277
+				utx.Exec(thisSQL, insertData...)
223 278
 			}
279
+			
280
+		
281
+			
224 282
 		}
225
-		utx.Commit()
283
+		// utx.Commit()
226 284
 	}
227 285
 	return
228 286
 }
229 287
 
230 288
 func BatchCreateSchedual(patients []*sz.TempHdShift, rdb *gorm.DB) (err error) {
231 289
 	if len(patients) > 0 {
232
-		utx := rdb.Begin()
290
+		utx := rdb
233 291
 		if len(patients) > 0 {
234
-			thisSQL := "INSERT INTO t_hd_shift (ps_id, hospital_id, patient_nk, schedule_date, shift_type,sickbed_no,schedule_status,create_time,sjscsj,xgbz) VALUES "
235
-			insertParams := make([]string, 0)
236
-			insertData := make([]interface{}, 0)
237 292
 			for _, info := range patients {
293
+				thisSQL := "INSERT INTO t_hd_shift (ps_id, hospital_id, patient_nk, schedule_date, shift_type,sickbed_no,schedule_status,create_time,sjscsj,xgbz) VALUES "
294
+				insertParams := make([]string, 0)
295
+				insertData := make([]interface{}, 0)
238 296
 				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
239 297
 				insertData = append(insertData, info.PsId)
240 298
 				insertData = append(insertData, info.HospitalId)
@@ -246,102 +304,100 @@ func BatchCreateSchedual(patients []*sz.TempHdShift, rdb *gorm.DB) (err error) {
246 304
 				insertData = append(insertData, info.CreateTime)
247 305
 				insertData = append(insertData, info.Sjscsj)
248 306
 				insertData = append(insertData, info.Xgbz)
249
-
250
-			}
251
-			thisSQL += strings.Join(insertParams, ", ")
252
-			err = utx.Exec(thisSQL, insertData...).Error
253
-			if err != nil {
254
-				utx.Rollback()
255
-				return
307
+				thisSQL += strings.Join(insertParams, ", ")
308
+				utx.Exec(thisSQL, insertData...)
256 309
 			}
310
+		
311
+			
257 312
 		}
258
-		utx.Commit()
313
+		// utx.Commit()
259 314
 	}
260 315
 	return
261 316
 }
262 317
 
263 318
 func BatchCreatePs(patients []*sz.TempHdPs, rdb *gorm.DB) (err error) {
264 319
 	if len(patients) > 0 {
265
-		utx := rdb.Begin()
320
+		utx := rdb
266 321
 		if len(patients) > 0 {
267
-			thisSQL := "INSERT INTO t_hd_ps (PRESCRIBE_ID, HOSPITAL_ID, PATIENT_NK, K, CA,NA,DIALYSIS_FREQUENCY,FREQUENCY_UNIT,DIALYSIS_DURATION,HDF,HP,HP_FREQUENCY,HP_FREQUENCY_UNIT,HP_DURATION,HDF_FREQUENCY_UNIT,HDF_FREQUENCY,HDF_DURATION,CREATE_TIME,SJSCSJ,XGBZ) VALUES "
322
+			thisSQL := "INSERT INTO t_hd_ps (prescribe_id,hospital_id,patient_nk,rrt_type,rrt_type_name,dialysis_frequency,frequency_unit,prescribe_time,create_time,sjscsj,xgbz) VALUES "
268 323
 			insertParams := make([]string, 0)
269 324
 			insertData := make([]interface{}, 0)
270 325
 			for _, info := range patients {
271
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
326
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
272 327
 				insertData = append(insertData, info.PrescribeId)
273 328
 				insertData = append(insertData, info.HospitalId)
274 329
 				insertData = append(insertData, info.PatientNk)
275
-				insertData = append(insertData, info.K)
276
-				insertData = append(insertData, info.Ca)
277
-				insertData = append(insertData, info.Na)
330
+				insertData = append(insertData, info.RrtType)
331
+				insertData = append(insertData, info.RrtTypeName)
278 332
 				insertData = append(insertData, info.DialysisFrequency)
279 333
 				insertData = append(insertData, info.FrequencyUnit)
280
-				insertData = append(insertData, info.DialysisDuration)
281
-				insertData = append(insertData, info.Hdf)
282
-				insertData = append(insertData, info.Hp)
283
-				insertData = append(insertData, info.HpFrequency)
284
-				insertData = append(insertData, info.HpFrequencyUnit)
285
-				insertData = append(insertData, info.HpDuration)
286
-				insertData = append(insertData, info.HdfFrequencyUnit)
287
-				insertData = append(insertData, info.HdfFrequency)
288
-				insertData = append(insertData, info.HdfDuration)
334
+				insertData = append(insertData, info.PrescribeTime)
289 335
 				insertData = append(insertData, info.CreateTime)
290 336
 				insertData = append(insertData, info.Sjscsj)
291 337
 				insertData = append(insertData, info.Xgbz)
292 338
 
339
+
293 340
 			}
294 341
 			thisSQL += strings.Join(insertParams, ", ")
295
-			err = utx.Exec(thisSQL, insertData...).Error
296
-			if err != nil {
297
-				utx.Rollback()
298
-				return
299
-			}
342
+			// err = utx.Exec(thisSQL, insertData...).Error
343
+			// if err != nil {
344
+			// 	utx.Rollback()
345
+			// 	return
346
+			// }
347
+			utx.Exec(thisSQL, insertData...)
300 348
 		}
301
-		utx.Commit()
349
+		// utx.Commit()
302 350
 	}
303 351
 	return
304 352
 }
305 353
 
354
+func BatchCreatePsOther(ps *sz.TempHdPs, rdb *gorm.DB)(err error){
355
+	err = rdb.Create(&ps).Error
356
+	return err
357
+}
358
+
306 359
 func BatchCreatePsm(psms []*sz.TempHdPsMedicine, rdb *gorm.DB) (err error) {
307 360
 	if len(psms) > 0 {
308
-		utx := rdb.Begin()
361
+		utx := rdb
309 362
 		if len(psms) > 0 {
310
-			thisSQL := "INSERT INTO t_hd_ps_medicine (PRESCRIBE_ID, HOSPITAL_ID, MEDICINE_TYPE_ID,MEDICINE_ID,CREATE_TIME,SJSCSJ,XGBZ) VALUES "
311
-			insertParams := make([]string, 0)
312
-			insertData := make([]interface{}, 0)
363
+			
313 364
 			for _, psm := range psms {
365
+				thisSQL := "INSERT INTO t_hd_ps_medicine (hospital_id, medicine_type_id,medicine_id,create_time,sjscsj,xgbz,sn) VALUES "
366
+				insertParams := make([]string, 0)
367
+				insertData := make([]interface{}, 0)
314 368
 				insertParams = append(insertParams, "(?,?,?,?,?,?,?)")
315
-				insertData = append(insertData, psm.PrescribeId)
316 369
 				insertData = append(insertData, psm.HospitalId)
317 370
 				insertData = append(insertData, psm.MedicineTypeId)
318 371
 				insertData = append(insertData, psm.MedicineId)
319 372
 				insertData = append(insertData, psm.CreateTime)
320 373
 				insertData = append(insertData, psm.Sjscsj)
321 374
 				insertData = append(insertData, psm.Xgbz)
322
-
323
-			}
324
-			thisSQL += strings.Join(insertParams, ", ")
325
-			err = utx.Exec(thisSQL, insertData...).Error
326
-			if err != nil {
327
-				utx.Rollback()
328
-				return
375
+				insertData = append(insertData, psm.Sn)
376
+				thisSQL += strings.Join(insertParams, ", ")
377
+				// err = utx.Exec(thisSQL, insertData...).Error
378
+				 utx.Exec(thisSQL, insertData...)
329 379
 			}
380
+			
381
+			// if err != nil {
382
+			// 	utx.Rollback()
383
+			// 	return
384
+			// }
330 385
 		}
331
-		utx.Commit()
386
+		// utx.Commit()
332 387
 	}
333 388
 	return
334 389
 }
335 390
 
336 391
 func BatchCreateDialysis(psms []*sz.TempHdDialysis, rdb *gorm.DB) (err error) {
337 392
 	if len(psms) > 0 {
338
-		utx := rdb.Begin()
393
+		utx := rdb
339 394
 		if len(psms) > 0 {
340
-			thisSQL := "INSERT INTO t_hd_dialysis (DIALYSIS_ID, HOSPITAL_ID, PATIENT_NK,PS_ID,DIALYSIS_DATE,SICKBED_NO,DIVISION_ID,EQUIPMENT_ID,ACTUALUF_ML,UFV,TOTAL_REPLACE,TOTAL_TREAT_DURATION,BEFORE_SBP,BEFORE_DBP,AFTER_SBP,AFTER_DBP,START_TIME,END_TIME,CREATE_TIME,SJSCSJ,XGBZ) VALUES "
341
-			insertParams := make([]string, 0)
342
-			insertData := make([]interface{}, 0)
395
+			
343 396
 			for _, psm := range psms {
344
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
397
+				thisSQL := "INSERT INTO t_hd_dialysis (dialysis_id,hospital_id,patient_nk,ps_id,dialysis_date,sickbed_no,division_id,equipment_id,mix_dialysis,ufv,total_treat_duration,is_hospitalization,is_emergency,is_perioperative_period,before_sbp,before_dbp,after_sbp,after_dbp,before_weight,after_weight,up_nurse_id,down_nurse_id,check_nurse_id,puncture_nurse_id,start_time,end_time,create_time,sjscsj,xgbz) VALUES "
398
+				insertParams := make([]string, 0)
399
+				insertData := make([]interface{}, 0)
400
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
345 401
 				insertData = append(insertData, psm.DialysisId)
346 402
 				insertData = append(insertData, psm.HospitalId)
347 403
 				insertData = append(insertData, psm.PatientNk)
@@ -350,72 +406,84 @@ func BatchCreateDialysis(psms []*sz.TempHdDialysis, rdb *gorm.DB) (err error) {
350 406
 				insertData = append(insertData, psm.SickbedNo)
351 407
 				insertData = append(insertData, psm.DivisionId)
352 408
 				insertData = append(insertData, psm.EquipmentId)
353
-				insertData = append(insertData, psm.ActualufMl)
409
+				insertData = append(insertData, psm.MixDialysis)
354 410
 				insertData = append(insertData, psm.Ufv)
355
-				insertData = append(insertData, psm.TotalReplace)
356 411
 				insertData = append(insertData, psm.TotalTreatDuration)
412
+				insertData = append(insertData, psm.IsHospitalization)
413
+				insertData = append(insertData, psm.IsEmergency)
414
+				insertData = append(insertData, psm.IsPerioperativePeriod)
357 415
 				insertData = append(insertData, psm.BeforeSbp)
358 416
 				insertData = append(insertData, psm.BeforeDbp)
359 417
 				insertData = append(insertData, psm.AfterSbp)
360 418
 				insertData = append(insertData, psm.AfterDbp)
419
+				insertData = append(insertData, psm.BeforeWeight)
420
+				insertData = append(insertData, psm.AfterWeight)
421
+				insertData = append(insertData, psm.UpNurseId)
422
+				insertData = append(insertData, psm.DownNurseId)
423
+				insertData = append(insertData, psm.CheckNurseId)
424
+				insertData = append(insertData, psm.PunctureNurseId)
361 425
 				insertData = append(insertData, psm.StartTime)
362 426
 				insertData = append(insertData, psm.EndTime)
363 427
 				insertData = append(insertData, psm.CreateTime)
364 428
 				insertData = append(insertData, psm.Sjscsj)
365 429
 				insertData = append(insertData, psm.Xgbz)
430
+				thisSQL += strings.Join(insertParams, ", ")
431
+				utx.Exec(thisSQL, insertData...)
366 432
 
367 433
 			}
368
-			thisSQL += strings.Join(insertParams, ", ")
369
-			err = utx.Exec(thisSQL, insertData...).Error
370
-			if err != nil {
371
-				utx.Rollback()
372
-				return
373
-			}
434
+		
435
+			// if err != nil {
436
+			// 	utx.Rollback()
437
+			// 	return
438
+			// }
374 439
 		}
375
-		utx.Commit()
440
+		// utx.Commit()
376 441
 	}
377 442
 	return
378 443
 }
379 444
 
380 445
 func BatchCreatePatientOut(patientOuts []*sz.TempHdPatientOut, rdb *gorm.DB) (err error) {
381 446
 	if len(patientOuts) > 0 {
382
-		utx := rdb.Begin()
447
+		utx := rdb
383 448
 		if len(patientOuts) > 0 {
384
-			thisSQL := "INSERT INTO t_hd_patient_out (HOSPITAL_ID, PATIENT_NK,SEQUELAE_DATE,SEQUELAE_TYPE,CREATE_TIME,SJSCSJ,XGBZ) VALUES "
449
+			thisSQL := "INSERT INTO t_hd_patient_quit (sn,hospital_id,patient_nk,sequelae_date,sequelae_type,create_time,death_reason,ext_reason,sjscsj,xgbz) VALUES "
385 450
 			insertParams := make([]string, 0)
386 451
 			insertData := make([]interface{}, 0)
387 452
 			for _, out := range patientOuts {
388
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?)")
453
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
454
+				insertData = append(insertData, out.Sn)
389 455
 				insertData = append(insertData, out.HospitalId)
390 456
 				insertData = append(insertData, out.PatientNk)
391 457
 				insertData = append(insertData, out.SequelaeDate)
392 458
 				insertData = append(insertData, out.SequelaeType)
393 459
 				insertData = append(insertData, out.CreateTime)
460
+				insertData = append(insertData, out.DeathReason)
461
+				insertData = append(insertData, out.ExtReason)
394 462
 				insertData = append(insertData, out.Sjscsj)
395 463
 				insertData = append(insertData, out.Xgbz)
396 464
 
397 465
 			}
398 466
 			thisSQL += strings.Join(insertParams, ", ")
399
-			err = utx.Exec(thisSQL, insertData...).Error
400
-			if err != nil {
401
-				utx.Rollback()
402
-				return
403
-			}
467
+			 utx.Exec(thisSQL, insertData...)
468
+			// if err != nil {
469
+			// 	utx.Rollback()
470
+			// 	return
471
+			// }
404 472
 		}
405
-		utx.Commit()
473
+		// utx.Commit()
406 474
 	}
407 475
 	return
408 476
 }
409 477
 
410 478
 func BatchCreateDoctorsAdvice(advices []*sz.TempHdDoctorsAdvice, rdb *gorm.DB) (err error) {
411 479
 	if len(advices) > 0 {
412
-		utx := rdb.Begin()
480
+		utx := rdb
413 481
 		if len(advices) > 0 {
414
-			thisSQL := "INSERT INTO t_hd_doctors_advice (medical_order_id, hospital_id,dialysis_id,order_type,patient_nk,dialysis_duration,blood_vol,create_time,sjscsj,xgbz) VALUES "
415
-			insertParams := make([]string, 0)
416
-			insertData := make([]interface{}, 0)
417 482
 			for _, advice := range advices {
418
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
483
+				thisSQL := "INSERT INTO t_hd_doctors_advice (medical_order_id, hospital_id,dialysis_id,order_type,patient_nk,dialysis_duration,blood_vol,anticoagulant,create_time,sjscsj,xgbz,rrt_type,rrt_type_name,dry_weight) VALUES "
484
+				insertParams := make([]string, 0)
485
+				insertData := make([]interface{}, 0)
486
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
419 487
 				insertData = append(insertData, advice.MedicalOrderId)
420 488
 				insertData = append(insertData, advice.HospitalId)
421 489
 				insertData = append(insertData, advice.DialysisId)
@@ -423,32 +491,37 @@ func BatchCreateDoctorsAdvice(advices []*sz.TempHdDoctorsAdvice, rdb *gorm.DB) (
423 491
 				insertData = append(insertData, advice.PatientNk)
424 492
 				insertData = append(insertData, advice.DialysisDuration)
425 493
 				insertData = append(insertData, advice.BloodVol)
494
+				insertData = append(insertData, advice.Anticoagulant)
426 495
 				insertData = append(insertData, advice.CreateTime)
427 496
 				insertData = append(insertData, advice.Sjscsj)
428 497
 				insertData = append(insertData, advice.Xgbz)
429
-
430
-			}
431
-			thisSQL += strings.Join(insertParams, ", ")
432
-			err = utx.Exec(thisSQL, insertData...).Error
433
-			if err != nil {
434
-				utx.Rollback()
435
-				return
498
+				insertData = append(insertData, advice.RrtType)
499
+				insertData = append(insertData, advice.RrtTypeName)
500
+				insertData = append(insertData, advice.DryWeight)
501
+				thisSQL += strings.Join(insertParams, ", ")
502
+			 	utx.Exec(thisSQL, insertData...)
436 503
 			}
504
+			// if err != nil {
505
+			// 	utx.Rollback()
506
+			// 	return
507
+			// }
437 508
 		}
438
-		utx.Commit()
509
+		// utx.Commit()
439 510
 	}
440 511
 	return
441 512
 }
442 513
 
443 514
 func BatchCreateMonitor(advices []*sz.TempHdMiddle, rdb *gorm.DB) (err error) {
444 515
 	if len(advices) > 0 {
445
-		utx := rdb.Begin()
516
+		utx := rdb
446 517
 		if len(advices) > 0 {
447
-			thisSQL := "INSERT INTO t_hd_middle (hospital_id, patient_nk,dialysis_id,monitor_time,sbp,dbp,create_time,sjscsj,xgbz) VALUES "
448
-			insertParams := make([]string, 0)
449
-			insertData := make([]interface{}, 0)
518
+			
450 519
 			for _, advice := range advices {
451
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?)")
520
+				thisSQL := "INSERT INTO t_hd_middle (sn,hospital_id, patient_nk,dialysis_id,monitor_time,sbp,dbp,create_time,sjscsj,xgbz) VALUES "
521
+				insertParams := make([]string, 0)
522
+				insertData := make([]interface{}, 0)
523
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
524
+				insertData = append(insertData, advice.Sn)
452 525
 				insertData = append(insertData, advice.HospitalId)
453 526
 				insertData = append(insertData, advice.PatientNk)
454 527
 				insertData = append(insertData, advice.DialysisId)
@@ -458,15 +531,16 @@ func BatchCreateMonitor(advices []*sz.TempHdMiddle, rdb *gorm.DB) (err error) {
458 531
 				insertData = append(insertData, advice.CreateTime)
459 532
 				insertData = append(insertData, advice.Sjscsj)
460 533
 				insertData = append(insertData, advice.Xgbz)
534
+				thisSQL += strings.Join(insertParams, ", ")
535
+				utx.Exec(thisSQL, insertData...)
461 536
 			}
462
-			thisSQL += strings.Join(insertParams, ", ")
463
-			err = utx.Exec(thisSQL, insertData...).Error
464
-			if err != nil {
465
-				utx.Rollback()
466
-				return
467
-			}
537
+			
538
+			// if err != nil {
539
+			// 	utx.Rollback()
540
+			// 	return
541
+			// }
468 542
 		}
469
-		utx.Commit()
543
+		// utx.Commit()
470 544
 	}
471 545
 	return
472 546
 }
@@ -491,40 +565,38 @@ func FindOrgMachineRepairData(org_id int64, lastUploadTime int64, nowTime int64)
491 565
 
492 566
 func BatchCreateOtherMachineRecord(wms []*sz.TempHdOtherMachine, rdb *gorm.DB) (err error) {
493 567
 	if len(wms) > 0 {
494
-		utx := rdb.Begin()
568
+		utx := rdb
495 569
 		if len(wms) > 0 {
496
-			thisSQL := "INSERT INTO t_hd_other_machine (hospital_id, equipment_id, equipment_brand, equipment_model, enable_time,discarded_time,xgbz,create_time,update_time,sjscsj) VALUES "
497
-			insertParams := make([]string, 0)
498
-			insertData := make([]interface{}, 0)
570
+			
499 571
 			for _, wm := range wms {
500
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
572
+				thisSQL := "INSERT INTO t_hd_other_machine (hospital_id, equipment_id, equipment_brand, equipment_model, enable_time,status,equipment_type,xgbz,create_time,update_time,sjscsj) VALUES "
573
+				insertParams := make([]string, 0)
574
+				insertData := make([]interface{}, 0)
575
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
501 576
 				insertData = append(insertData, wm.HospitalId)
502 577
 				insertData = append(insertData, wm.EquipmentId)
503
-				insertData = append(insertData, wm.EquipmentType)
578
+				insertData = append(insertData, wm.EquipmentBrand)
504 579
 				insertData = append(insertData, wm.EquipmentModel)
505 580
 				insertData = append(insertData, wm.EnableTime)
506
-				insertData = append(insertData, wm.DiscardedTime)
581
+				insertData = append(insertData, wm.Status)
582
+				insertData = append(insertData, wm.EquipmentType)
507 583
 				insertData = append(insertData, wm.Xgbz)
508 584
 				insertData = append(insertData, wm.CreateTime)
509 585
 				insertData = append(insertData, wm.UpdateTime)
510 586
 				insertData = append(insertData, wm.Sjscsj)
511
-
512
-			}
513
-			thisSQL += strings.Join(insertParams, ", ")
514
-			err = utx.Exec(thisSQL, insertData...).Error
515
-			if err != nil {
516
-				utx.Rollback()
517
-				return
587
+				thisSQL += strings.Join(insertParams, ", ")
588
+				utx.Exec(thisSQL, insertData...)
518 589
 			}
590
+			
519 591
 		}
520
-		utx.Commit()
592
+		// utx.Commit()
521 593
 	}
522 594
 	return
523 595
 }
524 596
 
525 597
 func BatchCreateMainTain(maintain []*sz.TempHdMaintain, rdb *gorm.DB) (err error) {
526 598
 	if len(maintain) > 0 {
527
-		utx := rdb.Begin()
599
+		utx := rdb
528 600
 		if len(maintain) > 0 {
529 601
 			thisSQL := "INSERT INTO t_hd_maintain (hospital_id, equipment_id, equipment_type, repair_time, xgbz,create_time,sjscsj) VALUES "
530 602
 			insertParams := make([]string, 0)
@@ -540,20 +612,21 @@ func BatchCreateMainTain(maintain []*sz.TempHdMaintain, rdb *gorm.DB) (err error
540 612
 				insertData = append(insertData, wm.Sjscsj)
541 613
 			}
542 614
 			thisSQL += strings.Join(insertParams, ", ")
543
-			err = utx.Exec(thisSQL, insertData...).Error
544
-			if err != nil {
545
-				utx.Rollback()
546
-				return
547
-			}
615
+		 	utx.Exec(thisSQL, insertData...)
616
+			// if err != nil {
617
+			// 	utx.Rollback()
618
+			// 	return
619
+			// }
548 620
 		}
549
-		utx.Commit()
621
+		// utx.Commit()
550 622
 	}
551 623
 	return
552 624
 }
553 625
 
554 626
 func FindOrgMachineData(org_id int64, lastUploadTime int64, nowTime int64) (waterMachine []*models.VMDeviceAddmacher, err error) {
555
-
556
-	db := readUserDb.Model(&models.VMDeviceAddmacher{}).Where("status = 1 AND  user_org_id = ?", org_id).Preload("DeviceNumber", "status = 1")
627
+	db := readUserDb.Model(&models.VMDeviceAddmacher{}).Where("status = 1 AND  user_org_id = ?", org_id).Preload("DeviceNumber",func(db *gorm.DB) *gorm.DB {
628
+		return readDb.Model(&models.DeviceNumber{}).Where("status = 1")
629
+	   } )
557 630
 
558 631
 	db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
559 632
 
@@ -564,37 +637,293 @@ func FindOrgMachineData(org_id int64, lastUploadTime int64, nowTime int64) (wate
564 637
 
565 638
 func BatchCreateHDMRecord(wms []*sz.TempHdDm, rdb *gorm.DB) (err error) {
566 639
 	if len(wms) > 0 {
567
-		utx := rdb.Begin()
640
+		utx := rdb
568 641
 		if len(wms) > 0 {
569
-			thisSQL := "INSERT INTO t_hd_dm (hospital_id, equipment_id,sickbed_no, equipment_brand, equipment_model, enable_time,discarded_time,status,equipment_type, xgbz,create_time,update_time,sjscsj) VALUES "
642
+			
643
+			for _, wm := range wms {
644
+				thisSQL := "INSERT INTO t_hd_dm (hospital_id, equipment_id,sickbed_no,sickbed_type ,equipment_brand, equipment_model, enable_time,status,equipment_type, xgbz,bbp,create_time,update_time,sjscsj) VALUES "
570 645
 			insertParams := make([]string, 0)
571 646
 			insertData := make([]interface{}, 0)
572
-			for _, wm := range wms {
573
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?)")
647
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
574 648
 				insertData = append(insertData, wm.HospitalId)
575 649
 				insertData = append(insertData, wm.EquipmentId)
576 650
 				insertData = append(insertData, wm.SickbedNo)
651
+				insertData = append(insertData, wm.SickbedType)
577 652
 				insertData = append(insertData, wm.EquipmentBrand)
578 653
 				insertData = append(insertData, wm.EquipmentModel)
579 654
 				insertData = append(insertData, wm.EnableTime)
580
-				insertData = append(insertData, wm.DiscardedTime)
581 655
 				insertData = append(insertData, wm.Status)
582 656
 				insertData = append(insertData, wm.EquipmentType)
583
-
584 657
 				insertData = append(insertData, wm.Xgbz)
658
+				insertData = append(insertData, wm.Bbp)
585 659
 				insertData = append(insertData, wm.CreateTime)
586 660
 				insertData = append(insertData, wm.UpdateTime)
587 661
 				insertData = append(insertData, wm.Sjscsj)
588
-
662
+		
663
+				thisSQL += strings.Join(insertParams, ", ")
664
+		 utx.Exec(thisSQL, insertData...)
589 665
 			}
590
-			thisSQL += strings.Join(insertParams, ", ")
591
-			err = utx.Exec(thisSQL, insertData...).Error
592
-			if err != nil {
593
-				utx.Rollback()
594
-				return
666
+			
667
+			// if err != nil {
668
+			// 	utx.Rollback()
669
+			// 	return
670
+			// }
671
+		}
672
+		// utx.Commit()
673
+	}
674
+	return
675
+}
676
+
677
+
678
+func CreateHDDivision(wms []*sz.TempHdDivision, rdb *gorm.DB) (err error) {
679
+	if len(wms) > 0 {
680
+		utx := rdb
681
+		if len(wms) > 0 {
682
+			for _, wm := range wms {
683
+				thisSQL := "INSERT INTO t_hd_division (division_id,hospital_id, division_name,division_type, xgbz,create_time,update_time,sjscsj) VALUES "
684
+				insertParams := make([]string, 0)
685
+				insertData := make([]interface{}, 0)
686
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?)")
687
+				insertData = append(insertData, wm.DivisionId)
688
+				insertData = append(insertData, wm.HospitalId)
689
+				insertData = append(insertData, wm.DivisionName)
690
+				insertData = append(insertData, wm.DivisionType)
691
+				insertData = append(insertData, wm.Xgbz)
692
+				insertData = append(insertData, wm.CreateTime)
693
+				insertData = append(insertData, wm.UpdateTime)
694
+				insertData = append(insertData, wm.Sjscsj)
695
+		
696
+				thisSQL += strings.Join(insertParams, ", ")
697
+		 		utx.Exec(thisSQL, insertData...)
595 698
 			}
699
+			
700
+		}
701
+	}
702
+	return
703
+}
704
+
705
+func CreateAccess(wms []*sz.TempHdAccess, rdb *gorm.DB) (err error) {
706
+	if len(wms) > 0 {
707
+		utx := rdb
708
+		if len(wms) > 0 {
709
+			for _, wm := range wms {
710
+				thisSQL := "INSERT INTO t_hd_access (access_id,hospital_id,patient_nk,access_type,access_type_name,access_status,setup_date,first_use_time,xgbz,create_time,update_time,sjscsj) VALUES "
711
+				insertParams := make([]string, 0)
712
+				insertData := make([]interface{}, 0)
713
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?)")
714
+				insertData = append(insertData, wm.AccessId)
715
+				insertData = append(insertData, wm.HospitalId)
716
+				insertData = append(insertData, wm.PatientNk)
717
+				insertData = append(insertData, wm.AccessType)
718
+				insertData = append(insertData, wm.AccessTypeName)
719
+				insertData = append(insertData, wm.AccessStatus)
720
+				insertData = append(insertData, wm.SetupDate)
721
+				insertData = append(insertData, wm.FirstUseTime)
722
+				insertData = append(insertData, wm.Xgbz)
723
+				insertData = append(insertData, wm.CreateTime)
724
+				insertData = append(insertData, wm.UpdateTime)
725
+				insertData = append(insertData, wm.Sjscsj)
726
+				thisSQL += strings.Join(insertParams, ", ")
727
+		 		utx.Exec(thisSQL, insertData...)
728
+			}	
729
+		}
730
+	}
731
+	return
732
+}
733
+
734
+func CreateSickbed(wms []*sz.TempHdSickbed, rdb *gorm.DB) (err error) {
735
+	if len(wms) > 0 {
736
+		utx := rdb
737
+		if len(wms) > 0 {
738
+			for _, wm := range wms {
739
+				thisSQL := "INSERT INTO t_hd_sickbed (sickbed_no,hospital_id,division_id,sickbed_code,sickbed_type,xgbz,create_time,update_time,sjscsj) VALUES "
740
+				insertParams := make([]string, 0)
741
+				insertData := make([]interface{}, 0)
742
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?)")
743
+				insertData = append(insertData, wm.SickbedNo)
744
+				insertData = append(insertData, wm.HospitalId)
745
+				insertData = append(insertData, wm.DivisionId)
746
+				insertData = append(insertData, wm.SickbedCode)
747
+				insertData = append(insertData, wm.SickbedType)
748
+				insertData = append(insertData, wm.Xgbz)
749
+				insertData = append(insertData, wm.CreateTime)
750
+				insertData = append(insertData, wm.UpdateTime)
751
+				insertData = append(insertData, wm.Sjscsj)
752
+				thisSQL += strings.Join(insertParams, ", ")
753
+		 		utx.Exec(thisSQL, insertData...)
754
+			}	
755
+		}
756
+	}
757
+	return
758
+}
759
+
760
+func CreateDiagnosis(wms []*sz.TempHdDiagnosis, rdb *gorm.DB) (err error) {
761
+	if len(wms) > 0 {
762
+		utx := rdb
763
+		if len(wms) > 0 {
764
+			for _, wm := range wms {
765
+				thisSQL := "INSERT INTO t_hd_diagnosis (diagnosis_id,hospital_id,patient_nk,diagnosis_time,diagnosis_type,diagnosis_type_item,diagnosis_type_detail,xgbz,create_time,update_time,sjscsj) VALUES "
766
+				insertParams := make([]string, 0)
767
+				insertData := make([]interface{}, 0)
768
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
769
+				insertData = append(insertData, wm.DiagnosisId)
770
+				insertData = append(insertData, wm.HospitalId)
771
+				insertData = append(insertData, wm.PatientNk)
772
+				insertData = append(insertData, wm.DiagnosisTime)
773
+				insertData = append(insertData, wm.DiagnosisType)
774
+				insertData = append(insertData, wm.DiagnosisTypeItem)
775
+				insertData = append(insertData, wm.DiagnosisTypeDetail)
776
+				insertData = append(insertData, wm.Xgbz)
777
+				insertData = append(insertData, wm.CreateTime)
778
+				insertData = append(insertData, wm.UpdateTime)
779
+				insertData = append(insertData, wm.Sjscsj)
780
+				thisSQL += strings.Join(insertParams, ", ")
781
+		 		utx.Exec(thisSQL, insertData...)
782
+			}	
783
+		}
784
+	}
785
+	return
786
+}
787
+
788
+
789
+func CreateInfection(wms []*sz.TempHdInfection, rdb *gorm.DB) (err error) {
790
+	if len(wms) > 0 {
791
+		utx := rdb
792
+		if len(wms) > 0 {
793
+			for _, wm := range wms {
794
+				thisSQL := "INSERT INTO t_hd_infection (sn,hospital_id,patient_nk,hbv,hcv,rpr,hiv,hbsag,hbsab,hbeag,hbeab,hbcab,check_date,doctor_id,xgbz,create_time,sjscsj) VALUES "
795
+				insertParams := make([]string, 0)
796
+				insertData := make([]interface{}, 0)
797
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
798
+				insertData = append(insertData, wm.Sn)
799
+				insertData = append(insertData, wm.HospitalId)
800
+				insertData = append(insertData, wm.PatientNk)
801
+				insertData = append(insertData, wm.Hbv)
802
+				insertData = append(insertData, wm.Hcv)
803
+				insertData = append(insertData, wm.Rpr)
804
+				insertData = append(insertData, wm.Hiv)
805
+				insertData = append(insertData, wm.Hbsag)
806
+				insertData = append(insertData, wm.Hbsab)
807
+				insertData = append(insertData, wm.Hbeag)
808
+				insertData = append(insertData, wm.Hbeab)
809
+				insertData = append(insertData, wm.Hbcab)
810
+				insertData = append(insertData, wm.CheckDate)
811
+				insertData = append(insertData, wm.DoctorId)
812
+				insertData = append(insertData, wm.Xgbz)
813
+				insertData = append(insertData, wm.CreateTime)
814
+				insertData = append(insertData, wm.Sjscsj)
815
+				thisSQL += strings.Join(insertParams, ", ")
816
+		 		utx.Exec(thisSQL, insertData...)
817
+			}	
818
+		}
819
+	}
820
+	return
821
+}
822
+
823
+func CreateComplication(wms []*sz.TempHdComplication, rdb *gorm.DB) (err error) {
824
+	if len(wms) > 0 {
825
+		utx := rdb
826
+		if len(wms) > 0 {
827
+			for _, wm := range wms {
828
+				thisSQL := "INSERT INTO t_hd_complication (sn,hospital_id,patient_nk,dialysis_id,monitor_id,neopathy_time,neopathy_type,neopathy_desc,xgbz,create_time,sjscsj) VALUES "
829
+				insertParams := make([]string, 0)
830
+				insertData := make([]interface{}, 0)
831
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
832
+				insertData = append(insertData, wm.Sn)
833
+				insertData = append(insertData, wm.HospitalId)
834
+				insertData = append(insertData, wm.PatientNk)
835
+				insertData = append(insertData, wm.DialysisId)
836
+				insertData = append(insertData, wm.MonitorId)
837
+				insertData = append(insertData, wm.NeopathyTime)
838
+				insertData = append(insertData, wm.NeopathyType)
839
+				insertData = append(insertData, wm.NeopathyDesc)
840
+				insertData = append(insertData, wm.Xgbz)
841
+				insertData = append(insertData, wm.CreateTime)
842
+				insertData = append(insertData, wm.Sjscsj)
843
+				thisSQL += strings.Join(insertParams, ", ")
844
+		 		utx.Exec(thisSQL, insertData...)
845
+			}	
596 846
 		}
597
-		utx.Commit()
598 847
 	}
599 848
 	return
600 849
 }
850
+
851
+func CreateLisReport(wms []*sz.TempHdLisReport, rdb *gorm.DB) (err error) {
852
+	if len(wms) > 0 {
853
+		utx := rdb
854
+		if len(wms) > 0 {
855
+			for _, wm := range wms {
856
+				thisSQL := "INSERT INTO t_hd_lis_report (lab_sno,hospital_id,patient_nk,report_date,check_date,jz_no,mz_flag,zy_no,mz_no,department_code,department_name,card_no,card_type,patient_name,dep_code,dep_name,inspected_type,report_categry,application_name,application_type,check_name,check_item_name,check_item_code,record_ccount,check_result,diagnose_name,xgbz,create_time,sjscsj) VALUES "
857
+				insertParams := make([]string, 0)
858
+				insertData := make([]interface{}, 0)
859
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
860
+				insertData = append(insertData, wm.LabSno)
861
+				insertData = append(insertData, wm.HospitalId)
862
+				insertData = append(insertData, wm.PatientNk)
863
+				insertData = append(insertData, wm.ReportDate)
864
+				insertData = append(insertData, wm.CheckDate)
865
+				insertData = append(insertData, wm.JzNo)
866
+				insertData = append(insertData, wm.MzFlag)
867
+				insertData = append(insertData, wm.ZyNo)
868
+				insertData = append(insertData, wm.MzNo)
869
+				insertData = append(insertData, wm.DepartmentCode)
870
+				insertData = append(insertData, wm.DepartmentName)
871
+				insertData = append(insertData, wm.CardNo)
872
+				insertData = append(insertData, wm.CardType)
873
+				insertData = append(insertData, wm.PatientName)
874
+				insertData = append(insertData, wm.DepCode)
875
+				insertData = append(insertData, wm.DepName)
876
+				insertData = append(insertData, wm.InspectedType)
877
+				insertData = append(insertData, wm.ReportCategry)
878
+				insertData = append(insertData, wm.ApplicationName)
879
+				insertData = append(insertData, wm.ApplicationType)
880
+				insertData = append(insertData, wm.CheckName)
881
+				insertData = append(insertData, wm.CheckItemName)
882
+				insertData = append(insertData, wm.CheckItemCode)
883
+				insertData = append(insertData, wm.RecordCcount)
884
+				insertData = append(insertData, wm.CheckResult)
885
+				insertData = append(insertData, wm.DiagnoseName)
886
+				insertData = append(insertData, wm.Xgbz)
887
+				insertData = append(insertData, wm.CreateTime)
888
+				insertData = append(insertData, wm.Sjscsj)
889
+				thisSQL += strings.Join(insertParams, ", ")
890
+		 		utx.Exec(thisSQL, insertData...)
891
+			}	
892
+		}
893
+	}
894
+	return
895
+}
896
+
897
+func CreateLisIndicators(wms []*sz.TempHdLisIndicators, rdb *gorm.DB) (err error) {
898
+	if len(wms) > 0 {
899
+		utx := rdb
900
+		if len(wms) > 0 {
901
+			for _, wm := range wms {
902
+				thisSQL := "INSERT INTO t_hd_lis_indicators (inspected_result_no,hospital_id,lab_sno,report_date,check_date,inspected_indicate,inspected_item_en_name,inspected_item_cn_name,inspected_result_desc,inspected_result_value,inspected_result_unit,ref_range,unit_type,inspected_result,xgbz,create_time,sjscsj) VALUES "
903
+				insertParams := make([]string, 0)
904
+				insertData := make([]interface{}, 0)
905
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
906
+				insertData = append(insertData, wm.InspectedResultNo)
907
+				insertData = append(insertData, wm.HospitalId)
908
+				insertData = append(insertData, wm.LabSno)
909
+				insertData = append(insertData, wm.ReportDate)
910
+				insertData = append(insertData, wm.CheckDate)
911
+				insertData = append(insertData, wm.InspectedIndicate)
912
+				insertData = append(insertData, wm.InspectedItemEnName)
913
+				insertData = append(insertData, wm.InspectedItemCnName)
914
+				insertData = append(insertData, wm.InspectedResultDesc)
915
+				insertData = append(insertData, wm.InspectedResultValue)
916
+				insertData = append(insertData, wm.InspectedResultUnit)
917
+				insertData = append(insertData, wm.RefRange)
918
+				insertData = append(insertData, wm.UnitType)
919
+				insertData = append(insertData, wm.InspectedResult)
920
+				insertData = append(insertData, wm.Xgbz)
921
+				insertData = append(insertData, wm.CreateTime)
922
+				insertData = append(insertData, wm.Sjscsj)
923
+				thisSQL += strings.Join(insertParams, ", ")
924
+		 		utx.Exec(thisSQL, insertData...)
925
+			}	
926
+		}
927
+	}
928
+	return
929
+}

+ 8 - 7
service/db.go View File

@@ -43,16 +43,17 @@ func CreateDB(Host string, Port string, User string, Pass string, Name string) (
43 43
 	return
44 44
 }
45 45
 
46
-func CreateSqlServiceDB(Host string, Port string, User string, Pass string, Name string) (rsdDb *gorm.DB, err error) {
46
+func CreateSqlServiceDB(Host string, Port string, User string, Pass string, Name string) (mssqlDb *gorm.DB, err error) {
47 47
 	//rdb := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", User, Pass, Host, Port, Name)
48
-	rudsn := fmt.Sprintf("server=%s;port=%s;database=%s;user id=%s;password=%s", Host, Port, Name, User, Pass)
49
-	rsdDb, err = gorm.Open("mysql", rudsn)
48
+	mssqlstring := fmt.Sprintf("server=%s;port=%s;database=%s;user id=%s;password=%s", Host, Port, Name, User, Pass)
49
+	fmt.Println(mssqlstring)
50
+	mssqlDb, err = gorm.Open("mssql", mssqlstring)
50 51
 	if err != nil {
51
-		//beego.Error(err)
52
+		panic(err)
52 53
 	}
53
-	rsdDb.DB().SetMaxIdleConns(5)
54
-	rsdDb.DB().SetMaxOpenConns(20)
55
-	rsdDb.LogMode(true)
54
+	mssqlDb.DB().SetMaxIdleConns(5)
55
+	mssqlDb.DB().SetMaxOpenConns(20)
56
+	mssqlDb.LogMode(true)
56 57
 	return
57 58
 }
58 59