csx преди 4 години
родител
ревизия
619d4a4e9f

+ 31 - 20
controllers/mobile_api_controllers/dialysis_api_controller.go Целия файл

1148
 		PreImpulse:                 pre_impulse,
1148
 		PreImpulse:                 pre_impulse,
1149
 		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
1149
 		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
1150
 		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
1150
 		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
1151
-		Blood:                      blood,
1152
-		DialysisDialyszers:         dialysis_dialyszers,
1153
-		DialysisIrrigation:         dialysis_irrigation,
1154
-		AntioxidantCommodityName:   antioxidant_commodity_name,
1155
-		DisplaceSpeed:              displace_speed,
1151
+		Blood:                    blood,
1152
+		DialysisDialyszers:       dialysis_dialyszers,
1153
+		DialysisIrrigation:       dialysis_irrigation,
1154
+		AntioxidantCommodityName: antioxidant_commodity_name,
1155
+		DisplaceSpeed:            displace_speed,
1156
 	}
1156
 	}
1157
 
1157
 
1158
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
1158
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
1963
 		ALiquid:                   a_liquid,
1963
 		ALiquid:                   a_liquid,
1964
 		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
1964
 		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
1965
 		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
1965
 		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
1966
-		Blood:                     blood,
1967
-		DialysisDialyszers:        dialysis_dialyszers,
1968
-		DialysisIrrigation:        dialysis_irrigation,
1969
-		AntioxidantCommodityName:  antioxidant_commodity_name,
1970
-		DisplaceSpeed:             displace_speed,
1966
+		Blood:                    blood,
1967
+		DialysisDialyszers:       dialysis_dialyszers,
1968
+		DialysisIrrigation:       dialysis_irrigation,
1969
+		AntioxidantCommodityName: antioxidant_commodity_name,
1970
+		DisplaceSpeed:            displace_speed,
1971
 	}
1971
 	}
1972
 
1972
 
1973
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
1973
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
2813
 			}
2813
 			}
2814
 		}
2814
 		}
2815
 
2815
 
2816
-		advices = append(advices, &advice)
2816
+		temp_advice, _ := service.FindRemindAdvice(advice.UserOrgId, advice.AdviceName, advice.AdviceDesc, advice.TemplateId, advice.FrequencyType, patient, advice.RecordDate)
2817
+		if temp_advice.ID == 0 {
2818
+			advices = append(advices, &advice)
2819
+		}
2817
 	}
2820
 	}
2818
 
2821
 
2819
-	list, err := service.CreateMGroupAdvice(adminUserInfo.Org.Id, advices, groupNo)
2822
+	if len(advices) > 0 {
2823
+		list, err := service.CreateMGroupAdvice(adminUserInfo.Org.Id, advices, groupNo)
2820
 
2824
 
2821
-	if err != nil {
2822
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
2823
-		return
2824
-	}
2825
+		if err != nil {
2826
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
2827
+			return
2828
+		}
2825
 
2829
 
2826
-	c.ServeSuccessJSON(map[string]interface{}{
2827
-		"msg":     "ok",
2828
-		"advices": list,
2829
-	})
2830
+		c.ServeSuccessJSON(map[string]interface{}{
2831
+			"msg":     "ok",
2832
+			"advices": list,
2833
+		})
2834
+
2835
+	} else {
2836
+		c.ServeSuccessJSON(map[string]interface{}{
2837
+			"msg": "ok",
2838
+		})
2839
+
2840
+	}
2830
 
2841
 
2831
 	return
2842
 	return
2832
 
2843
 

+ 3 - 0
models/data_models.go Целия файл

17
 	Title          string `gorm:"column:title" json:"title" form:"title"`
17
 	Title          string `gorm:"column:title" json:"title" form:"title"`
18
 	Content        string `gorm:"column:content" json:"content" form:"content"`
18
 	Content        string `gorm:"column:content" json:"content" form:"content"`
19
 	Order          int64  `gorm:"column:orders" json:"orders" form:"orders"`
19
 	Order          int64  `gorm:"column:orders" json:"orders" form:"orders"`
20
+	Code           string `gorm:"column:code" json:"code" form:"code"`
20
 }
21
 }
21
 
22
 
22
 func (Dataconfig) TableName() string {
23
 func (Dataconfig) TableName() string {
40
 	Title          string `gorm:"column:title" json:"title" form:"title"`
41
 	Title          string `gorm:"column:title" json:"title" form:"title"`
41
 	Content        string `gorm:"column:content" json:"content" form:"content"`
42
 	Content        string `gorm:"column:content" json:"content" form:"content"`
42
 	Order          int64  `gorm:"column:orders" json:"orders" form:"orders"`
43
 	Order          int64  `gorm:"column:orders" json:"orders" form:"orders"`
44
+	Code           string `gorm:"column:code" json:"code" form:"code"`
43
 }
45
 }
44
 
46
 
45
 func (DictDataconfig) TableName() string {
47
 func (DictDataconfig) TableName() string {
63
 	Title          string `gorm:"column:title" json:"title" form:"title"`
65
 	Title          string `gorm:"column:title" json:"title" form:"title"`
64
 	Content        string `gorm:"column:content" json:"content" form:"content"`
66
 	Content        string `gorm:"column:content" json:"content" form:"content"`
65
 	Order          int64  `gorm:"column:orders" json:"orders" form:"orders"`
67
 	Order          int64  `gorm:"column:orders" json:"orders" form:"orders"`
68
+	Code           string `gorm:"column:code" json:"code" form:"code"`
66
 }
69
 }
67
 
70
 
68
 func (DictionaryDataconfig) TableName() string {
71
 func (DictionaryDataconfig) TableName() string {

+ 2 - 0
models/drug.go Целия файл

51
 	Mtime                  int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
51
 	Mtime                  int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
52
 	OrgId                  int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
52
 	OrgId                  int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
53
 	DrugCode               string  `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
53
 	DrugCode               string  `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
54
+	DoseCode               string  `gorm:"column:dose_code" json:"dose_code" form:"dose_code"`
55
+
54
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
56
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
55
 }
57
 }
56
 
58
 

+ 6 - 0
service/manage_center_service.go Целия файл

345
 	err := readDb.Model(&models.HisXtDiagnoseConfig{}).Where("id = ? AND status = 1", id).First(&dealer).Error
345
 	err := readDb.Model(&models.HisXtDiagnoseConfig{}).Where("id = ? AND status = 1", id).First(&dealer).Error
346
 	return dealer, err
346
 	return dealer, err
347
 }
347
 }
348
+
349
+func GetDoseCode(dose_id int64, user_org_id int64) (error, string) {
350
+	var data models.DictDataconfig
351
+	err := readDb.Model(&models.DictDataconfig{}).Where(" (user_org_id = ? Or user_org_id = 0) AND parent_id = 4 AND module = 'system' AND status = 1 AND value = ?", user_org_id, dose_id).First(&data).Error
352
+	return err, data.Code
353
+}

+ 5 - 0
service/patient_service.go Целия файл

1479
 	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature}).Error
1479
 	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature}).Error
1480
 	return err
1480
 	return err
1481
 }
1481
 }
1482
+
1483
+func FindRemindAdvice(user_org_id int64, advice_name string, advice_desc string, template_id string, fre_type int64, patient_id int64, record_date int64) (advice models.DoctorAdvice, err error) {
1484
+	err = XTWriteDB().Model(&models.DoctorAdvice{}).Where("patient_id = ? and user_org_id = ? and record_date = ? and advice_name = ? and advice_desc = ? and template_id = ? and frequency_type = ? ", patient_id, user_org_id, record_date, advice_name, advice_desc, template_id, fre_type).First(&advice).Error
1485
+	return
1486
+}

+ 3 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Целия файл

194
 	ALiquid                    int64   `gorm:"column:a_liquid" json:"a_liquid"`
194
 	ALiquid                    int64   `gorm:"column:a_liquid" json:"a_liquid"`
195
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
195
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
196
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
196
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
197
+	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
198
+	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
197
 }
199
 }
198
 
200
 
199
 func (PrescriptionVM) TableName() string {
201
 func (PrescriptionVM) TableName() string {
508
 	Creator                   int64   `gorm:"column:creator" json:"creator" form:"creator"`
510
 	Creator                   int64   `gorm:"column:creator" json:"creator" form:"creator"`
509
 	Modify                    int64   `gorm:"column:modify" json:"modify" form:"modify"`
511
 	Modify                    int64   `gorm:"column:modify" json:"modify" form:"modify"`
510
 	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
512
 	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
513
+	DialysateFlow             float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
511
 }
514
 }
512
 
515
 
513
 func (MonitoringRecordVM) TableName() string {
516
 func (MonitoringRecordVM) TableName() string {

+ 2 - 2
service/role_service.go Целия файл

683
 	return
683
 	return
684
 }
684
 }
685
 
685
 
686
-func GetFunctionPurview() (purview []*models.SgjUserOperatePurview, err error) {
687
-	err = readUserDb.Model(&models.SgjUserOperatePurview{}).Where("status = 1 ").Order("number asc").Find(&purview).Error
686
+func GetFunctionPurview(pid int64) (purview []*models.SgjUserOperatePurview, err error) {
687
+	err = readUserDb.Model(&models.SgjUserOperatePurview{}).Where("status = 1  AND parentid = ?", pid).Order("number asc").Find(&purview).Error
688
 	return
688
 	return
689
 }
689
 }
690
 
690