|
@@ -402,9 +402,7 @@ func UpdatePatientCaseHistory(patient_id int64, record_date int64, user_org_id i
|
402
|
402
|
return err
|
403
|
403
|
}
|
404
|
404
|
|
405
|
|
-func SaveHisPrescription(prescription *models.HisPrescription) (err error) {
|
406
|
|
- tx := writeDb.Begin()
|
407
|
|
-
|
|
405
|
+func SaveHisPrescription(tx *gorm.DB, prescription *models.HisPrescription) (err error) {
|
408
|
406
|
if err = tx.Model(&models.HisPrescription{}).Save(prescription).Error; err != nil {
|
409
|
407
|
tx.Rollback()
|
410
|
408
|
return
|
|
@@ -413,6 +411,12 @@ func SaveHisPrescription(prescription *models.HisPrescription) (err error) {
|
413
|
411
|
return
|
414
|
412
|
}
|
415
|
413
|
|
|
414
|
+func SaveHisPrescriptionTwo(prescription *models.HisPrescription) (err error) {
|
|
415
|
+
|
|
416
|
+ err = writeDb.Model(&models.HisPrescription{}).Save(prescription).Error
|
|
417
|
+ return
|
|
418
|
+}
|
|
419
|
+
|
416
|
420
|
func DelelteHisPrescription(id int64, user_org_id int64) (err error) {
|
417
|
421
|
err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
418
|
422
|
err = writeDb.Model(&models.HisDoctorAdviceInfo{}).Where("user_org_id = ? AND prescription_id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
|
@@ -881,8 +885,17 @@ func GetHisAdminUserDoctors(org_id int64) (doctors []*models.UserAdminRole, err
|
881
|
885
|
return
|
882
|
886
|
}
|
883
|
887
|
|
884
|
|
-func CreateHisDoctorAdvice(s *models.HisDoctorAdviceInfo) (err error) {
|
|
888
|
+func CreateHisDoctorAdvice(s *models.HisDoctorAdviceInfo, tx *gorm.DB) (err error) {
|
|
889
|
+ if err = tx.Model(&models.HisDoctorAdviceInfo{}).Save(s).Error; err != nil {
|
|
890
|
+ tx.Rollback()
|
|
891
|
+ return
|
|
892
|
+ }
|
|
893
|
+ tx.Commit()
|
885
|
894
|
|
|
895
|
+ return
|
|
896
|
+}
|
|
897
|
+
|
|
898
|
+func CreateHisDoctorAdviceTwo(s *models.HisDoctorAdviceInfo) (err error) {
|
886
|
899
|
tx := writeDb.Begin()
|
887
|
900
|
if err = tx.Model(&models.HisDoctorAdviceInfo{}).Save(s).Error; err != nil {
|
888
|
901
|
tx.Rollback()
|
|
@@ -893,7 +906,17 @@ func CreateHisDoctorAdvice(s *models.HisDoctorAdviceInfo) (err error) {
|
893
|
906
|
return
|
894
|
907
|
}
|
895
|
908
|
|
896
|
|
-func CreateHisProjectTwo(project *models.HisPrescriptionProject) (err error) {
|
|
909
|
+func CreateHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err error) {
|
|
910
|
+ if err = tx.Model(&models.HisPrescriptionProject{}).Save(project).Error; err != nil {
|
|
911
|
+ tx.Rollback()
|
|
912
|
+ return
|
|
913
|
+ }
|
|
914
|
+ tx.Commit()
|
|
915
|
+
|
|
916
|
+ return
|
|
917
|
+}
|
|
918
|
+
|
|
919
|
+func CreateHisProjectThree(project *models.HisPrescriptionProject) (err error) {
|
897
|
920
|
tx := writeDb.Begin()
|
898
|
921
|
if err = tx.Model(&models.HisPrescriptionProject{}).Save(project).Error; err != nil {
|
899
|
922
|
tx.Rollback()
|
|
@@ -904,8 +927,14 @@ func CreateHisProjectTwo(project *models.HisPrescriptionProject) (err error) {
|
904
|
927
|
return
|
905
|
928
|
}
|
906
|
929
|
|
907
|
|
-func SaveHisProjectTwo(project *models.HisPrescriptionProject) (err error) {
|
908
|
|
- err = writeDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id = ? AND id = ?", project.UserOrgId, project.ID).Updates(map[string]interface{}{"feedetl_sn": project.FeedetlSn, "mtime": time.Now().Unix()}).Error
|
|
930
|
+func SaveHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err error) {
|
|
931
|
+
|
|
932
|
+ if err = tx.Model(&models.HisPrescriptionProject{}).Where("user_org_id = ? AND id = ?", project.UserOrgId, project.ID).Updates(map[string]interface{}{"feedetl_sn": project.FeedetlSn, "mtime": time.Now().Unix()}).Error; err != nil {
|
|
933
|
+ tx.Rollback()
|
|
934
|
+ return
|
|
935
|
+ }
|
|
936
|
+ tx.Commit()
|
|
937
|
+
|
909
|
938
|
return
|
910
|
939
|
}
|
911
|
940
|
|
|
@@ -2593,9 +2622,18 @@ func DeletePrintInfo(id int64) {
|
2593
|
2622
|
writeDb.Model(&models.HisLabelPrintInfo{}).Where("p_project_id = ?", id).Updates(map[string]interface{}{"status": 0})
|
2594
|
2623
|
}
|
2595
|
2624
|
|
2596
|
|
-func CreateHisLabelRecord(label *models.HisLabelPrintInfo) error {
|
2597
|
|
- err := writeDb.Save(&label).Error
|
2598
|
|
- return err
|
|
2625
|
+func CreateHisLabelRecord(label *models.HisLabelPrintInfo, tx *gorm.DB) (err error) {
|
|
2626
|
+ if err = tx.Save(&label).Error; err != nil {
|
|
2627
|
+ tx.Rollback()
|
|
2628
|
+ return
|
|
2629
|
+ }
|
|
2630
|
+ tx.Commit()
|
|
2631
|
+ return
|
|
2632
|
+}
|
|
2633
|
+
|
|
2634
|
+func CreateHisLabelRecordTwo(label *models.HisLabelPrintInfo) (err error) {
|
|
2635
|
+ err = writeDb.Save(&label).Error
|
|
2636
|
+ return
|
2599
|
2637
|
}
|
2600
|
2638
|
|
2601
|
2639
|
func DeletePsnNCDSRecordById(id int64) (err error) {
|